Bug 125829 - Subpixel layout: ceiledLayoutUnit()/roundedLayoutUnit() should CSS pixelsnap when subpixel is on.
Summary: Subpixel layout: ceiledLayoutUnit()/roundedLayoutUnit() should CSS pixelsnap ...
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
: 126048 (view as bug list)
Depends on:
Blocks: 126283
  Show dependency treegraph
 
Reported: 2013-12-16 20:26 PST by zalan
Modified: 2014-01-15 09:45 PST (History)
4 users (show)

See Also:


Attachments
test case (141 bytes, text/html)
2013-12-16 20:26 PST, zalan
no flags Details
test case (computeInlinePreferredLogicalWidths ceiling) (480 bytes, text/html)
2013-12-26 17:02 PST, zalan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2013-12-16 20:26:04 PST
Created attachment 219390 [details]
test case

float value: 22.203

LayoutUnit ceiledLayoutUnit(float) 
subpixel off: ->23 unit -> 23 CSS px/
subpixel on:  (22.203 * 64) -> 1420.992 -> ceiled to 1421 unit ->  (later) snapped to 22 CSS px

in order to preserve the CSS px correctness, these functions need to snap to CSS units instead.

simple test case:

<html>
<head>
  <style>
    span {
        float: left;
    }
  </style>
</head>
<body>
<ul>
  <li><span>foo<span></li>
