Title: [135544] trunk/Source/WebCore
- Revision
- 135544
- Author
- [email protected]
- Date
- 2012-11-22 14:45:59 -0800 (Thu, 22 Nov 2012)
Log Message
Remove SVGShadowText class
https://bugs.webkit.org/show_bug.cgi?id=103088
Reviewed by Ryosuke Niwa.
Remove SVGShadowText class and merge the little functionality it has to Text.
* dom/Text.cpp:
(WebCore):
(WebCore::isSVGShadowText):
Figure out if we are a SVGShadowText from the context.
(WebCore::isSVGText):
(WebCore::Text::createRenderer):
(WebCore::Text::recalcTextStyle):
Factor SVG special case testing to functions.
* dom/Text.h:
(Text):
Get rid of the now unnecessary willRecalcTextStyle mechanism.
* svg/SVGTRefElement.cpp:
(WebCore):
(WebCore::SVGTRefElement::updateReferencedText):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (135543 => 135544)
--- trunk/Source/WebCore/ChangeLog 2012-11-22 22:38:14 UTC (rev 135543)
+++ trunk/Source/WebCore/ChangeLog 2012-11-22 22:45:59 UTC (rev 135544)
@@ -1,3 +1,33 @@
+2012-11-22 Antti Koivisto <[email protected]>
+
+ Remove SVGShadowText class
+ https://bugs.webkit.org/show_bug.cgi?id=103088
+
+ Reviewed by Ryosuke Niwa.
+
+ Remove SVGShadowText class and merge the little functionality it has to Text.
+
+ * dom/Text.cpp:
+ (WebCore):
+ (WebCore::isSVGShadowText):
+
+ Figure out if we are a SVGShadowText from the context.
+
+ (WebCore::isSVGText):
+ (WebCore::Text::createRenderer):
+ (WebCore::Text::recalcTextStyle):
+
+ Factor SVG special case testing to functions.
+
+ * dom/Text.h:
+ (Text):
+
+ Get rid of the now unnecessary willRecalcTextStyle mechanism.
+
+ * svg/SVGTRefElement.cpp:
+ (WebCore):
+ (WebCore::SVGTRefElement::updateReferencedText):
+
2012-11-22 Andreas Kling <[email protected]>
Style sharing: Remove O(n^2) presentation attribute checks that never found anything anyway.
Modified: trunk/Source/WebCore/dom/Text.cpp (135543 => 135544)
--- trunk/Source/WebCore/dom/Text.cpp 2012-11-22 22:38:14 UTC (rev 135543)
+++ trunk/Source/WebCore/dom/Text.cpp 2012-11-22 22:45:59 UTC (rev 135544)
@@ -238,11 +238,24 @@
return true;
}
+#if ENABLE(SVG)
+static bool isSVGShadowText(Text* text)
+{
+ Node* parentNode = text->parentNode();
+ return parentNode->isShadowRoot() && toShadowRoot(parentNode)->host()->hasTagName(SVGNames::trefTag);
+}
+
+static bool isSVGText(Text* text)
+{
+ Node* parentOrHostNode = text->parentOrHostNode();
+ return parentOrHostNode->isSVGElement() && !parentOrHostNode->hasTagName(SVGNames::foreignObjectTag);
+}
+#endif
+
RenderObject* Text::createRenderer(RenderArena* arena, RenderStyle* style)
{
#if ENABLE(SVG)
- Node* parentOrHost = parentOrHostNode();
- if (parentOrHost->isSVGElement() && !parentOrHost->hasTagName(SVGNames::foreignObjectTag))
+ if (isSVGText(this) || isSVGShadowText(this))
return new (arena) RenderSVGInlineText(this, dataImpl());
#endif
@@ -260,15 +273,18 @@
void Text::recalcTextStyle(StyleChange change)
{
- if (hasCustomCallbacks())
- willRecalcTextStyle(change);
-
RenderObject* renderer = this->renderer();
// The only time we have a renderer and our parent doesn't is if our parent
// is a shadow root.
- if (change != NoChange && renderer && !parentNode()->isShadowRoot())
- renderer->setStyle(parentNode()->renderer()->style());
+ if (change != NoChange && renderer) {
+ if (!parentNode()->isShadowRoot())
+ renderer->setStyle(parentNode()->renderer()->style());
+#if ENABLE(SVG)
+ else if (isSVGShadowText(this))
+ renderer->setStyle(toShadowRoot(parentNode())->host()->renderer()->style());
+#endif
+ }
if (needsStyleRecalc()) {
if (renderer) {
@@ -303,11 +319,6 @@
return result;
}
-void Text::willRecalcTextStyle(StyleChange)
-{
- ASSERT_NOT_REACHED();
-}
-
#ifndef NDEBUG
void Text::formatForDebugger(char *buffer, unsigned length) const
{
Modified: trunk/Source/WebCore/dom/Text.h (135543 => 135544)
--- trunk/Source/WebCore/dom/Text.h 2012-11-22 22:38:14 UTC (rev 135543)
+++ trunk/Source/WebCore/dom/Text.h 2012-11-22 22:45:59 UTC (rev 135544)
@@ -54,8 +54,6 @@
{
}
- virtual void willRecalcTextStyle(StyleChange);
-
private:
virtual String nodeName() const;
virtual NodeType nodeType() const;
Modified: trunk/Source/WebCore/svg/SVGTRefElement.cpp (135543 => 135544)
--- trunk/Source/WebCore/svg/SVGTRefElement.cpp 2012-11-22 22:38:14 UTC (rev 135543)
+++ trunk/Source/WebCore/svg/SVGTRefElement.cpp 2012-11-22 22:45:59 UTC (rev 135544)
@@ -130,35 +130,6 @@
m_trefElement->detachTarget();
}
-class SVGShadowText : public Text {
-public:
- static PassRefPtr<SVGShadowText> create(Document* document, const String& data)
- {
- return adoptRef(new SVGShadowText(document, data));
- }
-private:
- SVGShadowText(Document* document, const String& data)
- : Text(document, data, CreateText)
- {
- setHasCustomCallbacks();
- }
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void willRecalcTextStyle(StyleChange);
-};
-
-RenderObject* SVGShadowText::createRenderer(RenderArena* arena, RenderStyle*)
-{
- return new (arena) RenderSVGInlineText(this, dataImpl());
-}
-
-void SVGShadowText::willRecalcTextStyle(StyleChange change)
-{
- if (change != NoChange && parentNode()->isShadowRoot()) {
- if (renderer())
- renderer()->setStyle(toShadowRoot(parentNode())->host()->renderer()->style());
- }
-}
-
inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document* document)
: SVGTextPositioningElement(tagName, document)
, m_targetListener(SVGTRefTargetEventListener::create(this))
@@ -186,9 +157,11 @@
ASSERT(shadow());
ShadowRoot* root = shadow()->oldestShadowRoot();
if (!root->firstChild())
- root->appendChild(SVGShadowText::create(document(), textContent), ASSERT_NO_EXCEPTION);
- else
+ root->appendChild(Text::create(document(), textContent), ASSERT_NO_EXCEPTION);
+ else {
+ ASSERT(root->firstChild()->isTextNode());
root->firstChild()->setTextContent(textContent, ASSERT_NO_EXCEPTION);
+ }
}
void SVGTRefElement::detachTarget()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes