[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zimmermann at webkit.org zimmermann at webkit.org
Wed Dec 22 13:59:56 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dcdbe8165f3a916063ec2b2e6596f7634e752647
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 1 07:16:23 2010 +0000

    2010-10-01  Nikolas Zimmermann  <nzimmermann at rim.com>
    
            Reviewed by Dirk Schulze.
    
            Add helper methods to cast between renderers & SVGTextContent/PositioningElement
            https://bugs.webkit.org/show_bug.cgi?id=46963
    
            Doesn't affect any tests.
    
            * svg/SVGTextContentElement.cpp:
            (WebCore::SVGTextContentElement::elementFromRenderer):
            * svg/SVGTextContentElement.h:
            * svg/SVGTextPositioningElement.cpp:
            (WebCore::SVGTextPositioningElement::elementFromRenderer):
            * svg/SVGTextPositioningElement.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68867 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0e4f66b..43b07a2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-01  Nikolas Zimmermann  <nzimmermann at rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        Add helper methods to cast between renderers & SVGTextContent/PositioningElement
+        https://bugs.webkit.org/show_bug.cgi?id=46963
+
+        Doesn't affect any tests.
+
+        * svg/SVGTextContentElement.cpp:
+        (WebCore::SVGTextContentElement::elementFromRenderer):
+        * svg/SVGTextContentElement.h:
+        * svg/SVGTextPositioningElement.cpp:
+        (WebCore::SVGTextPositioningElement::elementFromRenderer):
+        * svg/SVGTextPositioningElement.h:
+
 2010-09-30  MORITA Hajime  <morrita at google.com>
 
         Reviewed by James Robinson.
diff --git a/WebCore/svg/SVGTextContentElement.cpp b/WebCore/svg/SVGTextContentElement.cpp
index 9d44b10..cdb9d81 100644
--- a/WebCore/svg/SVGTextContentElement.cpp
+++ b/WebCore/svg/SVGTextContentElement.cpp
@@ -26,6 +26,7 @@
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "Frame.h"
+#include "RenderObject.h"
 #include "SVGTextQuery.h"
 #include "SelectionController.h"
 #include "XMLNames.h"
@@ -215,6 +216,30 @@ bool SVGTextContentElement::selfHasRelativeLengths() const
     return textLength().isRelative();
 }
 
+SVGTextContentElement* SVGTextContentElement::elementFromRenderer(RenderObject* renderer)
+{
+    if (!renderer)
+        return 0;
+
+    if (!renderer->isSVGText() && !renderer->isSVGInline())
+        return 0;
+
+    Node* node = renderer->node();
+    ASSERT(node);
+    ASSERT(node->isSVGElement());
+
+    if (!node->hasTagName(SVGNames::textTag)
+        && !node->hasTagName(SVGNames::tspanTag)
+#if ENABLE(SVG_FONTS)
+        && !node->hasTagName(SVGNames::altGlyphTag)
+#endif
+        && !node->hasTagName(SVGNames::trefTag)
+        && !node->hasTagName(SVGNames::textPathTag))
+        return 0;
+
+    return static_cast<SVGTextContentElement*>(node);
+}
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextContentElement.h b/WebCore/svg/SVGTextContentElement.h
index cf3698b..a63e27a 100644
--- a/WebCore/svg/SVGTextContentElement.h
+++ b/WebCore/svg/SVGTextContentElement.h
@@ -54,6 +54,8 @@ namespace WebCore {
 
         bool isKnownAttribute(const QualifiedName&);
 
+        static SVGTextContentElement* elementFromRenderer(RenderObject*);
+
     protected:
         SVGTextContentElement(const QualifiedName&, Document*);
 
diff --git a/WebCore/svg/SVGTextPositioningElement.cpp b/WebCore/svg/SVGTextPositioningElement.cpp
index 4703482..65220cb 100644
--- a/WebCore/svg/SVGTextPositioningElement.cpp
+++ b/WebCore/svg/SVGTextPositioningElement.cpp
@@ -143,6 +143,30 @@ bool SVGTextPositioningElement::selfHasRelativeLengths() const
     return false;
 }
 
+SVGTextPositioningElement* SVGTextPositioningElement::elementFromRenderer(RenderObject* renderer)
+{
+    if (!renderer)
+        return 0;
+
+    if (!renderer->isSVGText() && !renderer->isSVGInline())
+        return 0;
+
+    Node* node = renderer->node();
+    ASSERT(node);
+    ASSERT(node->isSVGElement());
+
+    if (!node->hasTagName(SVGNames::textTag)
+        && !node->hasTagName(SVGNames::tspanTag)
+#if ENABLE(SVG_FONTS)
+        && !node->hasTagName(SVGNames::altGlyphTag)
+#endif
+        && !node->hasTagName(SVGNames::trefTag))
+        return 0;
+
+    return static_cast<SVGTextPositioningElement*>(node);
+}
+
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/WebCore/svg/SVGTextPositioningElement.h b/WebCore/svg/SVGTextPositioningElement.h
index 57a4028..d26fbcb 100644
--- a/WebCore/svg/SVGTextPositioningElement.h
+++ b/WebCore/svg/SVGTextPositioningElement.h
@@ -29,6 +29,9 @@
 namespace WebCore {
 
     class SVGTextPositioningElement : public SVGTextContentElement {
+    public:
+        static SVGTextPositioningElement* elementFromRenderer(RenderObject*);
+
     protected:
         SVGTextPositioningElement(const QualifiedName&, Document*);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list