Title: [88190] trunk/Source/WebCore
Revision
88190
Author
[email protected]
Date
2011-06-06 14:35:56 -0700 (Mon, 06 Jun 2011)

Log Message

2011-06-06  Levi Weintraub  <[email protected]>

        Reviewed by Eric Seidel.

        Switch paintOutline, paintContinuationOutlines, and paintOutlineForLine to use IntPoint
        https://bugs.webkit.org/show_bug.cgi?id=62137

        Switching paintOutline, paintContinuationOutlines, and paintOutlineForLine to take an IntPoint
        representing the paint offset instead of a pair of ints.

        No new tests as this is simple refactoring.

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::paintObject):
        (WebCore::RenderBlock::paintContinuationOutlines):
        * rendering/RenderBlock.h:
        * rendering/RenderInline.cpp:
        (WebCore::RenderInline::paintOutline):
        (WebCore::RenderInline::paintOutlineForLine):
        * rendering/RenderInline.h:
        * rendering/RenderLineBoxList.cpp:
        (WebCore::RenderLineBoxList::paint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88189 => 88190)


--- trunk/Source/WebCore/ChangeLog	2011-06-06 21:30:42 UTC (rev 88189)
+++ trunk/Source/WebCore/ChangeLog	2011-06-06 21:35:56 UTC (rev 88190)
@@ -1,3 +1,26 @@
+2011-06-06  Levi Weintraub  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        Switch paintOutline, paintContinuationOutlines, and paintOutlineForLine to use IntPoint
+        https://bugs.webkit.org/show_bug.cgi?id=62137
+
+        Switching paintOutline, paintContinuationOutlines, and paintOutlineForLine to take an IntPoint
+        representing the paint offset instead of a pair of ints.
+
+        No new tests as this is simple refactoring.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintObject):
+        (WebCore::RenderBlock::paintContinuationOutlines):
+        * rendering/RenderBlock.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::paintOutline):
+        (WebCore::RenderInline::paintOutlineForLine):
+        * rendering/RenderInline.h:
+        * rendering/RenderLineBoxList.cpp:
+        (WebCore::RenderLineBoxList::paint):
+
 2011-06-06  Emil A Eklund  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (88189 => 88190)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-06 21:30:42 UTC (rev 88189)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-06-06 21:35:56 UTC (rev 88190)
@@ -2526,10 +2526,9 @@
             if (!inlineEnclosedInSelfPaintingLayer)
                 cb->addContinuationWithOutline(inlineRenderer);
             else if (!inlineRenderer->firstLineBox())
-                inlineRenderer->paintOutline(paintInfo.context, paintOffset.x() - x() + inlineRenderer->containingBlock()->x(),
-                                             paintOffset.y() - y() + inlineRenderer->containingBlock()->y());
+                inlineRenderer->paintOutline(paintInfo.context, paintOffset - locationOffset() + inlineRenderer->containingBlock()->location());
         }
-        paintContinuationOutlines(paintInfo, paintOffset.x(), paintOffset.y());
+        paintContinuationOutlines(paintInfo, paintOffset);
     }
 
     // 7. paint caret.
@@ -2660,7 +2659,7 @@
     return continuations->contains(flow);
 }
 