</ul>
</body>
</html>
Comment 1 zalan 2013-12-16 20:29:42 PST
<rdar://problem/15675695>
Comment 2 zalan 2013-12-16 20:34:35 PST
 frame #0: 0x0000000104f6874c WebCore`WebCore::LayoutUnit::fromFloatCeil(value=21.202999) + 124 at LayoutUnit.h:130
    frame #1: 0x00000001051329a7 WebCore`WebCore::ceiledLayoutUnit(value=21.202999) + 23 at LayoutUnit.h:945
    frame #2: 0x0000000105185ebd WebCore`WebCore::updatePreferredWidth(preferredWidth=0x00007fedc2602498, result=0x00007fff5f4afb28) + 29 at RenderBlock.cpp:4250
    frame #3: 0x000000010518407a WebCore`WebCore::RenderBlock::computeInlinePreferredLogicalWidths(this=0x00007fedc2602420, minLogicalWidth=0x00007fedc2602498, maxLogicalWidth=0x00007fedc260249c) + 4106 at RenderBlock.cpp:4570
    frame #4: 0x0000000105182d10 WebCore`WebCore::RenderBlock::computeIntrinsicLogicalWidths(this=0x00007fedc2602420, minLogicalWidth=0x00007fedc2602498, maxLogicalWidth=0x00007fedc260249c) const + 96 at RenderBlock.cpp:4059
    frame #5: 0x0000000105185668 WebCore`WebCore::RenderBlock::computePreferredLogicalWidths(this=0x00007fedc2602420) + 536 at RenderBlock.cpp:4098
    frame #6: 0x00000001051d5559 WebCore`WebCore::RenderBox::minPreferredLogicalWidth(this=0x00007fedc2602420) const + 89 at RenderBox.cpp:943
    frame #7: 0x00000001051835d1 WebCore`WebCore::RenderBlock::computeInlinePreferredLogicalWidths(this=0x00007fedc2696400, minLogicalWidth=0x00007fedc2696478, maxLogicalWidth=0x00007fedc269647c) + 1377 at RenderBlock.cpp:4386
    frame #8: 0x0000000105182d10 WebCore`WebCore::RenderBlock::computeIntrinsicLogicalWidths(this=0x00007fedc2696400, minLogicalWidth=0x00007fedc2696478, maxLogicalWidth=0x00007fedc269647c) const + 96 at RenderBlock.cpp:4059
    frame #9: 0x0000000105185668 WebCore`WebCore::RenderBlock::computePreferredLogicalWidths(this=0x00007fedc2696400) + 536 at RenderBlock.cpp:4098
    frame #10: 0x00000001051d5559 WebCore`WebCore::RenderBox::minPreferredLogicalWidth(this=0x00007fedc2696400) const + 89 at RenderBox.cpp:943
    frame #11: 0x00000001051d2f5f WebCore`WebCore::RenderBox::computeLogicalWidthInRegionUsing(this=0x00007fedc2696400, widthType=MainOrPreferredSize, logicalWidth=0x00007fff5f4b09c8, availableLogicalWidth=LayoutUnit at 0x00007fff5f4b0710, cb=0x00007fedc2695a00, region=0x0000000000000000) const + 799 at RenderBox.cpp:2330
    frame #12: 0x00000001051dd08d WebCore`WebCore::RenderBox::computeLogicalWidthInRegion(this=0x00007fedc2696400, computedValues=0x00007fff5f4b0b90, region=0x0000000000000000) const + 2173 at RenderBox.cpp:2243
    frame #13: 0x00000001051dc7a7 WebCore`WebCore::RenderBox::updateLogicalWidth(this=0x00007fedc2696400) + 55 at RenderBox.cpp:2179
    frame #14: 0x000000010517395f WebCore`WebCore::RenderBlock::updateLogicalWidthAndColumnWidth(this=0x00007fedc2696400) + 63 at RenderBlock.cpp:1562
    frame #15: 0x00000001059e7057 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fedc2696400, relayoutChildren=false, pageLogicalHeight=LayoutUnit at 0x00007fff5f4b0f30) + 263 at RenderBlockFlow.cpp:315
    frame #16: 0x000000010517225d WebCore`WebCore::RenderBlock::layout(this=0x00007fedc2696400) + 125 at RenderBlock.cpp:1323
    frame #17: 0x000000010443605c WebCore`WebCore::RenderElement::layoutIfNeeded(this=0x00007fedc2696400) + 60 at RenderElement.h:99
    frame #18: 0x00000001059e9d37 WebCore`WebCore::RenderBlockFlow::insertFloatingObject(this=0x00007fedc2695a00, floatBox=0x00007fedc2696400) + 647 at RenderBlockFlow.cpp:2006
    frame #19: 0x00000001051c7520 WebCore`WebCore::LineBreaker::insertFloatingObject(this=0x00007fff5f4b2be0, floatBox=0x00007fedc2696400) + 32 at LineBreaker.h:71
    frame #20: 0x00000001051bacf1 WebCore`WebCore::BreakingContext::handleFloat(this=0x00007fff5f4b1410) + 65 at BreakingContextInlineHeaders.h:349
    frame #21: 0x00000001051b5847 WebCore`WebCore::LineBreaker::nextSegmentBreak(this=0x00007fff5f4b2be0, resolver=0x00007fff5f4b2e78, lineInfo=0x00007fff5f4b3190, renderTextInfo=0x00007fff5f4b2c50, lastFloatFromPreviousLine=0x0000000000000000, consecutiveHyphenatedLines=0, wordMeasurements=0x00007fff5f4b1b30) + 775 at RenderBlockLineLayout.cpp:2077
    frame #22: 0x00000001051b28cc WebCore`WebCore::LineBreaker::nextLineBreak(this=0x00007fff5f4b2be0, resolver=0x00007fff5f4b2e78, lineInfo=0x00007fff5f4b3190, renderTextInfo=0x00007fff5f4b2c50, lastFloatFromPreviousLine=0x0000000000000000, consecutiveHyphenatedLines=0, wordMeasurements=0x00007fff5f4b1b30) + 188 at RenderBlockLineLayout.cpp:2007
    frame #23: 0x00000001051af0eb WebCore`WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange(this=0x00007fedc2695a00, layoutState=0x00007fff5f4b3190, resolver=0x00007fff5f4b2e78, cleanLineStart=0x00007fff5f4b2e28, cleanLineBidiStatus=0x00007fff5f4b2e10, consecutiveHyphenatedLines=0) + 1579 at RenderBlockLineLayout.cpp:1333
    frame #24: 0x00000001051adc79 WebCore`WebCore::RenderBlockFlow::layoutRunsAndFloats(this=0x00007fedc2695a00, layoutState=0x00007fff5f4b3190, hasInlineChild=true) + 1177 at RenderBlockLineLayout.cpp:1094
    frame #25: 0x00000001051b3981 WebCore`WebCore::RenderBlockFlow::layoutLineBoxes(this=0x00007fedc2695a00, relayoutChildren=false, repaintLogicalTop=0x00007fff5f4b35e8, repaintLogicalBottom=0x00007fff5f4b35e0) + 1969 at RenderBlockLineLayout.cpp:1686
    frame #26: 0x00000001059e8181 WebCore`WebCore::RenderBlockFlow::layoutInlineChildren(this=0x00007fedc2695a00, relayoutChildren=false, repaintLogicalTop=0x00007fff5f4b35e8, repaintLogicalBottom=0x00007fff5f4b35e0) + 433 at RenderBlockFlow.cpp:536
    frame #27: 0x00000001059e73f5 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fedc2695a00, relayoutChildren=false, pageLogicalHeight=LayoutUnit at 0x00007fff5f4b3670) + 1189 at RenderBlockFlow.cpp:361
    frame #28: 0x000000010517225d WebCore`WebCore::RenderBlock::layout(this=0x00007fedc2695a00) + 125 at RenderBlock.cpp:1323
    frame #29: 0x00000001052f4f6f WebCore`WebCore::RenderListItem::layout(this=0x00007fedc2695a00) + 111 at RenderListItem.cpp:310
    frame #30: 0x00000001059ea7db WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fedc26cfef0, child=0x00007fedc2695a00, marginInfo=0x00007fff5f4b3b28, previousFloatLogicalBottom=0x00007fff5f4b3b08, maxFloatLogicalBottom=0x00007fff5f4b3e08) + 1323 at RenderBlockFlow.cpp:597
    frame #31: 0x00000001059e8401 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fedc26cfef0, relayoutChildren=false, maxFloatLogicalBottom=0x00007fff5f4b3e08) + 625 at RenderBlockFlow.cpp:516
    frame #32: 0x00000001059e7418 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fedc26cfef0, relayoutChildren=false, pageLogicalHeight=LayoutUnit at 0x00007fff5f4b3ea0) + 1224 at RenderBlockFlow.cpp:363
    frame #33: 0x000000010517225d WebCore`WebCore::RenderBlock::layout(this=0x00007fedc26cfef0) + 125 at RenderBlock.cpp:1323
    frame #34: 0x00000001059ea7db WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fedc26b2c60, child=0x00007fedc26cfef0, marginInfo=0x00007fff5f4b4328, previousFloatLogicalBottom=0x00007fff5f4b4308, maxFloatLogicalBottom=0x00007fff5f4b4608) + 1323 at RenderBlockFlow.cpp:597
    frame #35: 0x00000001059e8401 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fedc26b2c60, relayoutChildren=false, maxFloatLogicalBottom=0x00007fff5f4b4608) + 625 at RenderBlockFlow.cpp:516
    frame #36: 0x00000001059e7418 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fedc26b2c60, relayoutChildren=false, pageLogicalHeight=LayoutUnit at 0x00007fff5f4b46a0) + 1224 at RenderBlockFlow.cpp:363
    frame #37: 0x000000010517225d WebCore`WebCore::RenderBlock::layout(this=0x00007fedc26b2c60) + 125 at RenderBlock.cpp:1323
    frame #38: 0x00000001059ea7db WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fedc26cfdb0, child=0x00007fedc26b2c60, marginInfo=0x00007fff5f4b4b28, previousFloatLogicalBottom=0x00007fff5f4b4b08, maxFloatLogicalBottom=0x00007fff5f4b4e08) + 1323 at RenderBlockFlow.cpp:597
    frame #39: 0x00000001059e8401 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fedc26cfdb0, relayoutChildren=false, maxFloatLogicalBottom=0x00007fff5f4b4e08) + 625 at RenderBlockFlow.cpp:516
    frame #40: 0x00000001059e7418 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fedc26cfdb0, relayoutChildren=false, pageLogicalHeight=LayoutUnit at 0x00007fff5f4b4ea0) + 1224 at RenderBlockFlow.cpp:363
    frame #41: 0x000000010517225d WebCore`WebCore::RenderBlock::layout(this=0x00007fedc26cfdb0) + 125 at RenderBlock.cpp:1323
    frame #42: 0x00000001059ea7db WebCore`WebCore::RenderBlockFlow::layoutBlockChild(this=0x00007fedc26393b0, child=0x00007fedc26cfdb0, marginInfo=0x00007fff5f4b5328, previousFloatLogicalBottom=0x00007fff5f4b5308, maxFloatLogicalBottom=0x00007fff5f4b5608) + 1323 at RenderBlockFlow.cpp:597
    frame #43: 0x00000001059e8401 WebCore`WebCore::RenderBlockFlow::layoutBlockChildren(this=0x00007fedc26393b0, relayoutChildren=false, maxFloatLogicalBottom=0x00007fff5f4b5608) + 625 at RenderBlockFlow.cpp:516
    frame #44: 0x00000001059e7418 WebCore`WebCore::RenderBlockFlow::layoutBlock(this=0x00007fedc26393b0, relayoutChildren=false, pageLogicalHeight=LayoutUnit at 0x00007fff5f4b56a0) + 1224 at RenderBlockFlow.cpp:363
    frame #45: 0x000000010517225d WebCore`WebCore::RenderBlock::layout(this=0x00007fedc26393b0) + 125 at RenderBlock.cpp:1323
    frame #46: 0x000000010543aa2d WebCore`WebCore::RenderView::layoutContent(this=0x00007fedc26393b0, state=0x00007fedc2624230) + 93 at RenderView.cpp:158
    frame #47: 0x000000010543bbd7 WebCore`WebCore::RenderView::layout(this=0x00007fedc26393b0) + 2087 at RenderView.cpp:344
    frame #48: 0x00000001044e20be WebCore`WebCore::FrameView::layout(this=0x00007fedc2625970, allowSubtree=true) + 3422 at FrameView.cpp:1261
    frame #49: 0x00000001044eb1f9 WebCore`WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive(this=0x00007fedc2625970) + 89 at FrameView.cpp:3627
    frame #50: 0x000000010086a680 WebKit`-[WebHTMLView(self=0x00007fedc26afb30, _cmd=0x00007fff87dfa568) _web_updateLayoutAndStyleIfNeededRecursive] + 112 at WebHTMLView.mm:5391
    frame #51: 0x0000000100853402 WebKit`-[WebHTMLView(self=0x00007fedc26afb30, _cmd=0x00007fff89d918a3) viewWillDraw] + 98 at WebHTMLView.mm:1267
