Bug 126892

Summary: Subpixel layout: setSimpleLineLayoutEnabled() produces different layout when line position has CSS px fractions.
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, esprehn+autocc, glenn, koivisto, kondapallykalyan, WebkitBugTracker
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 126283    
Attachments:
Description Flags
test case
none
Patch
none
Patch none

Description zalan 2014-01-13 07:26:39 PST
fast/forms/textAreaLineHeight-simple-lines.html
Comment 1 zalan 2014-01-14 14:36:59 PST
SimpleLineLayout's paintFlow() needs to call roundedIntPoint() on paint offset to match InlineTextBox's paint positioning.

something along these lines:

--- a/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
+++ b/Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
@@ -80,9 +80,10 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai
     GraphicsContextStateSaver stateSaver(context, textPaintStyle.strokeWidth > 0);
 
     updateGraphicsContext(context, textPaintStyle);
+    LayoutPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
 
     LayoutRect paintRect = paintInfo.rect;
-    paintRect.moveBy(-paintOffset);
+    paintRect.moveBy(-adjustedPaintOffset);
 
     auto resolver = runResolver(flow, layout);
     auto range = resolver.rangeForRect(paintRect);
@@ -92,9 +93,9 @@ void paintFlow(const RenderBlockFlow& flow, const Layout& layout, PaintInfo& pai
             continue;
         TextRun textRun(run.text());
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
-        context.drawText(font, textRun, run.baseline() + paintOffset);
+        context.drawText(font, textRun, run.baseline() + adjustedPaintOffset);
         if (debugBordersEnabled)
-            paintDebugBorders(context, run.rect(), paintOffset);
+            paintDebugBorders(context, run.rect(), adjustedPaintOffset);
     }
 }
Comment 2 zalan 2014-01-14 14:52:41 PST
Created attachment 221206 [details]
test case
Comment 3 zalan 2014-01-14 16:49:23 PST
*** Bug 126893 has been marked as a duplicate of this bug. ***
Comment 4 zalan 2014-01-14 20:47:38 PST
*** Bug 126894 has been marked as a duplicate of this bug. ***
Comment 5 zalan 2014-01-14 20:49:22 PST
additional failed cases (from dupes)

LayoutTests/fast/shapes/shape-inside/shape-inside-circle-padding.html
LayoutTests/fast/shapes/shape-inside/shape-inside-circle.html
LayoutTests/fast/shapes/shape-inside/shape-inside-ellipse-padding.html
LayoutTests/fast/shapes/shape-inside/shape-inside-ellipse.html
LayoutTests/fast/shapes/shape-inside/shape-inside-rounded-rectangle-fit-002.html
LayoutTests/fast/shapes/shape-inside/shape-inside-subpixel-rectangle-top.html

LayoutTests/fast/regions/floats-basic-in-variable-width-regions.html
LayoutTests/fast/regions/overflow-moving-below-floats-in-variable-width-regions.html
LayoutTests/fast/regions/overflow-not-moving-below-floats-in-variable-width-regions.html
LayoutTests/fast/regions/overflow-size-change-in-variable-width-regions.html
LayoutTests/fast/regions/overflow-size-change-with-stacking-context.html
LayoutTests/fast/regions/selection/selecting-text-through-different-region-flows.html
Comment 6 zalan 2014-01-15 09:11:54 PST
actually fast/shapes/shape-inside/shape-inside-subpixel-rectangle-top.html doesnt get fixed by this. For that, webkit.org/b/124784 needs revisiting.
Comment 7 zalan 2014-01-16 08:57:24 PST
*** Bug 126891 has been marked as a duplicate of this bug. ***
Comment 8 zalan 2014-01-16 08:58:03 PST
fast/css/word-spacing-between-blocks.html
fast/css/word-spacing-between-inlines.html
Comment 9 zalan 2014-01-17 21:17:01 PST
Created attachment 221530 [details]
Patch
Comment 10 zalan 2014-01-17 21:21:26 PST
Created attachment 221531 [details]
Patch
Comment 11 zalan 2014-01-19 17:56:42 PST
<rdar://problem/15855703>
Comment 12 Antti Koivisto 2014-01-20 07:03:31 PST
Comment on attachment 221531 [details]
Patch

r=me
Comment 13 WebKit Commit Bot 2014-01-20 07:37:55 PST
Comment on attachment 221531 [details]
Patch

Clearing flags on attachment: 221531

Committed r162340: <http://trac.webkit.org/changeset/162340>
Comment 14 WebKit Commit Bot 2014-01-20 07:37:58 PST
All reviewed patches have been landed.  Closing bug.