Changeset 273935 in webkit
- Timestamp:
- Mar 4, 2021, 5:28:03 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 11 edited
-
ChangeLog (modified) (1 diff)
-
dom/Node.h (modified) (2 diffs)
-
dom/make_names.pl (modified) (1 diff)
-
html/HTMLElement.h (modified) (1 diff)
-
html/HTMLUnknownElement.h (modified) (1 diff)
-
mathml/MathMLElement.cpp (modified) (1 diff)
-
mathml/MathMLElement.h (modified) (1 diff)
-
mathml/MathMLUnknownElement.h (modified) (1 diff)
-
svg/SVGElement.cpp (modified) (1 diff)
-
svg/SVGElement.h (modified) (1 diff)
-
svg/SVGUnknownElement.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r273928 r273935 1 2021-03-04 Ryosuke Niwa <rniwa@webkit.org> 2 3 "precustomized" state of custom elements can become HTMLUnknownElement 4 https://bugs.webkit.org/show_bug.cgi?id=221652 5 6 Reviewed by Darin Adler. 7 8 The bug was caused by createJSHTMLWrapper in JSHTMLElementWrapperFactory.cpp relying on 9 !isCustomElementUpgradeCandidate() to create HTMLUnknownElement as JS wrapper of the element. 10 11 This is problematic after r266269 since that change re-purposes CustomElementState::Failed 12 on a custom element as "precustomized" state instead of introducing another enum value in 13 CustomElementState as RareDataBitFields has no more bits available. 14 15 This patch fixes the problem by introducing a new NodeFlag::IsUnknownElement and using that 16 to check whether JSHTMLUnknownElement should be created for a given element or not. Note that 17 HTMLElement had a virtual function, isHTMLUnknownElement, to check this condition but invoking 18 a virtual function proved to incur too much runtime cost. 19 20 * dom/Node.h: 21 (WebCore::Node::isUnknownElement const): Added. 22 (WebCore::Node::isHTMLUnknownElement const): Added. 23 (WebCore::Node::isSVGUnknownElement const): Added. 24 (WebCore::Node::isMathMLUnknownElement const): Added. 25 (WebCore::Node::NodeFlag): Added NodeFlag::IsUnknownElement. 26 * dom/make_names.pl: 27 (printWrapperFactoryCppFile): Treat the element as HTMLUnknownElement only if isUnknownElement 28 returns true instead of isCustomElementUpgradeCandidate returning false. 29 * html/HTMLElement.h: 30 (WebCore::HTMLElement::isHTMLUnknownElement const): Deleted. 31 * html/HTMLUnknownElement.h: 32 * mathml/MathMLElement.cpp: 33 (WebCore::MathMLElement::MathMLElement): Added ConstructionType as an argument. 34 * mathml/MathMLElement.h: 35 * mathml/MathMLUnknownElement.h: 36 (WebCore::MathMLUnknownElement::MathMLUnknownElement): Set NodeFlag::IsUnknownElement. 37 * svg/SVGElement.cpp: 38 (WebCore::SVGElement::SVGElement): Added ConstructionType as an argument. 39 * svg/SVGElement.h: 40 * svg/SVGUnknownElement.h: 41 (WebCore::SVGUnknownElement::SVGUnknownElement): Set NodeFlag::IsUnknownElement. 42 1 43 2021-03-04 Don Olmstead <don.olmstead@sony.com> 2 44 -
trunk/Source/WebCore/dom/Node.h
r273812 r273935 194 194 bool isMathMLElement() const { return hasNodeFlag(NodeFlag::IsMathMLElement); } 195 195 196 bool isUnknownElement() const { return hasNodeFlag(NodeFlag::IsUnknownElement); } 197 bool isHTMLUnknownElement() const { return isHTMLElement() && isUnknownElement(); } 198 bool isSVGUnknownElement() const { return isSVGElement() && isUnknownElement(); } 199 bool isMathMLUnknownElement() const { return isMathMLElement() && isUnknownElement(); } 200 196 201 bool isPseudoElement() const { return pseudoId() != PseudoId::None; } 197 202 bool isBeforePseudoElement() const { return pseudoId() == PseudoId::Before; } … … 528 533 IsConnected = 1 << 10, 529 534 IsInShadowTree = 1 << 11, 530 HasEventTargetData= 1 << 12,531 // UnusedFlag= 1 << 13,535 IsUnknownElement = 1 << 12, 536 HasEventTargetData = 1 << 13, 532 537 533 538 // These bits are used by derived classes, pulled up here so they can -
trunk/Source/WebCore/dom/make_names.pl
r273880 r273935 1280 1280 if ($parameters{customElementInterfaceName}) { 1281 1281 print F <<END 1282 if ( element->isCustomElementUpgradeCandidate())1282 if (!element->isUnknownElement()) 1283 1283 return createWrapper<$parameters{customElementInterfaceName}>(globalObject, WTFMove(element)); 1284 END 1285 ; 1286 } 1287 1288 if ("$parameters{namespace}Element" eq $parameters{fallbackJSInterfaceName}) { 1289 print F <<END 1290 ASSERT(element->is$parameters{fallbackJSInterfaceName}()); 1284 1291 END 1285 1292 ; -
trunk/Source/WebCore/html/HTMLElement.h
r272503 r273935 87 87 TextDirection directionalityIfhasDirAutoAttribute(bool& isAuto) const; 88 88 89 virtual bool isHTMLUnknownElement() const { return false; }90 89 virtual bool isTextControlInnerTextElement() const { return false; } 91 90 -
trunk/Source/WebCore/html/HTMLUnknownElement.h
r229694 r273935 44 44 private: 45 45 HTMLUnknownElement(const QualifiedName& tagName, Document& document) 46 : HTMLElement(tagName, document, CreateHTMLElement )46 : HTMLElement(tagName, document, CreateHTMLElement | NodeFlag::IsUnknownElement) 47 47 { 48 48 } 49 50 bool isHTMLUnknownElement() const final { return true; }51 49 }; 52 50 -
trunk/Source/WebCore/mathml/MathMLElement.cpp
r271124 r273935 51 51 using namespace MathMLNames; 52 52 53 MathMLElement::MathMLElement(const QualifiedName& tagName, Document& document )54 : StyledElement(tagName, document, CreateMathMLElement)53 MathMLElement::MathMLElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType) 54 : StyledElement(tagName, document, constructionType) 55 55 { 56 56 } -
trunk/Source/WebCore/mathml/MathMLElement.h
r267578 r273935 91 91 92 92 protected: 93 MathMLElement(const QualifiedName& tagName, Document& );93 MathMLElement(const QualifiedName& tagName, Document&, ConstructionType = CreateMathMLElement); 94 94 95 95 void parseAttribute(const QualifiedName&, const AtomString&) override; -
trunk/Source/WebCore/mathml/MathMLUnknownElement.h
r232064 r273935 42 42 private: 43 43 MathMLUnknownElement(const QualifiedName& tagName, Document& document) 44 : MathMLElement(tagName, document )44 : MathMLElement(tagName, document, CreateMathMLElement | NodeFlag::IsUnknownElement) 45 45 { 46 46 } -
trunk/Source/WebCore/svg/SVGElement.cpp
r271806 r273935 156 156 } 157 157 158 SVGElement::SVGElement(const QualifiedName& tagName, Document& document )159 : StyledElement(tagName, document, CreateSVGElement)158 SVGElement::SVGElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType) 159 : StyledElement(tagName, document, constructionType) 160 160 , m_propertyAnimatorFactory(makeUnique<SVGPropertyAnimatorFactory>()) 161 161 { -
trunk/Source/WebCore/svg/SVGElement.h
r271806 r273935 148 148 149 149 protected: 150 SVGElement(const QualifiedName&, Document& );150 SVGElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement); 151 151 virtual ~SVGElement(); 152 152 -
trunk/Source/WebCore/svg/SVGUnknownElement.h
r229694 r273935 46 46 private: 47 47 SVGUnknownElement(const QualifiedName& tagName, Document& document) 48 : SVGElement(tagName, document )48 : SVGElement(tagName, document, CreateSVGElement | NodeFlag::IsUnknownElement) 49 49 { 50 50 }
Note:
See TracChangeset
for help on using the changeset viewer.