Comment 3 zalan 2013-12-17 15:47:07 PST
This and Bug 125874 are more like placeholders to discuss the rounding strategy (if needed at all)
Comment 4 Simon Fraser (smfr) 2013-12-18 11:36:27 PST
I think Dave Hyatt should comment on how RenderBlock::computeInlinePreferredLogicalWidths() should work with subpixel layout enabled.
Comment 5 zalan 2013-12-26 17:02:46 PST
Created attachment 220040 [details]
test case (computeInlinePreferredLogicalWidths ceiling)

While calculating the preferred inline width, we ceil the width value. In case of subpixel off, it ceils to CSS pixel value, while with subpixel on, it ceils to layout unit value. 
subpixel off: 138.37451 ceiling -> 139px
subpixel on: 138.37451 converting to layout unit -> 8855.96864 ceiling -> 8856. It later (at painting time) gets rounded to 138px (138.375)
Comment 6 zalan 2013-12-27 17:56:21 PST
*** Bug 126048 has been marked as a duplicate of this bug. ***
Comment 7 zalan 2013-12-27 18:07:53 PST
(In reply to comment #5)
> Created an attachment (id=220040) [details]
> test case (computeInlinePreferredLogicalWidths ceiling)
> 
> While calculating the preferred inline width, we ceil the width value. In case of subpixel off, it ceils to CSS pixel value, while with subpixel on, it ceils to layout unit value. 
> subpixel off: 138.37451 ceiling -> 139px
> subpixel on: 138.37451 converting to layout unit -> 8855.96864 ceiling -> 8856. It later (at painting time) gets rounded to 138px (138.375)

In this case, the ceiling happens at -> static inline void updatePreferredWidth(LayoutUnit& preferredWidth, float& result)
Comment 8 zalan 2014-01-15 09:45:11 PST
Matches FF's(v26) behavior.