mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:07:36 +00:00
LibWeb: Use cached_web_prototype() as much as possible
Unlike ensure_web_prototype<T>(), the cached version doesn't require the prototype type to be fully formed, so we can use it without including the FooPrototype.h header. It's also a bit less verbose. :^)
This commit is contained in:
parent
a85542958c
commit
ffad902c07
165 changed files with 176 additions and 325 deletions
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGAnimatedLengthPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
||||
|
||||
|
@ -20,7 +19,7 @@ SVGAnimatedLength::SVGAnimatedLength(HTML::Window& window, JS::NonnullGCPtr<SVGL
|
|||
, m_base_val(move(base_val))
|
||||
, m_anim_val(move(anim_val))
|
||||
{
|
||||
set_prototype(&window.ensure_web_prototype<Bindings::SVGAnimatedLengthPrototype>("SVGAnimatedLength"));
|
||||
set_prototype(&window.cached_web_prototype("SVGAnimatedLength"));
|
||||
|
||||
// The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.
|
||||
VERIFY(m_base_val.ptr() != m_anim_val.ptr());
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGCircleElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
|
@ -15,7 +14,7 @@ namespace Web::SVG {
|
|||
SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGCircleElementPrototype>("SVGCircleElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGCircleElement"));
|
||||
}
|
||||
|
||||
void SVGCircleElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGClipPathElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGClipPathElement.h>
|
||||
|
||||
|
@ -13,7 +12,7 @@ namespace Web::SVG {
|
|||
SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGClipPathElementPrototype>("SVGClipPathElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGClipPathElement"));
|
||||
}
|
||||
|
||||
SVGClipPathElement::~SVGClipPathElement()
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGDefsElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGDefsElement.h>
|
||||
|
||||
|
@ -13,7 +12,7 @@ namespace Web::SVG {
|
|||
SVGDefsElement::SVGDefsElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGDefsElementPrototype>("SVGDefsElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGDefsElement"));
|
||||
}
|
||||
|
||||
SVGDefsElement::~SVGDefsElement()
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGElement.h>
|
||||
|
||||
|
@ -14,7 +13,7 @@ SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_nam
|
|||
: Element(document, move(qualified_name))
|
||||
, m_dataset(HTML::DOMStringMap::create(*this))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGElementPrototype>("SVGElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGElement"));
|
||||
}
|
||||
|
||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGEllipseElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
|
@ -15,7 +14,7 @@ namespace Web::SVG {
|
|||
SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGEllipseElementPrototype>("SVGEllipseElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGEllipseElement"));
|
||||
}
|
||||
|
||||
void SVGEllipseElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGGeometryElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||
#include <LibWeb/SVG/SVGGeometryElement.h>
|
||||
|
@ -14,7 +13,7 @@ namespace Web::SVG {
|
|||
SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGGeometryElementPrototype>("SVGGeometryElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGGeometryElement"));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGGraphicsElementPrototype.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Layout/Node.h>
|
||||
|
@ -17,7 +16,7 @@ namespace Web::SVG {
|
|||
SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGGraphicsElementPrototype>("SVGGraphicsElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGGraphicsElement"));
|
||||
}
|
||||
|
||||
void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGLengthPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/SVGLength.h>
|
||||
|
||||
|
@ -20,7 +19,7 @@ SVGLength::SVGLength(HTML::Window& window, u8 unit_type, float value)
|
|||
, m_unit_type(unit_type)
|
||||
, m_value(value)
|
||||
{
|
||||
set_prototype(&window.ensure_web_prototype<Bindings::SVGLengthPrototype>("SVGLength"));
|
||||
set_prototype(&window.cached_web_prototype("SVGLength"));
|
||||
}
|
||||
|
||||
SVGLength::~SVGLength() = default;
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGLineElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
|
@ -15,7 +14,7 @@ namespace Web::SVG {
|
|||
SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGLineElementPrototype>("SVGLineElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGLineElement"));
|
||||
}
|
||||
|
||||
void SVGLineElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <AK/ExtraMathConstants.h>
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibGfx/Path.h>
|
||||
#include <LibWeb/Bindings/SVGPathElementPrototype.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/Layout/SVGGeometryBox.h>
|
||||
|
@ -87,7 +86,7 @@ namespace Web::SVG {
|
|||
SVGPathElement::SVGPathElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGPathElementPrototype>("SVGPathElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGPathElement"));
|
||||
}
|
||||
|
||||
void SVGPathElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGPolygonElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
|
@ -15,7 +14,7 @@ namespace Web::SVG {
|
|||
SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGPolygonElementPrototype>("SVGPolygonElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGPolygonElement"));
|
||||
}
|
||||
|
||||
void SVGPolygonElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGPolylineElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
|
@ -15,7 +14,7 @@ namespace Web::SVG {
|
|||
SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGPolylineElementPrototype>("SVGPolylineElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGPolylineElement"));
|
||||
}
|
||||
|
||||
void SVGPolylineElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -4,20 +4,19 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "SVGRectElement.h"
|
||||
#include <LibWeb/Bindings/SVGRectElementPrototype.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/AttributeParser.h>
|
||||
#include <LibWeb/SVG/SVGAnimatedLength.h>
|
||||
#include <LibWeb/SVG/SVGLength.h>
|
||||
#include <LibWeb/SVG/SVGRectElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGeometryElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGRectElementPrototype>("SVGRectElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGRectElement"));
|
||||
}
|
||||
|
||||
void SVGRectElement::parse_attribute(FlyString const& name, String const& value)
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
|
||||
#include <LibGfx/Painter.h>
|
||||
#include <LibWeb/Bindings/SVGSVGElementPrototype.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -21,7 +20,7 @@ namespace Web::SVG {
|
|||
SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, qualified_name)
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGSVGElementPrototype>("SVGSVGElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGSVGElement"));
|
||||
}
|
||||
|
||||
RefPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <AK/Utf16View.h>
|
||||
#include <LibWeb/Bindings/SVGTextContentElementPrototype.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/SVG/SVGTextContentElement.h>
|
||||
|
||||
|
@ -14,7 +13,7 @@ namespace Web::SVG {
|
|||
SVGTextContentElement::SVGTextContentElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: SVGGraphicsElement(document, move(qualified_name))
|
||||
{
|
||||
set_prototype(&window().ensure_web_prototype<Bindings::SVGTextContentElementPrototype>("SVGTextContentElement"));
|
||||
set_prototype(&window().cached_web_prototype("SVGTextContentElement"));
|
||||
}
|
||||
|
||||
// https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue