[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:20:45 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 94617f8912172ce33a48a62c044ee712b1a40123
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 16 02:36:38 2010 +0000

    2010-02-15  MORITA Hajime  <morrita at gmail.com>
    
            Reviewed by Nikolas Zimmermann.
    
            SVG text refactor: reduce paint specific callbacks on SVGTextChunkWalker
    
            https://bugs.webkit.org/show_bug.cgi?id=34831
    
            No new tests, no change of functionality.
    
            * rendering/SVGCharacterLayoutInfo.h:
            (WebCore::SVGTextChunkWalker::SVGTextChunkWalker):
            Removed setupBackground(), setupFill(), setupFillSelection(),
            setupStroke(), setupStrokeSelection(), setupForeground()
            and associated member variables.
    
            * rendering/SVGRootInlineBox.cpp:
            (WebCore::SVGRootInlineBoxPaintWalker::setupBackground):
            renamed from chunkSetupBackgroundCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::setupFill):
            renamed from chunkSetupFillCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::setupFillSelection):
            renamed from chunkSetupFillSelectionCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::setupStroke):
            renamed from chunkSetupStrokeCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::setupStrokeSelection):
            renamed from chunkSetupStrokeSelectionCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::setupForeground):
            renamed from chunkSetupForegroundCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::paintChunk):
            renamed from chunkPortionCallback.
            (WebCore::SVGRootInlineBoxPaintWalker::chunkPortionCallback):
            extracted from walkTextChunks.
            (WebCore::SVGRootInlineBox::paint):
            follow SVGTextChunkWalker change.
            (WebCore::SVGRootInlineBox::walkTextChunks):
            moved paint some specific code to SVGRootInlineBoxPaintWalker::chunkPortionCallback().
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54806 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f2b2f83..38e82da 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-02-15  MORITA Hajime  <morrita at gmail.com>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVG text refactor: reduce paint specific callbacks on SVGTextChunkWalker
+
+        https://bugs.webkit.org/show_bug.cgi?id=34831
+
+        No new tests, no change of functionality.
+
+        * rendering/SVGCharacterLayoutInfo.h:
+        (WebCore::SVGTextChunkWalker::SVGTextChunkWalker):
+        Removed setupBackground(), setupFill(), setupFillSelection(),
+        setupStroke(), setupStrokeSelection(), setupForeground()
+        and associated member variables.
+        
+        * rendering/SVGRootInlineBox.cpp:
+        (WebCore::SVGRootInlineBoxPaintWalker::setupBackground):
+        renamed from chunkSetupBackgroundCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::setupFill):
+        renamed from chunkSetupFillCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::setupFillSelection):
+        renamed from chunkSetupFillSelectionCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::setupStroke):
+        renamed from chunkSetupStrokeCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::setupStrokeSelection):
+        renamed from chunkSetupStrokeSelectionCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::setupForeground):
+        renamed from chunkSetupForegroundCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::paintChunk):
+        renamed from chunkPortionCallback.
+        (WebCore::SVGRootInlineBoxPaintWalker::chunkPortionCallback):
+        extracted from walkTextChunks.
+        (WebCore::SVGRootInlineBox::paint):
+        follow SVGTextChunkWalker change.
+        (WebCore::SVGRootInlineBox::walkTextChunks):
+        moved paint some specific code to SVGRootInlineBoxPaintWalker::chunkPortionCallback().
+        
 2010-02-15  Dan Bernstein  <mitz at apple.com>
 
         Try to fix the Chromium build.
diff --git a/WebCore/rendering/SVGCharacterLayoutInfo.h b/WebCore/rendering/SVGCharacterLayoutInfo.h
index f80c79c..f0d1fa4 100644
--- a/WebCore/rendering/SVGCharacterLayoutInfo.h
+++ b/WebCore/rendering/SVGCharacterLayoutInfo.h
@@ -297,13 +297,6 @@ struct SVGTextChunkWalkerBase {
     // Followings methods are only used for painting text chunks
     virtual void start(InlineBox*) = 0;
     virtual void end(InlineBox*) = 0;
-    
-    virtual bool setupBackground(InlineBox*) = 0;
-    virtual bool setupFill(InlineBox*) = 0;
-    virtual bool setupFillSelection(InlineBox*) = 0;
-    virtual bool setupStroke(InlineBox*) = 0;
-    virtual bool setupStrokeSelection(InlineBox*) = 0;
-    virtual bool setupForeground(InlineBox*) = 0;
 };
 
 template<typename CallbackClass>
@@ -319,31 +312,14 @@ public:
     typedef void (CallbackClass::*SVGTextChunkStartCallback)(InlineBox* box);
     typedef void (CallbackClass::*SVGTextChunkEndCallback)(InlineBox* box);
 
-    typedef bool (CallbackClass::*SVGTextChunkSetupBackgroundCallback)(InlineBox* box);
-    typedef bool (CallbackClass::*SVGTextChunkSetupFillCallback)(InlineBox* box);
-    typedef bool (CallbackClass::*SVGTextChunkSetupStrokeCallback)(InlineBox* box);
-    typedef bool (CallbackClass::*SVGTextChunkSetupForegroundCallback)(InlineBox* box);
-
-    SVGTextChunkWalker(CallbackClass* object,
+    SVGTextChunkWalker(CallbackClass* object, 
                        SVGTextChunkWalkerCallback walker,
                        SVGTextChunkStartCallback start = 0,
-                       SVGTextChunkEndCallback end = 0,
-                       SVGTextChunkSetupBackgroundCallback background = 0,
-                       SVGTextChunkSetupFillCallback fill = 0,
-                       SVGTextChunkSetupFillCallback fillSelection = 0,
-                       SVGTextChunkSetupStrokeCallback stroke = 0,
-                       SVGTextChunkSetupStrokeCallback strokeSelection = 0,
-                       SVGTextChunkSetupForegroundCallback foreground = 0)
+                       SVGTextChunkEndCallback end = 0)
         : m_object(object)
         , m_walkerCallback(walker)
         , m_startCallback(start)
         , m_endCallback(end)
-        , m_setupBackgroundCallback(background)
-        , m_setupFillCallback(fill)
-        , m_setupFillSelectionCallback(fillSelection)
-        , m_setupStrokeCallback(stroke)
-        , m_setupStrokeSelectionCallback(strokeSelection)
-        , m_setupForegroundCallback(foreground)
     {
         ASSERT(object);
         ASSERT(walker);
@@ -372,71 +348,11 @@ public:
             ASSERT_NOT_REACHED();
     }
 
-    virtual bool setupBackground(InlineBox* box)
-    {
-        if (m_setupBackgroundCallback)
-            return (*m_object.*m_setupBackgroundCallback)(box);
-
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    virtual bool setupFill(InlineBox* box)
-    {
-        if (m_setupFillCallback)
-            return (*m_object.*m_setupFillCallback)(box);
-
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    virtual bool setupFillSelection(InlineBox* box)
-    {
-        if (m_setupFillSelectionCallback)
-            return (*m_object.*m_setupFillSelectionCallback)(box);
-
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    virtual bool setupStroke(InlineBox* box)
-    {
-        if (m_setupStrokeCallback)
-            return (*m_object.*m_setupStrokeCallback)(box);
-
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    virtual bool setupStrokeSelection(InlineBox* box)
-    {
-        if (m_setupStrokeSelectionCallback)
-            return (*m_object.*m_setupStrokeSelectionCallback)(box);
-
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
-    virtual bool setupForeground(InlineBox* box)
-    {
-        if (m_setupForegroundCallback)
-            return (*m_object.*m_setupForegroundCallback)(box);
-
-        ASSERT_NOT_REACHED();
-        return false;
-    }
-
 private:
     CallbackClass* m_object;
     SVGTextChunkWalkerCallback m_walkerCallback;
     SVGTextChunkStartCallback m_startCallback;
     SVGTextChunkEndCallback m_endCallback;
-    SVGTextChunkSetupBackgroundCallback m_setupBackgroundCallback;
-    SVGTextChunkSetupFillCallback m_setupFillCallback;
-    SVGTextChunkSetupFillCallback m_setupFillSelectionCallback;
-    SVGTextChunkSetupStrokeCallback m_setupStrokeCallback;
-    SVGTextChunkSetupStrokeCallback m_setupStrokeSelectionCallback;
-    SVGTextChunkSetupForegroundCallback m_setupForegroundCallback;
 };
 
 struct SVGTextChunkLayoutInfo {
diff --git a/WebCore/rendering/SVGRootInlineBox.cpp b/WebCore/rendering/SVGRootInlineBox.cpp
index d0dd4a8..6cc3ced 100644
--- a/WebCore/rendering/SVGRootInlineBox.cpp
+++ b/WebCore/rendering/SVGRootInlineBox.cpp
@@ -436,13 +436,13 @@ struct SVGRootInlineBoxPaintWalker {
         m_paintInfo.rect = m_savedInfo.rect;
     }
 
-    bool chunkSetupBackgroundCallback(InlineBox* /*box*/)
+    bool setupBackground(InlineBox* /*box*/)
     {
         m_textPaintInfo.subphase = SVGTextPaintSubphaseBackground;
         return true;
     }
 
-    bool chunkSetupFillCallback(InlineBox* box)
+    bool setupFill(InlineBox* box)
     {
         InlineFlowBox* flowBox = box->parent();
 
@@ -464,7 +464,7 @@ struct SVGRootInlineBoxPaintWalker {
         return false;
     }
 
-    bool chunkSetupFillSelectionCallback(InlineBox* box)
+    bool setupFillSelection(InlineBox* box)
     {
         InlineFlowBox* flowBox = box->parent();
 
@@ -492,7 +492,7 @@ struct SVGRootInlineBoxPaintWalker {
         return false;
     }
 
-    bool chunkSetupStrokeCallback(InlineBox* box)
+    bool setupStroke(InlineBox* box)
     {
         InlineFlowBox* flowBox = box->parent();
 
@@ -516,7 +516,7 @@ struct SVGRootInlineBoxPaintWalker {
         return false;
     }
 
-    bool chunkSetupStrokeSelectionCallback(InlineBox* box)
+    bool setupStrokeSelection(InlineBox* box)
     {
         InlineFlowBox* flowBox = box->parent();
 
@@ -545,7 +545,7 @@ struct SVGRootInlineBoxPaintWalker {
         return false;
     }
 
-    bool chunkSetupForegroundCallback(InlineBox* /*box*/)
+    bool setupForeground(InlineBox* /*box*/)
     {
         teardownFillPaintServer();
         teardownStrokePaintServer();
@@ -576,6 +576,28 @@ struct SVGRootInlineBoxPaintWalker {
     void chunkPortionCallback(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
                               const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
     {
+        if (setupBackground(textBox))
+            paintChunk(textBox, startOffset, chunkCtm, start, end);
+
+        if (setupFill(textBox))
+            paintChunk(textBox, startOffset, chunkCtm, start, end);
+        
+        if (setupFillSelection(textBox))
+            paintChunk(textBox, startOffset, chunkCtm, start, end);
+
+        if (setupStroke(textBox))
+            paintChunk(textBox, startOffset, chunkCtm, start, end);
+
+        if (setupStrokeSelection(textBox))
+            paintChunk(textBox, startOffset, chunkCtm, start, end);
+
+        if (setupForeground(textBox))
+            paintChunk(textBox, startOffset, chunkCtm, start, end);
+    }
+
+    void paintChunk(SVGInlineTextBox* textBox, int startOffset, const AffineTransform& chunkCtm,
+                    const Vector<SVGChar>::iterator& start, const Vector<SVGChar>::iterator& end)
+    {
         RenderText* text = textBox->textRenderer();
         ASSERT(text);
 
@@ -679,13 +701,7 @@ void SVGRootInlineBox::paint(RenderObject::PaintInfo& paintInfo, int tx, int ty)
         SVGTextChunkWalker<SVGRootInlineBoxPaintWalker> walker(&walkerCallback,
                                                                &SVGRootInlineBoxPaintWalker::chunkPortionCallback,
                                                                &SVGRootInlineBoxPaintWalker::chunkStartCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkEndCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkSetupBackgroundCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkSetupFillCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkSetupFillSelectionCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkSetupStrokeCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkSetupStrokeSelectionCallback,
-                                                               &SVGRootInlineBoxPaintWalker::chunkSetupForegroundCallback);
+                                                               &SVGRootInlineBoxPaintWalker::chunkEndCallback);
 
         walkTextChunks(&walker);
     }
@@ -1777,28 +1793,7 @@ void SVGRootInlineBox::walkTextChunks(SVGTextChunkWalkerBase* walker, const SVGI
             ASSERT(itCharEnd <= curChunk.end);
 
             // Process this chunk portion
-            if (textBox)
-                (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-            else {
-                if (walker->setupBackground(range.box))
-                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-
-                if (walker->setupFill(range.box))
-                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-
-                if (walker->setupFillSelection(range.box))
-                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-
-                if (walker->setupStroke(range.box))
-                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-
-                if (walker->setupStrokeSelection(range.box))
-                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-
-                if (walker->setupForeground(range.box))
-                    (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
-
-            }
+            (*walker)(rangeTextBox, range.startOffset, curChunk.ctm, itCharBegin, itCharEnd);
 
             chunkOffset += length;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list