Changeset 96803 in webkit
- Timestamp:
- Oct 6, 2011 5:53:39 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r96798 r96803 1 2011-10-06 Dominic Cooney <dominicc@chromium.org> 2 3 Don't make virtual calls in Node::parentNode. 4 https://bugs.webkit.org/show_bug.cgi?id=69266 5 6 Reviewed by Antti Koivisto. 7 8 ShadowRoot and SVGShadowRoot remain semantically separate (eg 9 isShadowRoot/isSVGShadowRoot) but share a flag 10 (IsShadowRootOrSVGShadowRootFlag, hitherto IsShadowRootFlag just 11 for ShadowRoot). In combination with IsSVGFlag ShadowRoot (false) 12 can be distinguished from SVGShadowRoot (true). This lets us make 13 isSVGShadowRoot non-virtual. 14 15 No change in behavior => No new tests. 16 17 * dom/Node.cpp: 18 (WebCore::Node::shadowHost): 19 * dom/Node.h: 20 (WebCore::Node::isSVGShadowRoot): 21 (WebCore::Node::isShadowRoot): 22 (WebCore::Node::parentNode): 23 (WebCore::Node::parentNodeGuaranteedHostFree): 24 * rendering/svg/SVGShadowTreeElements.cpp: 25 (WebCore::SVGShadowTreeContainerElement::SVGShadowTreeContainerElement): 26 (WebCore::SVGShadowTreeRootElement::SVGShadowTreeRootElement): 27 * rendering/svg/SVGShadowTreeElements.h: 28 * svg/SVGElement.cpp: 29 (WebCore::SVGElement::SVGElement): 30 * svg/SVGElement.h: 31 * svg/SVGGElement.cpp: 32 (WebCore::SVGGElement::SVGGElement): 33 * svg/SVGGElement.h: 34 * svg/SVGStyledElement.cpp: 35 (WebCore::SVGStyledElement::SVGStyledElement): 36 * svg/SVGStyledElement.h: 37 * svg/SVGStyledLocatableElement.cpp: 38 (WebCore::SVGStyledLocatableElement::SVGStyledLocatableElement): 39 * svg/SVGStyledLocatableElement.h: 40 * svg/SVGStyledTransformableElement.cpp: 41 (WebCore::SVGStyledTransformableElement::SVGStyledTransformableElement): 42 * svg/SVGStyledTransformableElement.h: 43 1 44 2011-10-06 John Knottenbelt <jknotten@chromium.org> 2 45 -
trunk/Source/WebCore/dom/Node.cpp
r96782 r96803 564 564 Element* Node::shadowHost() const 565 565 { 566 return toElement( getFlag(IsShadowRootFlag) ? parent() : 0);566 return toElement(isShadowRoot() ? parent() : 0); 567 567 } 568 568 -
trunk/Source/WebCore/dom/Node.h
r96782 r96803 199 199 200 200 bool isSVGElement() const { return getFlag(IsSVGFlag); } 201 virtual bool isSVGShadowRoot() const { return false; }201 bool isSVGShadowRoot() const { return getFlag(IsShadowRootOrSVGShadowRootFlag) && isSVGElement(); } 202 202 #if ENABLE(SVG) 203 203 SVGUseElement* svgShadowHost() const; … … 212 212 virtual bool isCharacterDataNode() const { return false; } 213 213 bool isDocumentNode() const; 214 bool isShadowRoot() const { return getFlag(IsShadowRoot Flag); }214 bool isShadowRoot() const { return getFlag(IsShadowRootOrSVGShadowRootFlag) && !isSVGElement(); } 215 215 virtual bool isContentElement() const { return false; } 216 216 virtual bool canHaveLightChildRendererWithShadow() const { return false; } … … 601 601 InDetachFlag = 1 << 16, 602 602 HasRareDataFlag = 1 << 17, 603 IsShadowRoot Flag = 1 << 18,603 IsShadowRootOrSVGShadowRootFlag = 1 << 18, 604 604 605 605 // These bits are used by derived classes, pulled up here so they can … … 641 641 CreateContainer = DefaultNodeFlags | IsContainerFlag, 642 642 CreateElement = CreateContainer | IsElementFlag, 643 CreateShadowRoot = CreateContainer | IsShadowRoot Flag,643 CreateShadowRoot = CreateContainer | IsShadowRootOrSVGShadowRootFlag, 644 644 CreateStyledElement = CreateElement | IsStyledElementFlag, 645 645 CreateHTMLElement = CreateStyledElement | IsHTMLFlag, 646 646 CreateSVGElement = CreateStyledElement | IsSVGFlag, 647 CreateSVGShadowRoot = CreateSVGElement | IsShadowRootOrSVGShadowRootFlag, 647 648 }; 648 649 Node(Document*, ConstructionType); … … 744 745 inline ContainerNode* Node::parentNode() const 745 746 { 746 return getFlag(IsShadowRoot Flag) || isSVGShadowRoot() ? 0 : parent();747 return getFlag(IsShadowRootOrSVGShadowRootFlag) ? 0 : parent(); 747 748 } 748 749 … … 754 755 inline ContainerNode* Node::parentNodeGuaranteedHostFree() const 755 756 { 756 ASSERT(!getFlag(IsShadowRoot Flag) && !isSVGShadowRoot());757 ASSERT(!getFlag(IsShadowRootOrSVGShadowRootFlag)); 757 758 return parentOrHostNode(); 758 759 } -
trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.cpp
r95901 r96803 34 34 // SVGShadowTreeContainerElement 35 35 36 SVGShadowTreeContainerElement::SVGShadowTreeContainerElement(Document* document )37 : SVGGElement(SVGNames::gTag, document )36 SVGShadowTreeContainerElement::SVGShadowTreeContainerElement(Document* document, ConstructionType constructionType) 37 : SVGGElement(SVGNames::gTag, document, constructionType) 38 38 , m_containerOffsetChanged(false) 39 39 { … … 64 64 65 65 inline SVGShadowTreeRootElement::SVGShadowTreeRootElement(Document* document, SVGUseElement* host) 66 : SVGShadowTreeContainerElement(document )66 : SVGShadowTreeContainerElement(document, CreateSVGShadowRoot) 67 67 { 68 68 setParent(host); -
trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.h
r95901 r96803 43 43 44 44 protected: 45 SVGShadowTreeContainerElement(Document* );45 SVGShadowTreeContainerElement(Document*, ConstructionType = CreateSVGElement); 46 46 47 47 private: … … 61 61 void clearSVGShadowHost(); 62 62 63 virtual bool isSVGShadowRoot() const { return true; }64 65 63 private: 66 64 SVGShadowTreeRootElement(Document*, SVGUseElement* host); -
trunk/Source/WebCore/svg/SVGElement.cpp
r94659 r96803 56 56 using namespace HTMLNames; 57 57 58 SVGElement::SVGElement(const QualifiedName& tagName, Document* document )59 : StyledElement(tagName, document, CreateSVGElement)58 SVGElement::SVGElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType) 59 : StyledElement(tagName, document, constructionType) 60 60 { 61 61 setHasCustomStyleForRenderer(); -
trunk/Source/WebCore/svg/SVGElement.h
r96307 r96803 103 103 104 104 protected: 105 SVGElement(const QualifiedName&, Document* );105 SVGElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); 106 106 107 107 virtual void parseMappedAttribute(Attribute*); -
trunk/Source/WebCore/svg/SVGGElement.cpp
r96307 r96803 41 41 END_REGISTER_ANIMATED_PROPERTIES 42 42 43 SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document )44 : SVGStyledTransformableElement(tagName, document )43 SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType) 44 : SVGStyledTransformableElement(tagName, document, constructionType) 45 45 { 46 46 ASSERT(hasTagName(SVGNames::gTag)); -
trunk/Source/WebCore/svg/SVGGElement.h
r90680 r96803 41 41 42 42 protected: 43 SVGGElement(const QualifiedName&, Document* );43 SVGGElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); 44 44 45 45 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); -
trunk/Source/WebCore/svg/SVGStyledElement.cpp
r94928 r96803 65 65 } 66 66 67 SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* document )68 : SVGElement(tagName, document )67 SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType) 68 : SVGElement(tagName, document, constructionType) 69 69 { 70 70 registerAnimatedPropertiesForSVGStyledElement(); -
trunk/Source/WebCore/svg/SVGStyledElement.h
r95047 r96803 63 63 64 64 protected: 65 SVGStyledElement(const QualifiedName&, Document* );65 SVGStyledElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); 66 66 virtual bool rendererIsNeeded(const NodeRenderingContext&); 67 67 -
trunk/Source/WebCore/svg/SVGStyledLocatableElement.cpp
r91404 r96803 30 30 namespace WebCore { 31 31 32 SVGStyledLocatableElement::SVGStyledLocatableElement(const QualifiedName& tagName, Document* document )33 : SVGStyledElement(tagName, document )32 SVGStyledLocatableElement::SVGStyledLocatableElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType) 33 : SVGStyledElement(tagName, document, constructionType) 34 34 { 35 35 } -
trunk/Source/WebCore/svg/SVGStyledLocatableElement.h
r91404 r96803 43 43 44 44 protected: 45 SVGStyledLocatableElement(const QualifiedName&, Document* );45 SVGStyledLocatableElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); 46 46 47 47 private: -
trunk/Source/WebCore/svg/SVGStyledTransformableElement.cpp
r96307 r96803 41 41 END_REGISTER_ANIMATED_PROPERTIES 42 42 43 SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* document )44 : SVGStyledLocatableElement(tagName, document )43 SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType) 44 : SVGStyledLocatableElement(tagName, document, constructionType) 45 45 { 46 46 registerAnimatedPropertiesForSVGStyledTransformableElement(); -
trunk/Source/WebCore/svg/SVGStyledTransformableElement.h
r91404 r96803 54 54 55 55 protected: 56 SVGStyledTransformableElement(const QualifiedName&, Document* );56 SVGStyledTransformableElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); 57 57 58 58 bool isSupportedAttribute(const QualifiedName&);
Note: See TracChangeset
for help on using the changeset viewer.