Bug 125911

Summary: Subpixel layout: roundedLayoutPoint(FloatPoint) should CSS pixel round (nytimes.com).
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED INVALID    
Severity: Normal CC: hyatt, jonlee, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 126283    
Attachments:
Description Flags
test case
none
screenshot(nytimes.com)
none
test case (roundedLayoutPoint(box.topLeft()) none

Description zalan 2013-12-17 22:15:47 PST
Created attachment 219505 [details]
test case

This is a placeholders to discuss the rounding strategy (if needed at all)

'Moves' text is calculated to be at 71.649414px which gets rounded to 72px with subpixel off, while to 4544 (71*64) with subpixel on by calling setLocation(roundedLayoutPoint(box.topLeft())); at RenderBox::positionLineBox.

<html>
<head>
<style>
  body {
    font-size: 53px;
  }
  
  span {
    display: inline-block; 
    border: solid 1px red;
  }
  div {
    width: 212px;
    border: solid 1px blue;
  }
</style>
</head>
<body>
There should be no gap between the red and the blue borders at the right side.
<div>foo<span>moves</span></div>
</body>
</html>
Comment 1 zalan 2013-12-17 22:17:01 PST
frame #0: 0x0000000105bd6438 WebCore`WebCore::RenderBox::positionLineBox(this=0x00007fb70ad63bb0, box=0x00007fb70ad67af0) + 440 at RenderBox.cpp:2003
    frame #1: 0x0000000105ba7dbe WebCore`WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine(this=0x00007fb70ad81150, lineBox=0x00007fb70ad639b0, firstRun=0x00007fb70ad98ac0, textBoxDataMap=0x00007fff5eb769b8, verticalPositionCache=0x00007fff5eb77ea0) + 446 at RenderBlockLineLayout.cpp:776
    frame #2: 0x0000000105ba80e6 WebCore`WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns(this=0x00007fb70ad81150, bidiRuns=0x00007fff5eb781d8, end=0x00007fff5eb77f40, lineInfo=0x00007fff5eb78430, verticalPositionCache=0x00007fff5eb77ea0, trailingSpaceRun=0x0000000000000000, wordMeasurements=0x00007fff5eb76dd0) + 486 at RenderBlockLineLayout.cpp:998
    frame #3: 0x0000000105baa169 WebCore`WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange(this=0x00007fb70ad81150, layoutState=0x00007fff5eb78430, resolver=0x00007fff5eb78118, cleanLineStart=0x00007fff5eb780c8, cleanLineBidiStatus=0x00007fff5eb780b0, consecutiveHyphenatedLines=0) + 3209 at RenderBlockLineLayout.cpp:1381
    frame #4: 0x0000000105ba8699 WebCore`WebCore::RenderBlockFlow::layoutRunsAndFloats(this=0x00007fb70ad81150, layoutState=0x00007fff5eb78430, hasInlineChild=true) + 1177 at RenderBlockLineLayout.cpp:1094
    frame #5: 0x0000000105bae3a1 WebCore`WebCore::RenderBlockFlow::layoutLineBoxes(this=0x00007fb70ad81150, relayoutChildren=true, repaintLogicalTop=0x00007fff5eb78888, repaintLogicalBottom=0x00007fff5eb78880) + 1969 at RenderBlockLineLayout.cpp:1686
    frame #6: 0x00000001063e00f1 WebCore`WebCore::RenderBlockFlow::layoutInlineChildren(this=0x00007fb70ad81150, relayoutChildren=true, repaintLogicalTop=0x00007fff5eb78888, repaintLogicalBottom=0x00007fff5eb78880) + 433 at RenderBlockFlow.cpp:536
    frame #7: 0x00000001063df365 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fb70ad81150, relayoutChildren=true, pageLogicalHeight=LayoutUnit at 0x00007fff5eb78910) + 1189 at RenderBlockFlow.cpp:361
    frame #8: 0x0000000105b6cded WebCore`WebCore::RenderBlock::layout(this=0x00007fb70ad81150) + 125 at RenderBlock.cpp:1323
    frame #9: 0x00000001063e274b WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fb70ad67a30, child=0x00007fb70ad81150, marginInfo=0x00007fff5eb78d98, previousFloatLogicalBottom=0x00007fff5eb78d78, maxFloatLogicalBottom=0x00007fff5eb79078) + 1323 at RenderBlockFlow.cpp:597
    frame #10: 0x00000001063e0371 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fb70ad67a30, relayoutChildren=true, maxFloatLogicalBottom=0x00007fff5eb79078) + 625 at RenderBlockFlow.cpp:516
    frame #11: 0x00000001063df388 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fb70ad67a30, relayoutChildren=true, pageLogicalHeight=LayoutUnit at 0x00007fff5eb79110) + 1224 at RenderBlockFlow.cpp:363
    frame #12: 0x0000000105b6cded WebCore`WebCore::RenderBlock::layout(this=0x00007fb70ad67a30) + 125 at RenderBlock.cpp:1323
    frame #13: 0x00000001063e274b WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fb70ad78f10, child=0x00007fb70ad67a30, marginInfo=0x00007fff5eb79598, previousFloatLogicalBottom=0x00007fff5eb79578, maxFloatLogicalBottom=0x00007fff5eb79878) + 1323 at RenderBlockFlow.cpp:597
    frame #14: 0x00000001063e0371 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fb70ad78f10, relayoutChildren=true, maxFloatLogicalBottom=0x00007fff5eb79878) + 625 at RenderBlockFlow.cpp:516
    frame #15: 0x00000001063df388 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fb70ad78f10, relayoutChildren=true, pageLogicalHeight=LayoutUnit at 0x00007fff5eb79910) + 1224 at RenderBlockFlow.cpp:363
    frame #16: 0x0000000105b6cded WebCore`WebCore::RenderBlock::layout(this=0x00007fb70ad78f10) + 125 at RenderBlock.cpp:1323
    frame #17: 0x00000001063e274b WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fb70ad5ea20, child=0x00007fb70ad78f10, marginInfo=0x00007fff5eb79d98, previousFloatLogicalBottom=0x00007fff5eb79d78, maxFloatLogicalBottom=0x00007fff5eb7a078) + 1323 at RenderBlockFlow.cpp:597
    frame #18: 0x00000001063e0371 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fb70ad5ea20, relayoutChildren=true, maxFloatLogicalBottom=0x00007fff5eb7a078) + 625 at RenderBlockFlow.cpp:516
    frame #19: 0x00000001063df388 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fb70ad5ea20, relayoutChildren=true, pageLogicalHeight=LayoutUnit at 0x00007fff5eb7a110) + 1224 at RenderBlockFlow.cpp:363
    frame #20: 0x0000000105b6cded WebCore`WebCore::RenderBlock::layout(this=0x00007fb70ad5ea20) + 125 at RenderBlock.cpp:1323
    frame #21: 0x0000000105e3267d WebCore`WebCore::RenderView::layoutContent(this=0x00007fb70ad5ea20, state=0x00007fb70ad80fa0) + 93 at RenderView.cpp:158
    frame #22: 0x0000000105e33827 WebCore`WebCore::RenderView::layout(this=0x00007fb70ad5ea20) + 2087 at RenderView.cpp:342
    frame #23: 0x0000000104eeb1ce WebCore`WebCore::FrameView::layout(this=0x00007fb70ad6d8e0, allowSubtree=true) + 3422 at FrameView.cpp:1261
    frame #24: 0x0000000104bfb910 WebCore`WebCore::Document::implicitClose(this=0x00007fb70b843600) + 1008 at Document.cpp:2472
    frame #25: 0x0000000104eb4beb WebCore`WebCore::FrameLoader::checkCallImplicitClose(this=0x00007fb70ad39e58) + 155 at FrameLoader.cpp:849
    frame #26: 0x0000000104eb4866 WebCore`WebCore::FrameLoader::checkCompleted(this=0x00007fb70ad39e58) + 358 at FrameLoader.cpp:792
    frame #27: 0x0000000104eb3178 WebCore`WebCore::FrameLoader::finishedParsing(this=0x00007fb70ad39e58) + 184 at FrameLoader.cpp:725
    frame #28: 0x0000000104c0670b WebCore`WebCore::Document::finishedParsing(this=0x00007fb70b843600) + 379 at Document.cpp:4490
    frame #29: 0x000000010504b758 WebCore`WebCore::HTMLConstructionSite::finishedParsing(this=0x00007fb70ad83388) + 24 at HTMLConstructionSite.cpp:347
    frame #30: 0x0000000105157767 WebCore`WebCore::HTMLTreeBuilder::finished(this=0x00007fb70ad83370) + 183 at HTMLTreeBuilder.cpp:3056
    frame #31: 0x000000010506fa2e WebCore`WebCore::HTMLDocumentParser::end(this=0x00007fb70ad69100) + 174 at HTMLDocumentParser.cpp:749
    frame #32: 0x000000010506e512 WebCore`WebCore::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd(this=0x00007fb70ad69100) + 242 at HTMLDocumentParser.cpp:760
    frame #33: 0x000000010506e33f WebCore`WebCore::HTMLDocumentParser::prepareToStopParsing(this=0x00007fb70ad69100) + 271 at HTMLDocumentParser.cpp:203
    frame #34: 0x000000010506fa83 WebCore`WebCore::HTMLDocumentParser::attemptToEnd(this=0x00007fb70ad69100) + 67 at HTMLDocumentParser.cpp:772
    frame #35: 0x000000010506fad8 WebCore`WebCore::HTMLDocumentParser::finish(this=0x00007fb70ad69100) + 72 at HTMLDocumentParser.cpp:821
    frame #36: 0x0000000104c7577a WebCore`WebCore::DocumentWriter::end(this=0x00007fb70b034aa0) + 346 at DocumentWriter.cpp:245
    frame #37: 0x0000000104c41da6 WebCore`WebCore::DocumentLoader::finishedLoading(this=0x00007fb70b034a00, finishTime=0) + 598 at DocumentLoader.cpp:408
    frame #38: 0x0000000104c41abe WebCore`WebCore::DocumentLoader::notifyFinished(this=0x00007fb70b034a00, resource=0x00007fb70c4336e0) + 270 at DocumentLoader.cpp:345
    frame #39: 0x00000001048635cd WebCore`WebCore::CachedResource::checkNotify(this=0x00007fb70c4336e0) + 109 at CachedResource.cpp:369
    frame #40: 0x00000001048636e4 WebCore`WebCore::CachedResource::finishLoading(this=0x00007fb70c4336e0, =0x00007fb70ad7d6e0) + 52 at CachedResource.cpp:385
    frame #41: 0x000000010485ddeb WebCore`WebCore::CachedRawResource::finishLoading(this=0x00007fb70c4336e0, data=0x00007fb70ad7d6e0) + 187 at CachedRawResource.cpp:94
    frame #42: 0x000000010605e298 WebCore`WebCore::SubresourceLoader::didFinishLoading(this=0x00007fb70b11a400, finishTime=0) + 440 at SubresourceLoader.cpp:279
    frame #43: 0x0000000105e60815 WebCore`WebCore::ResourceLoader::didFinishLoading(this=0x00007fb70b11a400, =0x00007fb70ac1c950, finishTime=0) + 53 at ResourceLoader.cpp:487
Comment 2 zalan 2013-12-17 22:19:28 PST
<rdar://problem/15687112>
Comment 3 Simon Fraser (smfr) 2013-12-18 11:41:33 PST
Dave Hyatt should say whether the line box tree should be converted from floats to LayoutUnits, or how to round the line box floats to LayoutUnits.
Comment 4 zalan 2013-12-20 16:58:50 PST
Created attachment 219812 [details]
screenshot(nytimes.com)

anim gif to demonstrate the off-by-one issue.
Comment 5 zalan 2013-12-26 17:13:57 PST
Created attachment 220041 [details]
test case (roundedLayoutPoint(box.topLeft())
Comment 6 zalan 2014-01-08 14:04:33 PST
failed cases:

  fast/css/resize-corner-tracking-transformed-iframe.html [ Failure ]
  fast/css/resize-corner-tracking-transformed.html [ Failure ]
  fast/events/document-elementFromPoint.html [ Failure ]
  fast/events/offsetX-offsetY.html [ Failure ]
  fast/regions/cssom/get-regions-by-content-horiz-bt.html [ Failure ]
  fast/regions/cssom/get-regions-by-content-vert-rl.html [ Failure ]
  fast/regions/overflow-region-transform.html [ ImageOnlyFailure ]
Comment 7 zalan 2014-01-15 10:01:15 PST
We match FF's (v26) behavior.