Diff
Modified: trunk/Source/WebCore/ChangeLog (96802 => 96803)
--- trunk/Source/WebCore/ChangeLog 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/ChangeLog 2011-10-06 12:53:39 UTC (rev 96803)
@@ -1,3 +1,46 @@
+2011-10-06 Dominic Cooney <[email protected]>
+
+ Don't make virtual calls in Node::parentNode.
+ https://bugs.webkit.org/show_bug.cgi?id=69266
+
+ Reviewed by Antti Koivisto.
+
+ ShadowRoot and SVGShadowRoot remain semantically separate (eg
+ isShadowRoot/isSVGShadowRoot) but share a flag
+ (IsShadowRootOrSVGShadowRootFlag, hitherto IsShadowRootFlag just
+ for ShadowRoot). In combination with IsSVGFlag ShadowRoot (false)
+ can be distinguished from SVGShadowRoot (true). This lets us make
+ isSVGShadowRoot non-virtual.
+
+ No change in behavior => No new tests.
+
+ * dom/Node.cpp:
+ (WebCore::Node::shadowHost):
+ * dom/Node.h:
+ (WebCore::Node::isSVGShadowRoot):
+ (WebCore::Node::isShadowRoot):
+ (WebCore::Node::parentNode):
+ (WebCore::Node::parentNodeGuaranteedHostFree):
+ * rendering/svg/SVGShadowTreeElements.cpp:
+ (WebCore::SVGShadowTreeContainerElement::SVGShadowTreeContainerElement):
+ (WebCore::SVGShadowTreeRootElement::SVGShadowTreeRootElement):
+ * rendering/svg/SVGShadowTreeElements.h:
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::SVGElement):
+ * svg/SVGElement.h:
+ * svg/SVGGElement.cpp:
+ (WebCore::SVGGElement::SVGGElement):
+ * svg/SVGGElement.h:
+ * svg/SVGStyledElement.cpp:
+ (WebCore::SVGStyledElement::SVGStyledElement):
+ * svg/SVGStyledElement.h:
+ * svg/SVGStyledLocatableElement.cpp:
+ (WebCore::SVGStyledLocatableElement::SVGStyledLocatableElement):
+ * svg/SVGStyledLocatableElement.h:
+ * svg/SVGStyledTransformableElement.cpp:
+ (WebCore::SVGStyledTransformableElement::SVGStyledTransformableElement):
+ * svg/SVGStyledTransformableElement.h:
+
2011-10-06 John Knottenbelt <[email protected]>
Take pageScaleFactor into account for MouseRelatedEvents.
Modified: trunk/Source/WebCore/dom/Node.cpp (96802 => 96803)
--- trunk/Source/WebCore/dom/Node.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/dom/Node.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -563,7 +563,7 @@
Element* Node::shadowHost() const
{
- return toElement(getFlag(IsShadowRootFlag) ? parent() : 0);
+ return toElement(isShadowRoot() ? parent() : 0);
}
void Node::setShadowHost(Element* host)
Modified: trunk/Source/WebCore/dom/Node.h (96802 => 96803)
--- trunk/Source/WebCore/dom/Node.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/dom/Node.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -198,7 +198,7 @@
bool isHTMLElement() const { return getFlag(IsHTMLFlag); }
bool isSVGElement() const { return getFlag(IsSVGFlag); }
- virtual bool isSVGShadowRoot() const { return false; }
+ bool isSVGShadowRoot() const { return getFlag(IsShadowRootOrSVGShadowRootFlag) && isSVGElement(); }
#if ENABLE(SVG)
SVGUseElement* svgShadowHost() const;
#endif
@@ -211,7 +211,7 @@
bool isCommentNode() const { return getFlag(IsCommentFlag); }
virtual bool isCharacterDataNode() const { return false; }
bool isDocumentNode() const;
- bool isShadowRoot() const { return getFlag(IsShadowRootFlag); }
+ bool isShadowRoot() const { return getFlag(IsShadowRootOrSVGShadowRootFlag) && !isSVGElement(); }
virtual bool isContentElement() const { return false; }
virtual bool canHaveLightChildRendererWithShadow() const { return false; }
@@ -600,7 +600,7 @@
InActiveChainFlag = 1 << 15,
InDetachFlag = 1 << 16,
HasRareDataFlag = 1 << 17,
- IsShadowRootFlag = 1 << 18,
+ IsShadowRootOrSVGShadowRootFlag = 1 << 18,
// These bits are used by derived classes, pulled up here so they can
// be stored in the same memory word as the Node bits above.
@@ -640,10 +640,11 @@
CreateComment = DefaultNodeFlags | IsCommentFlag,
CreateContainer = DefaultNodeFlags | IsContainerFlag,
CreateElement = CreateContainer | IsElementFlag,
- CreateShadowRoot = CreateContainer | IsShadowRootFlag,
+ CreateShadowRoot = CreateContainer | IsShadowRootOrSVGShadowRootFlag,
CreateStyledElement = CreateElement | IsStyledElementFlag,
CreateHTMLElement = CreateStyledElement | IsHTMLFlag,
CreateSVGElement = CreateStyledElement | IsSVGFlag,
+ CreateSVGShadowRoot = CreateSVGElement | IsShadowRootOrSVGShadowRootFlag,
};
Node(Document*, ConstructionType);
@@ -743,7 +744,7 @@
inline ContainerNode* Node::parentNode() const
{
- return getFlag(IsShadowRootFlag) || isSVGShadowRoot() ? 0 : parent();
+ return getFlag(IsShadowRootOrSVGShadowRootFlag) ? 0 : parent();
}
inline ContainerNode* Node::parentOrHostNode() const
@@ -753,7 +754,7 @@
inline ContainerNode* Node::parentNodeGuaranteedHostFree() const
{
- ASSERT(!getFlag(IsShadowRootFlag) && !isSVGShadowRoot());
+ ASSERT(!getFlag(IsShadowRootOrSVGShadowRootFlag));
return parentOrHostNode();
}
Modified: trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.cpp (96802 => 96803)
--- trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -33,8 +33,8 @@
// SVGShadowTreeContainerElement
-SVGShadowTreeContainerElement::SVGShadowTreeContainerElement(Document* document)
- : SVGGElement(SVGNames::gTag, document)
+SVGShadowTreeContainerElement::SVGShadowTreeContainerElement(Document* document, ConstructionType constructionType)
+ : SVGGElement(SVGNames::gTag, document, constructionType)
, m_containerOffsetChanged(false)
{
}
@@ -63,7 +63,7 @@
// SVGShadowTreeRootElement
inline SVGShadowTreeRootElement::SVGShadowTreeRootElement(Document* document, SVGUseElement* host)
- : SVGShadowTreeContainerElement(document)
+ : SVGShadowTreeContainerElement(document, CreateSVGShadowRoot)
{
setParent(host);
setInDocument();
Modified: trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.h (96802 => 96803)
--- trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/rendering/svg/SVGShadowTreeElements.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -42,7 +42,7 @@
virtual PassRefPtr<RenderStyle> customStyleForRenderer();
protected:
- SVGShadowTreeContainerElement(Document*);
+ SVGShadowTreeContainerElement(Document*, ConstructionType = CreateSVGElement);
private:
virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
@@ -60,8 +60,6 @@
void attachElement(PassRefPtr<RenderStyle>, RenderArena*);
void clearSVGShadowHost();
- virtual bool isSVGShadowRoot() const { return true; }
-
private:
SVGShadowTreeRootElement(Document*, SVGUseElement* host);
};
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -55,8 +55,8 @@
using namespace HTMLNames;
-SVGElement::SVGElement(const QualifiedName& tagName, Document* document)
- : StyledElement(tagName, document, CreateSVGElement)
+SVGElement::SVGElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType)
+ : StyledElement(tagName, document, constructionType)
{
setHasCustomStyleForRenderer();
}
Modified: trunk/Source/WebCore/svg/SVGElement.h (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGElement.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGElement.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -102,7 +102,7 @@
virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap();
protected:
- SVGElement(const QualifiedName&, Document*);
+ SVGElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
virtual void parseMappedAttribute(Attribute*);
Modified: trunk/Source/WebCore/svg/SVGGElement.cpp (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGGElement.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGGElement.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -40,8 +40,8 @@
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
END_REGISTER_ANIMATED_PROPERTIES
-SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document)
- : SVGStyledTransformableElement(tagName, document)
+SVGGElement::SVGGElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType)
+ : SVGStyledTransformableElement(tagName, document, constructionType)
{
ASSERT(hasTagName(SVGNames::gTag));
registerAnimatedPropertiesForSVGGElement();
Modified: trunk/Source/WebCore/svg/SVGGElement.h (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGGElement.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGGElement.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -40,7 +40,7 @@
virtual bool isShadowTreeContainerElement() const { return false; }
protected:
- SVGGElement(const QualifiedName&, Document*);
+ SVGGElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
Modified: trunk/Source/WebCore/svg/SVGStyledElement.cpp (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGStyledElement.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGStyledElement.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -64,8 +64,8 @@
propertyNameToIdMap->set(attrName.localName().impl(), propertyId);
}
-SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* document)
- : SVGElement(tagName, document)
+SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType)
+ : SVGElement(tagName, document, constructionType)
{
registerAnimatedPropertiesForSVGStyledElement();
}
Modified: trunk/Source/WebCore/svg/SVGStyledElement.h (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGStyledElement.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGStyledElement.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -62,7 +62,7 @@
virtual bool needsPendingResourceHandling() const { return true; }
protected:
- SVGStyledElement(const QualifiedName&, Document*);
+ SVGStyledElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const;
Modified: trunk/Source/WebCore/svg/SVGStyledLocatableElement.cpp (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGStyledLocatableElement.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGStyledLocatableElement.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -29,8 +29,8 @@
namespace WebCore {
-SVGStyledLocatableElement::SVGStyledLocatableElement(const QualifiedName& tagName, Document* document)
- : SVGStyledElement(tagName, document)
+SVGStyledLocatableElement::SVGStyledLocatableElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType)
+ : SVGStyledElement(tagName, document, constructionType)
{
}
Modified: trunk/Source/WebCore/svg/SVGStyledLocatableElement.h (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGStyledLocatableElement.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGStyledLocatableElement.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -42,7 +42,7 @@
virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGLocatable::localCoordinateSpaceTransform(mode); }
protected:
- SVGStyledLocatableElement(const QualifiedName&, Document*);
+ SVGStyledLocatableElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
private:
virtual bool isStyledLocatable() const { return true; }
Modified: trunk/Source/WebCore/svg/SVGStyledTransformableElement.cpp (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGStyledTransformableElement.cpp 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGStyledTransformableElement.cpp 2011-10-06 12:53:39 UTC (rev 96803)
@@ -40,8 +40,8 @@
REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledLocatableElement)
END_REGISTER_ANIMATED_PROPERTIES
-SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* document)
- : SVGStyledLocatableElement(tagName, document)
+SVGStyledTransformableElement::SVGStyledTransformableElement(const QualifiedName& tagName, Document* document, ConstructionType constructionType)
+ : SVGStyledLocatableElement(tagName, document, constructionType)
{
registerAnimatedPropertiesForSVGStyledTransformableElement();
}
Modified: trunk/Source/WebCore/svg/SVGStyledTransformableElement.h (96802 => 96803)
--- trunk/Source/WebCore/svg/SVGStyledTransformableElement.h 2011-10-06 11:57:44 UTC (rev 96802)
+++ trunk/Source/WebCore/svg/SVGStyledTransformableElement.h 2011-10-06 12:53:39 UTC (rev 96803)
@@ -53,7 +53,7 @@
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
protected:
- SVGStyledTransformableElement(const QualifiedName&, Document*);
+ SVGStyledTransformableElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);
bool isSupportedAttribute(const QualifiedName&);
virtual void parseMappedAttribute(Attribute*);