Changeset 117659 in webkit
- Timestamp:
- May 18, 2012 4:58:21 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117658 r117659 1 2012-05-18 Levi Weintraub <leviw@chromium.org> 2 3 Revert to float method of selection rect alignment for line box tree 4 https://bugs.webkit.org/show_bug.cgi?id=86904 5 6 Reviewed by Eric Seidel. 7 8 In r117491, we introduced a new method of alignment for the selection rect in the sub-pixel case. 9 It turns out there is at least one case on Mac where this leaves a gap when painting selection rects 10 originating in the line box tree. This patch reverts us to the float method for the line box tree, 11 but retains the LayoutRect snapping for gap rects. 12 13 No new tests. Covered by existing tests with sub-pixel layout enabled. 14 15 * rendering/EllipsisBox.cpp: 16 (WebCore::EllipsisBox::paintSelection): Re-enabling the FloatRect flavor of 17 alignSelectionRectToDevicePixels for the line box tree. 18 * rendering/InlineTextBox.cpp: 19 (WebCore::alignSelectionRectToDevicePixels): Moving LayoutRect flavor to RenderBlock. 20 (WebCore::InlineTextBox::paintSelection): Happily clearing up the bifurcation of algorithms for 21 sub-pixel layout. 22 * rendering/InlineTextBox.h: Re-enabling the FloatRect flavor of alignSelectionRectToDevicePixels 23 for the line box tree. 24 * rendering/RenderBlock.cpp: 25 (WebCore::alignSelectionRectToDevicePixels): Re-seating the LayoutRect version of 26 alignSelectionRectToDevicePixels for use with GapRects. 27 1 28 2012-05-18 Eric Seidel <eric@webkit.org> 2 29 -
trunk/Source/WebCore/rendering/EllipsisBox.cpp
r117491 r117659 98 98 LayoutUnit top = root()->selectionTop(); 99 99 LayoutUnit h = root()->selectionHeight(); 100 LayoutRect clipRect(x() + paintOffset.x(), top + paintOffset.y(), m_logicalWidth, h);100 FloatRect clipRect(x() + paintOffset.x(), top + paintOffset.y(), m_logicalWidth, h); 101 101 alignSelectionRectToDevicePixels(clipRect); 102 102 context->clip(clipRect); -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r117491 r117659 808 808 } 809 809 810 void alignSelectionRectToDevicePixels(LayoutRect& rect)811 {812 LayoutUnit maxX = floorToInt(rect.maxX());813 rect.setX(floorToInt(rect.x()));814 rect.setWidth(maxX - rect.x());815 }816 817 #if !ENABLE(SUBPIXEL_LAYOUT)818 810 void alignSelectionRectToDevicePixels(FloatRect& rect) 819 811 { … … 822 814 rect.setWidth(roundf(maxX - rect.x())); 823 815 } 824 #endif825 816 826 817 void InlineTextBox::paintSelection(GraphicsContext* context, const FloatPoint& boxOrigin, RenderStyle* style, const Font& font, Color textColor) … … 862 853 863 854 LayoutUnit deltaY = renderer()->style()->isFlippedLinesWritingMode() ? selectionBottom - logicalBottom() : logicalTop() - selectionTop; 864 LayoutUnit selHeight = max<LayoutUnit>(0, selectionBottom - selectionTop); 865 866 #if ENABLE(SUBPIXEL_LAYOUT) 867 LayoutPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 868 LayoutRect clipRect(localOrigin, LayoutSize(m_logicalWidth, selHeight)); 869 alignSelectionRectToDevicePixels(clipRect); 870 #else 855 LayoutUnit selHeight = max<LayoutUnit>(ZERO_LAYOUT_UNIT, selectionBottom - selectionTop); 856 871 857 FloatPoint localOrigin(boxOrigin.x(), boxOrigin.y() - deltaY); 872 858 FloatRect clipRect(localOrigin, FloatSize(m_logicalWidth, selHeight)); 873 859 alignSelectionRectToDevicePixels(clipRect); 874 #endif 860 875 861 context->clip(clipRect); 876 862 -
trunk/Source/WebCore/rendering/InlineTextBox.h
r117491 r117659 214 214 } 215 215 216 void alignSelectionRectToDevicePixels(LayoutRect&);217 #if !ENABLE(SUBPIXEL_LAYOUT)218 216 void alignSelectionRectToDevicePixels(FloatRect&); 219 #endif220 217 221 218 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r117491 r117659 3347 3347 } 3348 3348 3349 static inline void alignSelectionRectToDevicePixels(LayoutRect& rect) 3350 { 3351 LayoutUnit maxX = floorToInt(rect.maxX()); 3352 rect.setX(floorToInt(rect.x())); 3353 rect.setWidth((maxX - rect.x()).round()); 3354 } 3355 3349 3356 LayoutRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 3350 3357 RenderObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo)
Note: See TracChangeset
for help on using the changeset viewer.