Title: [96546] trunk/Source/WebCore
Revision
96546
Author
[email protected]
Date
2011-10-03 15:00:25 -0700 (Mon, 03 Oct 2011)

Log Message

remove dead code in flipForWritingMode
https://bugs.webkit.org/show_bug.cgi?id=68948

Reviewed by Hajime Morita.

ChildToParentFlippingAdjustment is never used, so the third argument
to flipForWritingMode always has the same value.

In addition, renamed to flipForWritingModeForChild to be more clear
that it's operating on the child and renamed flipFloatForWritingMode to match.

No new tests. This is just a code cleanup. No functional changes.

* rendering/InlineBox.cpp:
(WebCore::InlineBox::paint):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::flipFloatForWritingModeForChild):
(WebCore::RenderBlock::paintFloats):
(WebCore::RenderBlock::hitTestFloats):
(WebCore::RenderBlock::hitTestContents):
* rendering/RenderBlock.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::flipForWritingModeForChild):
(WebCore::RenderBox::topLeftLocation):
* rendering/RenderBox.h:
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paintObject):
(WebCore::RenderTable::nodeAtPoint):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::nodeAtPoint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paintCell):
(WebCore::RenderTableSection::nodeAtPoint):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96545 => 96546)


--- trunk/Source/WebCore/ChangeLog	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/ChangeLog	2011-10-03 22:00:25 UTC (rev 96546)
@@ -1,3 +1,40 @@
+2011-09-27  Ojan Vafai  <[email protected]>
+
+        remove dead code in flipForWritingMode
+        https://bugs.webkit.org/show_bug.cgi?id=68948
+
+        Reviewed by Hajime Morita.
+
+        ChildToParentFlippingAdjustment is never used, so the third argument
+        to flipForWritingMode always has the same value.
+
+        In addition, renamed to flipForWritingModeForChild to be more clear
+        that it's operating on the child and renamed flipFloatForWritingMode to match.
+
+        No new tests. This is just a code cleanup. No functional changes. 
+
+        * rendering/InlineBox.cpp:
+        (WebCore::InlineBox::paint):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintChildren):
+        (WebCore::RenderBlock::flipFloatForWritingModeForChild):
+        (WebCore::RenderBlock::paintFloats):
+        (WebCore::RenderBlock::hitTestFloats):
+        (WebCore::RenderBlock::hitTestContents):
+        * rendering/RenderBlock.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::flipForWritingModeForChild):
+        (WebCore::RenderBox::topLeftLocation):
+        * rendering/RenderBox.h:
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::paintObject):
+        (WebCore::RenderTable::nodeAtPoint):
+        * rendering/RenderTableRow.cpp:
+        (WebCore::RenderTableRow::nodeAtPoint):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::paintCell):
+        (WebCore::RenderTableSection::nodeAtPoint):
+
 2011-10-03  Jer Noble  <[email protected]>
 
         Unreviewed, rolling out r96526.

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (96545 => 96546)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2011-10-03 22:00:25 UTC (rev 96546)
@@ -198,7 +198,7 @@
 
     LayoutPoint childPoint = paintOffset;
     if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
-        childPoint = renderer()->containingBlock()->flipForWritingMode(toRenderBox(renderer()), childPoint, RenderBox::ParentToChildFlippingAdjustment);
+        childPoint = renderer()->containingBlock()->flipForWritingModeForChild(toRenderBox(renderer()), childPoint);
     
     // Paint all phases of replaced elements atomically, as though the replaced element established its
     // own stacking context.  (See Appendix E.2, section 6.4 on inline block/table elements in the CSS2.1

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-10-03 22:00:25 UTC (rev 96546)
@@ -2457,7 +2457,7 @@
             }
         }
 
-        LayoutPoint childPoint = flipForWritingMode(child, paintOffset, ParentToChildFlippingAdjustment);
+        LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset);
         if (!child->hasSelfPaintingLayer() && !child->isFloating())
             child->paint(info, childPoint);
 
@@ -2583,13 +2583,13 @@
     }
 }
 
