Title: [90590] trunk/Source/WebCore
Revision
90590
Author
e...@chromium.org
Date
2011-07-07 14:16:15 -0700 (Thu, 07 Jul 2011)

Log Message

Switch addFocusRingRects to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=64114

Reviewed by Eric Seidel.

No new tests, no functionality changes.

* rendering/LayoutTypes.h:
(WebCore::flooredLayoutPoint):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addFocusRingRects):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::addFocusRingRects):
* rendering/RenderBox.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::addFocusRingRects):
* rendering/RenderInline.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::addFocusRingRects):
* rendering/RenderListBox.h:
* rendering/RenderObject.h:
(WebCore::RenderObject::addFocusRingRects):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::addFocusRingRects):
* rendering/RenderTextControl.h:
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::addFocusRingRects):
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::addFocusRingRects):
* rendering/svg/RenderSVGImage.h:
* rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::addFocusRingRects):
* rendering/svg/RenderSVGPath.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (90589 => 90590)


--- trunk/Source/WebCore/ChangeLog	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/ChangeLog	2011-07-07 21:16:15 UTC (rev 90590)
@@ -1,3 +1,41 @@
+2011-07-07  Emil A Eklund  <e...@chromium.org>
+
+        Switch addFocusRingRects to to new layout types
+        https://bugs.webkit.org/show_bug.cgi?id=64114
+
+        Reviewed by Eric Seidel.
+
+        No new tests, no functionality changes.
+
+        * rendering/LayoutTypes.h:
+        (WebCore::flooredLayoutPoint):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::addFocusRingRects):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::addFocusRingRects):
+        * rendering/RenderBox.h:
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::addFocusRingRects):
+        * rendering/RenderInline.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::addFocusRingRects):
+        * rendering/RenderListBox.h:
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::addFocusRingRects):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::addFocusRingRects):
+        * rendering/RenderTextControl.h:
+        * rendering/svg/RenderSVGContainer.cpp:
+        (WebCore::RenderSVGContainer::addFocusRingRects):
+        * rendering/svg/RenderSVGContainer.h:
+        * rendering/svg/RenderSVGImage.cpp:
+        (WebCore::RenderSVGImage::addFocusRingRects):
+        * rendering/svg/RenderSVGImage.h:
+        * rendering/svg/RenderSVGPath.cpp:
+        (WebCore::RenderSVGPath::addFocusRingRects):
+        * rendering/svg/RenderSVGPath.h:
+
 2011-07-06  Adrienne Walker  <e...@google.com>
 
         [chromium] Reduce compositor texture memory by skipping layers and clipping surfaces

Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/LayoutTypes.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -62,6 +62,11 @@
     return flooredIntPoint(p);
 }
 
+inline LayoutPoint flooredLayoutPoint(const FloatSize& s)
+{
+    return flooredIntPoint(s);
+}
+
 inline LayoutUnit roundedLayoutUnit(float value)
 {
     return lroundf(value);

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -5884,7 +5884,7 @@
     return IntRect(x, y, caretWidth, height);
 }
 
-void RenderBlock::addFocusRingRects(Vector<IntRect>& rects, const IntPoint& additionalOffset)
+void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset)
 {
     // For blocks inside inlines, we go ahead and include margins so that we run right up to the
     // inline boxes above and below us (thus getting merged with them to form a single irregular
@@ -5896,19 +5896,19 @@
         // FIXME: This is wrong for block-flows that are horizontal.
         // https://bugs.webkit.org/show_bug.cgi?id=46781
         bool prevInlineHasLineBox = toRenderInline(inlineElementContinuation()->node()->renderer())->firstLineBox(); 
-        int topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : 0;
-        int bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : 0;
-        IntRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
+        float topMargin = prevInlineHasLineBox ? collapsedMarginBefore() : static_cast<LayoutUnit>(0);
+        float bottomMargin = nextInlineHasLineBox ? collapsedMarginAfter() : static_cast<LayoutUnit>(0);
+        LayoutRect rect(additionalOffset.x(), additionalOffset.y() - topMargin, width(), height() + topMargin + bottomMargin);
         if (!rect.isEmpty())
             rects.append(rect);
     } else if (width() && height())
-        rects.append(IntRect(additionalOffset, size()));
+        rects.append(LayoutRect(additionalOffset, size()));
 
     if (!hasOverflowClip() && !hasControlClip()) {
         for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBox()) {
-            int top = max(curr->lineTop(), curr->logicalTop());
-            int bottom = min(curr->lineBottom(), curr->logicalTop() + curr->logicalHeight());
-            IntRect rect(additionalOffset.x() + curr->x(), additionalOffset.y() + top, curr->logicalWidth(), bottom - top);
+            LayoutUnit top = max(curr->lineTop(), curr->logicalTop());
+            LayoutUnit bottom = min(curr->lineBottom(), curr->logicalTop() + curr->logicalHeight());
+            LayoutRect rect(additionalOffset.x() + curr->x(), additionalOffset.y() + top, curr->logicalWidth(), bottom - top);
             if (!rect.isEmpty())
                 rects.append(rect);
         }
@@ -5928,7 +5928,7 @@
     }
 
     if (inlineElementContinuation())
-        inlineElementContinuation()->addFocusRingRects(rects, flooredIntPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location()));
+        inlineElementContinuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + inlineElementContinuation()->containingBlock()->location() - location()));
 }
 
 RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -336,7 +336,7 @@
     void addOverflowFromBlockChildren();
     void addOverflowFromInlineChildren();
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
 #if ENABLE(SVG)
     // Only used by RenderSVGText, which explicitely overrides RenderBlock::layoutBlock(), do NOT use for anything else.

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -510,10 +510,10 @@
     return box;
 }
 
-void RenderBox::addFocusRingRects(Vector<IntRect>& rects, const IntPoint& additionalOffset)
+void RenderBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset)
 {
     if (!size().isEmpty())
-        rects.append(IntRect(additionalOffset, size()));
+        rects.append(LayoutRect(additionalOffset, size()));
 }
 
 IntRect RenderBox::reflectionBox() const

Modified: trunk/Source/WebCore/rendering/RenderBox.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderBox.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -128,7 +128,7 @@
 
     // Bounds of the outline box in absolute coords. Respects transforms
     virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, IntPoint* cachedOffsetToRepaintContainer) const;
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
     // Use this with caution! No type checking is done!
     RenderBox* previousSiblingBox() const;

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -1334,13 +1334,13 @@
     repaint();
 }
 
-void RenderInline::addFocusRingRects(Vector<IntRect>& rects, const IntPoint& additionalOffset)
+void RenderInline::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset)
 {
     if (!alwaysCreateLineBoxes())
-        culledInlineAbsoluteRects(this, rects, toSize(additionalOffset));
+        culledInlineAbsoluteRects(this, rects, toLayoutSize(additionalOffset));
     else {
         for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
-            rects.append(enclosingIntRect(FloatRect(additionalOffset.x() + curr->x(), additionalOffset.y() + curr->y(), curr->width(), curr->height())));
+            rects.append(enclosingLayoutRect(FloatRect(additionalOffset.x() + curr->x(), additionalOffset.y() + curr->y(), curr->width(), curr->height())));
     }
 
     for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
@@ -1357,9 +1357,9 @@
 
     if (continuation()) {
         if (continuation()->isInline())
-            continuation()->addFocusRingRects(rects, flooredIntPoint(additionalOffset + continuation()->containingBlock()->location() - containingBlock()->location()));
+            continuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + continuation()->containingBlock()->location() - containingBlock()->location()));
         else
-            continuation()->addFocusRingRects(rects, flooredIntPoint(additionalOffset + toRenderBox(continuation())->location() - containingBlock()->location()));
+            continuation()->addFocusRingRects(rects, flooredLayoutPoint(additionalOffset + toRenderBox(continuation())->location() - containingBlock()->location()));
     }
 }
 

Modified: trunk/Source/WebCore/rendering/RenderInline.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderInline.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderInline.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -75,7 +75,7 @@
     
     LayoutSize relativePositionedInlineOffset(const RenderBox* child) const;
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
     void paintOutline(GraphicsContext*, const IntPoint&);
 
     using RenderBoxModelObject::continuation;

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -304,7 +304,7 @@
     }
 }
 
-void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const IntPoint& additionalOffset)
+void RenderListBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset)
 {
     if (!isSpatialNavigationEnabled(frame()))
         return RenderBlock::addFocusRingRects(rects, additionalOffset);

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -79,7 +79,7 @@
 
     virtual void layout();
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
     virtual bool canBeProgramaticallyScrolled() const { return true; }
     virtual void autoscroll();

Modified: trunk/Source/WebCore/rendering/RenderObject.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -777,7 +777,7 @@
     bool shouldUseTransformFromContainer(const RenderObject* container) const;
     void getTransformFromContainer(const RenderObject* container, const IntSize& offsetInContainer, TransformationMatrix&) const;
     
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&) { };
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&) { };
 
     IntRect absoluteOutlineBounds() const
     {

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -583,10 +583,10 @@
     }
 }
 
-void RenderTextControl::addFocusRingRects(Vector<IntRect>& rects, const IntPoint& additionalOffset)
+void RenderTextControl::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset)
 {
     if (!size().isEmpty())
-        rects.append(IntRect(additionalOffset, size()));
+        rects.append(LayoutRect(additionalOffset, size()));
 }
 
 void RenderTextControl::updatePlaceholderVisibility(bool placeholderShouldBeVisible, bool placeholderValueChanged)

Modified: trunk/Source/WebCore/rendering/RenderTextControl.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/RenderTextControl.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/RenderTextControl.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -92,7 +92,7 @@
     virtual bool avoidsFloats() const { return true; }
     virtual void paintObject(PaintInfo&, const LayoutPoint&);
     
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
     virtual bool canBeProgramaticallyScrolled() const { return true; }
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -139,9 +139,9 @@
 }
 
 // addFocusRingRects is called from paintOutline and needs to be in the same coordinates as the paintOuline call
-void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const IntPoint&)
+void RenderSVGContainer::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&)
 {
-    IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
+    LayoutRect paintRectInParent = enclosingLayoutRect(localToParentTransform().mapRect(repaintRectInLocalCoordinates()));
     if (!paintRectInParent.isEmpty())
         rects.append(paintRectInParent);
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGContainer.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -51,7 +51,7 @@
 
     virtual void layout();
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
     virtual FloatRect objectBoundingBox() const { return m_objectBoundingBox; }
     virtual FloatRect strokeBoundingBox() const { return m_strokeBoundingBox; }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -179,10 +179,10 @@
     repaint();
 }
 
-void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const IntPoint&)
+void RenderSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&)
 {
     // this is called from paint() after the localTransform has already been applied
-    IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates());
+    LayoutRect contentRect = enclosingLayoutRect(repaintRectInLocalCoordinates());
     if (!contentRect.isEmpty())
         rects.append(contentRect);
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGImage.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/svg/RenderSVGImage.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGImage.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -57,7 +57,7 @@
     virtual FloatRect strokeBoundingBox() const { return m_objectBoundingBox; }
     virtual FloatRect repaintRectInLocalCoordinates() const { return m_repaintBoundingBox; }
 
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp (90589 => 90590)


--- trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGPath.cpp	2011-07-07 21:16:15 UTC (rev 90590)
@@ -236,9 +236,9 @@
 
 // This method is called from inside paintOutline() since we call paintOutline()
 // while transformed to our coord system, return local coords
-void RenderSVGPath::addFocusRingRects(Vector<IntRect>& rects, const IntPoint&) 
+void RenderSVGPath::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint&) 
 {
-    IntRect rect = enclosingIntRect(repaintRectInLocalCoordinates());
+    LayoutRect rect = enclosingLayoutRect(repaintRectInLocalCoordinates());
     if (!rect.isEmpty())
         rects.append(rect);
 }

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGPath.h (90589 => 90590)


--- trunk/Source/WebCore/rendering/svg/RenderSVGPath.h	2011-07-07 21:06:58 UTC (rev 90589)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGPath.h	2011-07-07 21:16:15 UTC (rev 90590)
@@ -61,7 +61,7 @@
 
     virtual void layout();
     virtual void paint(PaintInfo&, const LayoutPoint&);
-    virtual void addFocusRingRects(Vector<IntRect>&, const IntPoint&);
+    virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&);
 
     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to