-void RenderBlock::paintContinuationOutlines(PaintInfo& info, int tx, int ty)
+void RenderBlock::paintContinuationOutlines(PaintInfo& info, const IntPoint& paintOffset)
 {
     ContinuationOutlineTableMap* table = continuationOutlineTable();
     if (table->isEmpty())
@@ -2669,19 +2668,18 @@
     ListHashSet<RenderInline*>* continuations = table->get(this);
     if (!continuations)
         return;
-        
+
+    IntPoint accumulatedPaintOffset = paintOffset;
     // Paint each continuation outline.
     ListHashSet<RenderInline*>::iterator end = continuations->end();
     for (ListHashSet<RenderInline*>::iterator it = continuations->begin(); it != end; ++it) {
         // Need to add in the coordinates of the intervening blocks.
         RenderInline* flow = *it;
         RenderBlock* block = flow->containingBlock();
-        for ( ; block && block != this; block = block->containingBlock()) {
-            tx += block->x();
-            ty += block->y();
-        }
+        for ( ; block && block != this; block = block->containingBlock())
+            accumulatedPaintOffset.move(block->location());
         ASSERT(block);   
-        flow->paintOutline(info.context, tx, ty);
+        flow->paintOutline(info.context, accumulatedPaintOffset);
     }
     
     // Delete

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (88189 => 88190)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2011-06-06 21:30:42 UTC (rev 88189)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2011-06-06 21:35:56 UTC (rev 88190)
@@ -632,7 +632,7 @@
     unsigned desiredColumnCount() const;
     void setDesiredColumnCountAndWidth(int count, int width);
 
-    void paintContinuationOutlines(PaintInfo&, int tx, int ty);
+    void paintContinuationOutlines(PaintInfo&, const IntPoint&);
 
     virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
 

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (88189 => 88190)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2011-06-06 21:30:42 UTC (rev 88189)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2011-06-06 21:35:56 UTC (rev 88190)
@@ -1366,7 +1366,7 @@
     }
 }
 
-void RenderInline::paintOutline(GraphicsContext* graphicsContext, int tx, int ty)
+void RenderInline::paintOutline(GraphicsContext* graphicsContext, const IntPoint& paintOffset)
 {
     if (!hasOutline())
         return;
@@ -1375,7 +1375,7 @@
     if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) {
         if (!theme()->supportsFocusRing(styleToUse)) {
             // Only paint the focus ring by hand if the theme isn't able to draw the focus ring.
-            paintFocusRing(graphicsContext, IntPoint(tx, ty), styleToUse);
+            paintFocusRing(graphicsContext, paintOffset, styleToUse);
         }
     }
 
@@ -1408,7 +1408,7 @@
 #endif
 
     for (unsigned i = 1; i < rects.size() - 1; i++)
-        paintOutlineForLine(graphicsContext, tx, ty, rects.at(i - 1), rects.at(i), rects.at(i + 1), outlineColor);
+        paintOutlineForLine(graphicsContext, paintOffset, rects.at(i - 1), rects.at(i), rects.at(i + 1), outlineColor);
 
 // FIXME: Using a transparency layer for rgba outlines exacerbates an existing SKIA bug. The #if
 // below prevents this; it should be removed when https://bugs.webkit.org/show_bug.cgi?id=60342 is fixed.
@@ -1418,7 +1418,7 @@
 #endif
 }
 
-void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, int tx, int ty,
+void RenderInline::paintOutlineForLine(GraphicsContext* graphicsContext, const IntPoint& paintOffset,
                                        const IntRect& lastline, const IntRect& thisline, const IntRect& nextline,
                                        const Color outlineColor)
 {
@@ -1431,10 +1431,10 @@
 
     int offset = style()->outlineOffset();
 
-    int t = ty + thisline.y() - offset;
-    int l = tx + thisline.x() - offset;
-    int b = ty + thisline.maxY() + offset;
-    int r = tx + thisline.maxX() + offset;
+    int t = paintOffset.y() + thisline.y() - offset;
+    int l = paintOffset.x() + thisline.x() - offset;
+    int b = paintOffset.y() + thisline.maxY() + offset;
+    int r = paintOffset.x() + thisline.maxX() + offset;
     
     // left edge
     drawLineForBoxSide(graphicsContext,
@@ -1464,21 +1464,21 @@
         drawLineForBoxSide(graphicsContext,
                    l - ow,
                    t - ow,
-                   min(r+ow, (lastline.isEmpty() ? 1000000 : tx + lastline.x())),
+                   min(r+ow, (lastline.isEmpty() ? 1000000 : paintOffset.x() + lastline.x())),
                    t,
                    BSTop, outlineColor, os,
                    ow,
-                   (!lastline.isEmpty() && tx + lastline.x() + 1 < r + ow) ? -ow : ow,
+                   (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < r + ow) ? -ow : ow,
                    antialias);
     
     if (lastline.maxX() < thisline.maxX())
         drawLineForBoxSide(graphicsContext,
-                   max(lastline.isEmpty() ? -1000000 : tx + lastline.maxX(), l - ow),
+                   max(lastline.isEmpty() ? -1000000 : paintOffset.x() + lastline.maxX(), l - ow),
                    t - ow,
                    r + ow,
                    t,
                    BSTop, outlineColor, os,
-                   (!lastline.isEmpty() && l - ow < tx + lastline.maxX()) ? -ow : ow,
+                   (!lastline.isEmpty() && l - ow < paintOffset.x() + lastline.maxX()) ? -ow : ow,
                    ow, antialias);
     
     // lower edge
@@ -1486,21 +1486,21 @@
         drawLineForBoxSide(graphicsContext,
                    l - ow,
                    b,
-                   min(r + ow, !nextline.isEmpty() ? tx + nextline.x() + 1 : 1000000),
+                   min(r + ow, !nextline.isEmpty() ? paintOffset.x() + nextline.x() + 1 : 1000000),
                    b + ow,
                    BSBottom, outlineColor, os,
                    ow,
-                   (!nextline.isEmpty() && tx + nextline.x() + 1 < r + ow) ? -ow : ow,
+                   (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < r + ow) ? -ow : ow,
                    antialias);
     
     if (nextline.maxX() < thisline.maxX())
         drawLineForBoxSide(graphicsContext,
-                   max(!nextline.isEmpty() ? tx + nextline.maxX() : -1000000, l - ow),
+                   max(!nextline.isEmpty() ? paintOffset.x() + nextline.maxX() : -1000000, l - ow),
                    b,
                    r + ow,
                    b + ow,
                    BSBottom, outlineColor, os,
-                   (!nextline.isEmpty() && l - ow < tx + nextline.maxX()) ? -ow : ow,
+                   (!nextline.isEmpty() && l - ow < paintOffset.x() + nextline.maxX()) ? -ow : ow,
                    ow, antialias);
 }
 

Modified: trunk/Source/WebCore/rendering/RenderInline.h (88189 => 88190)


--- trunk/Source/WebCore/rendering/RenderInline.h	2011-06-06 21:30:42 UTC (rev 88189)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2011-06-06 21:35:56 UTC (rev 88190)
@@ -76,7 +76,7 @@
     IntSize relativePositionedInlineOffset(const RenderBox* child) const;
 
     virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
-    void paintOutline(GraphicsContext*, int tx, int ty);
+    void paintOutline(GraphicsContext*, const IntPoint&);
 
     using RenderBoxModelObject::continuation;
     using RenderBoxModelObject::setContinuation;
@@ -162,7 +162,7 @@
     
     static RenderInline* cloneInline(RenderInline* src);
 
-    void paintOutlineForLine(GraphicsContext*, int tx, int ty, const IntRect& prevLine, const IntRect& thisLine,
+    void paintOutlineForLine(GraphicsContext*, const IntPoint&, const IntRect& prevLine, const IntRect& thisLine,
                              const IntRect& nextLine, const Color);
     RenderBoxModelObject* continuationBefore(RenderObject* beforeChild);
 

Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (88189 => 88190)


--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2011-06-06 21:30:42 UTC (rev 88189)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2011-06-06 21:35:56 UTC (rev 88190)
@@ -267,7 +267,7 @@
         ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end();
         for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begin(); it != end; ++it) {
             RenderInline* flow = *it;
-            flow->paintOutline(info.context, tx, ty);
+            flow->paintOutline(info.context, IntPoint(tx, ty));
         }
         info.outlineObjects->clear();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to