-LayoutPoint RenderBlock::flipFloatForWritingMode(const FloatingObject* child, const LayoutPoint& point) const
+LayoutPoint RenderBlock::flipFloatForWritingModeForChild(const FloatingObject* child, const LayoutPoint& point) const
 {
     if (!style()->isFlippedBlocksWritingMode())
         return point;
     
-    // This is similar to the ParentToChildFlippingAdjustment in RenderBox::flipForWritingMode.  We have to subtract out our left/top offsets twice, since
-    // it's going to get added back in.  We hide this complication here so that the calling code looks normal for the unflipped
+    // This is similar to RenderBox::flipForWritingModeForChild. We have to subtract out our left/top offsets twice, since
+    // it's going to get added back in. We hide this complication here so that the calling code looks normal for the unflipped
     // case.
     if (isHorizontalWritingMode())
         return LayoutPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child));
@@ -2609,7 +2609,7 @@
         if (r->m_shouldPaint && !r->m_renderer->hasSelfPaintingLayer()) {
             PaintInfo currentPaintInfo(paintInfo);
             currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
-            LayoutPoint childPoint = flipFloatForWritingMode(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));
+            LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y()));
             r->m_renderer->paint(currentPaintInfo, childPoint);
             if (!preservePhase) {
                 currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
@@ -4137,7 +4137,7 @@
         if (floatingObject->m_shouldPaint && !floatingObject->m_renderer->hasSelfPaintingLayer()) {
             LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x();
             LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y();
-            LayoutPoint childPoint = flipFloatForWritingMode(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
+            LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset));
             if (floatingObject->m_renderer->hitTest(request, result, pointInContainer, childPoint)) {
                 updateHitTestResult(result, pointInContainer - toLayoutSize(childPoint));
                 return true;
@@ -4206,7 +4206,7 @@
         if (hitTestAction == HitTestChildBlockBackgrounds)
             childHitTest = HitTestChildBlockBackground;
         for (RenderBox* child = lastChildBox(); child; child = child->previousSiblingBox()) {
-            LayoutPoint childPoint = flipForWritingMode(child, accumulatedOffset, ParentToChildFlippingAdjustment);
+            LayoutPoint childPoint = flipForWritingModeForChild(child, accumulatedOffset);
             if (!child->hasSelfPaintingLayer() && !child->isFloating() && child->nodeAtPoint(request, result, pointInContainer, childPoint, childHitTest))
                 return true;
         }

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2011-10-03 22:00:25 UTC (rev 96546)
@@ -507,7 +507,7 @@
 #endif
     };
 
-    LayoutPoint flipFloatForWritingMode(const FloatingObject*, const LayoutPoint&) const;
+    LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&) const;
 
     LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); }
     LayoutUnit logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); }

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2011-10-03 22:00:25 UTC (rev 96546)
@@ -3693,7 +3693,7 @@
     return rect;
 }
 
-LayoutPoint RenderBox::flipForWritingMode(const RenderBox* child, const LayoutPoint& point, FlippingAdjustment adjustment) const
+LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const LayoutPoint& point) const
 {
     if (!style()->isFlippedBlocksWritingMode())
         return point;
@@ -3701,8 +3701,8 @@
     // The child is going to add in its x() and y(), so we have to make sure it ends up in
     // the right place.
     if (isHorizontalWritingMode())
-        return LayoutPoint(point.x(), point.y() + height() - child->height() - child->y() - (adjustment == ParentToChildFlippingAdjustment ? child->y() : 0));
-    return LayoutPoint(point.x() + width() - child->width() - child->x() - (adjustment == ParentToChildFlippingAdjustment ? child->x() : 0), point.y());
+        return LayoutPoint(point.x(), point.y() + height() - child->height() - (2 * child->y()));
+    return LayoutPoint(point.x() + width() - child->width() - (2 * child->x()), point.y());
 }
 
 void RenderBox::flipForWritingMode(IntRect& rect) const
@@ -3767,7 +3767,7 @@
     RenderBlock* containerBlock = containingBlock();
     if (!containerBlock || containerBlock == this)
         return location();
-    return containerBlock->flipForWritingMode(this, location(), RenderBox::ParentToChildFlippingAdjustment);
+    return containerBlock->flipForWritingModeForChild(this, location());
 }
 
 LayoutSize RenderBox::topLeftLocationOffset() const

Modified: trunk/Source/WebCore/rendering/RenderBox.h (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderBox.h	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2011-10-03 22:00:25 UTC (rev 96546)
@@ -405,8 +405,7 @@
     virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
     virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
 
-    enum FlippingAdjustment { ChildToParentFlippingAdjustment, ParentToChildFlippingAdjustment };
-    LayoutPoint flipForWritingMode(const RenderBox* child, const LayoutPoint&, FlippingAdjustment) const;
+    LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutPoint&) const;
     int flipForWritingMode(int position) const; // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes).
     IntPoint flipForWritingMode(const IntPoint&) const;
     LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const;

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2011-10-03 22:00:25 UTC (rev 96546)
@@ -522,7 +522,7 @@
 
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
-            LayoutPoint childPoint = flipForWritingMode(toRenderBox(child), paintOffset, ParentToChildFlippingAdjustment);
+            LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), paintOffset);
             child->paint(info, childPoint);
         }
     }
@@ -537,7 +537,7 @@
             m_currentBorder = &m_collapsedBorders[i];
             for (RenderObject* child = firstChild(); child; child = child->nextSibling())
                 if (child->isTableSection()) {
-                    LayoutPoint childPoint = flipForWritingMode(toRenderTableSection(child), paintOffset, ParentToChildFlippingAdjustment);
+                    LayoutPoint childPoint = flipForWritingModeForChild(toRenderTableSection(child), paintOffset);
                     child->paint(info, childPoint);
                 }
         }
@@ -1198,7 +1198,7 @@
     if (!hasOverflowClip() || overflowClipRect(adjustedLocation).intersects(result.rectForPoint(pointInContainer))) {
         for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
             if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption)) {
-                LayoutPoint childPoint = flipForWritingMode(toRenderBox(child), adjustedLocation, ParentToChildFlippingAdjustment);
+                LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);
                 if (child->nodeAtPoint(request, result, pointInContainer, childPoint, action)) {
                     updateHitTestResult(result, toLayoutPoint(pointInContainer - childPoint));
                     return true;

Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderTableRow.cpp	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp	2011-10-03 22:00:25 UTC (rev 96546)
@@ -204,7 +204,7 @@
         // table-specific hit-test method (which we should do for performance reasons anyway),
         // then we can remove this check.
         if (child->isTableCell() && !toRenderBox(child)->hasSelfPaintingLayer()) {
-            LayoutPoint cellPoint = flipForWritingMode(toRenderTableCell(child), accumulatedOffset, ParentToChildFlippingAdjustment);
+            LayoutPoint cellPoint = flipForWritingModeForChild(toRenderTableCell(child), accumulatedOffset);
             if (child->nodeAtPoint(request, result, pointInContainer, cellPoint, action)) {
                 updateHitTestResult(result, pointInContainer - toLayoutSize(cellPoint));
                 return true;

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (96545 => 96546)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2011-10-03 21:57:53 UTC (rev 96545)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2011-10-03 22:00:25 UTC (rev 96546)
@@ -960,7 +960,7 @@
 
 void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    LayoutPoint cellPoint = flipForWritingMode(cell, paintOffset, ParentToChildFlippingAdjustment);
+    LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset);
     PaintPhase paintPhase = paintInfo.phase;
     RenderTableRow* row = toRenderTableRow(cell->parent());
 
@@ -1219,7 +1219,7 @@
             // table-specific hit-test method (which we should do for performance reasons anyway),
             // then we can remove this check.
             if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer()) {
-                LayoutPoint childPoint = flipForWritingMode(toRenderBox(child), adjustedLocation, ParentToChildFlippingAdjustment);
+                LayoutPoint childPoint = flipForWritingModeForChild(toRenderBox(child), adjustedLocation);
                 if (child->nodeAtPoint(request, result, pointInContainer, childPoint, action)) {
                     updateHitTestResult(result, toLayoutPoint(pointInContainer - childPoint));
                     return true;
@@ -1263,7 +1263,7 @@
 
     for (int i = current.cells.size() - 1; i >= 0; --i) {
         RenderTableCell* cell = current.cells[i];
-        LayoutPoint cellPoint = flipForWritingMode(cell, adjustedLocation, ParentToChildFlippingAdjustment);
+        LayoutPoint cellPoint = flipForWritingModeForChild(cell, adjustedLocation);
         if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, pointInContainer, cellPoint, action)) {
             updateHitTestResult(result, toLayoutPoint(pointInContainer - cellPoint));
             return true;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to