[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/khtml-svg/svg
From:       Nikolas Zimmermann <wildfox () kde ! org>
Date:       2006-04-04 9:19:33
Message-ID: 1144142373.523425.10703.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 526261 by wildfox:

Add transform support to <text>, \
SVGTextElementImpl/SVGTextContentElementImpl/SVGTextPositioningElementImpl can be \
considered done now, the actual text rendering is still "flaky", but hey, we _have_ \
_text_ _rendering_.


 M  +36 -5     SVGTextElementImpl.cpp  
 M  +6 -0      SVGTextElementImpl.h  


--- branches/work/khtml-svg/svg/SVGTextElementImpl.cpp #526260:526261
@@ -23,7 +23,10 @@
 #include "misc/hashes.h"
 #include "rendering/render_svg_text.h"
 
+#include "SVGMatrixImpl.h"
 #include "SVGTextElementImpl.h"
+#include "SVGTransformListImpl.h"
+#include "SVGAnimatedTransformListImpl.h"
 
 using namespace KSVG;
 
@@ -43,8 +46,23 @@
 
 void SVGTextElementImpl::parseAttribute(DOM::AttributeImpl *attr)
 {
-    // TODO? if(SVGTransformableImpl::parseAttribute(attr)) return;
-    SVGTextPositioningElementImpl::parseAttribute(attr);
+    DOM::DOMString value = attr->value();
+    switch(attr->id())
+    {
+        case SVGATTR_TRANSFORM:
+        {
+			int ignoreException;
+
+            SVGTransformListImpl *localTransforms = transform()->baseVal();
+            localTransforms->clear(ignoreException);
+
+            SVGTransformableImpl::parseTransformAttribute(localTransforms, \
attr->value()); +            updateLocalTransform(localTransforms);
+            break;
+        }
+        default:
+            SVGTextPositioningElementImpl::parseAttribute(attr);
+    }
 }
 
 SVGElementImpl *SVGTextElementImpl::nearestViewportElement() const
@@ -74,7 +92,6 @@
 
 khtml::RenderObject *SVGTextElementImpl::createRenderer(khtml::RenderArena *arena, \
khtml::RenderStyle *)  {
-    kDebug() << k_funcinfo << endl;
     return new (arena) khtml::RenderSVGText(this);
 }
 
@@ -90,10 +107,24 @@
 {
     SVGStyledElementImpl::attach();
 
-    /* TODO
     if(renderer() && m_localMatrix)
         renderer()->setLocalTransform(m_localMatrix->qmatrix());
-    */
 }
 
+void SVGTextElementImpl::updateLocalTransform(SVGTransformListImpl *localTransforms)
+{
+    // Update cached local matrix
+    RefPtr<SVGTransformImpl> localTransform = localTransforms->concatenate();
+    if(localTransform)
+    {
+        m_localMatrix = localTransform->matrix();
+
+        if(renderer())
+        {
+            renderer()->setLocalTransform(m_localMatrix->qmatrix());
+            renderer()->setNeedsLayout(true);
+        }
+    }
+}
+
 // vim:ts=4:noet
--- branches/work/khtml-svg/svg/SVGTextElementImpl.h #526260:526261
@@ -57,6 +57,12 @@
         virtual khtml::RenderObject *createRenderer(khtml::RenderArena *arena, \
                khtml::RenderStyle *style);
         virtual bool childShouldCreateRenderer(DOM::NodeImpl *child) const;
         virtual void attach();
+
+        void updateLocalTransform(SVGTransformListImpl *localTransforms);
+
+    private:
+        mutable RefPtr<SVGMatrixImpl> m_localMatrix;
+        mutable RefPtr<SVGAnimatedTransformListImpl> m_transform;
     };
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic