Title: [108673] branches/subpixellayout/Source/WebCore/rendering
Revision
108673
Author
[email protected]
Date
2012-02-23 13:52:42 -0800 (Thu, 23 Feb 2012)

Log Message

Cleaning up pixelSnappedLogical*OffsetForLine code.

Modified Paths


Diff

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h (108672 => 108673)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h	2012-02-23 21:42:02 UTC (rev 108672)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.h	2012-02-23 21:52:42 UTC (rev 108673)
@@ -163,6 +163,17 @@
     {
         return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0);
     }
+    LayoutUnit pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const 
+    {
+        return roundToInt(logicalLeftOffsetForLine(position, firstLine));
+    }
+    LayoutUnit pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine) const 
+    {
+        // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted
+        // by a subpixel value for all but the first column. This can lead to the actual pixel snapped width of the column being off
+        // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor.
+        return floorToInt(logicalRightOffsetForLine(position, firstLine));
+    }
     LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const
     {
         return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine)
@@ -173,17 +184,6 @@
         return !style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine)
             : logicalWidth() - logicalRightOffsetForLine(position, firstLine);
     }
-
-    void pixelSnappedLogicalLeftAndRightOffsetsForLine(LayoutUnit position, bool firstLine, int& snappedLeft, int& snappedRight) const
-    {
-        LayoutUnit left = logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0);
-        LayoutUnit right = logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0);
-        snappedLeft = roundToInt(left);
-        // FIXME: Multicolumn layouts break carrying over subpixel values to the logical right offset because the lines may be shifted
-        // by a subpixel value for all but the first column. This can lead to the actual pixel snapped width of the column being off
-        // by one pixel when rendered versus layed out, which can result in the line being clipped. For now, we have to floor.
-        snappedRight = floorToInt(right);
-    }
     
     LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine);
     LayoutUnit textIndentOffset() const;

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp (108672 => 108673)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-02-23 21:42:02 UTC (rev 108672)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2012-02-23 21:52:42 UTC (rev 108673)
@@ -115,11 +115,8 @@
 inline void LineWidth::updateAvailableWidth()
 {
     LayoutUnit height = m_block->logicalHeight();
-    int snappedLeft, snappedRight;
-    m_block->pixelSnappedLogicalLeftAndRightOffsetsForLine(height, m_isFirstLine, snappedLeft, snappedRight);
-    m_left = snappedLeft;
-    m_right = snappedRight;
-
+    m_left = m_block->pixelSnappedLogicalLeftOffsetForLine(height, m_isFirstLine);
+    m_right = m_block->pixelSnappedLogicalRightOffsetForLine(height, m_isFirstLine);
     computeAvailableWidthFromLeftAndRight();
 }
 
@@ -761,10 +758,8 @@
                                                          GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& verticalPositionCache)
 {
     ETextAlign textAlign = textAlignmentForLine(!reachedEnd && !lineBox->endsWithBreak());
-    int snappedLeft, snappedRight;
-    pixelSnappedLogicalLeftAndRightOffsetsForLine(logicalHeight(), lineInfo.isFirstLine(), snappedLeft, snappedRight);
-    float logicalLeft = snappedLeft;
-    float availableLogicalWidth = snappedRight - snappedLeft;
+    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), lineInfo.isFirstLine());
+    float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), lineInfo.isFirstLine()) - logicalLeft;
 
     bool needsWordSpacing = false;
     float totalLogicalWidth = lineBox->getFlowSpacingLogicalWidth();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to