Changeset 168078 in webkit


Ignore:
Timestamp:
Apr 30, 2014 7:15:17 PM (10 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Some accerated overflow-scroll doesn't scroll correctly
https://bugs.webkit.org/show_bug.cgi?id=132375

Reviewed by Tim Horton.

Source/WebCore:
We set the size of the scrolling layer (which becomes the bounds of
the UIScrollView) to a non-pixel-snapped padding box size, but the
size of the contents layer is an integral-snapped scroll size.
This would result in a fractional difference between the two, which
makes us thing that the element is scrollable when it really is not.

Fix by setting the size of the scroll layer to pixel snapped client size,
which is what we also use for scrollability computation.

Added some FIXMEs in code that requires pixel snapping.

Also use #if PLATFORM(IOS)/#else to bracket some code that never runs on iOS
but tries to do something similar to iOS-only code.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

LayoutTests:
New test that dumps compositing layers on iOS so we can see the sizes of the
scroll layers that get created.

  • compositing/overflow/subpixel-overflow-expected.txt: Added.
  • compositing/overflow/subpixel-overflow.html: Added.
  • platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt: Added.
  • platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt:

This is a progression; the old code failed to take the scrollbar width into
account, and the new code does.

Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168077 r168078  
     12014-04-30  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Some accerated overflow-scroll doesn't scroll correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=132375
     5
     6        Reviewed by Tim Horton.
     7       
     8        New test that dumps compositing layers on iOS so we can see the sizes of the
     9        scroll layers that get created.
     10       
     11        * compositing/overflow/subpixel-overflow-expected.txt: Added.
     12        * compositing/overflow/subpixel-overflow.html: Added.
     13        * platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt: Added.
     14        * platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt:
     15        This is a progression; the old code failed to take the scrollbar width into
     16        account, and the new code does.
     17
     18
    1192014-04-30  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/LayoutTests/platform/mac/compositing/overflow/composited-scrolling-creates-a-stacking-container-expected.txt

    r146531 r168078  
    1313            (GraphicsLayer
    1414              (position 1.00 1.00)
    15               (bounds 200.00 200.00)
     15              (bounds 185.00 185.00)
    1616              (children 1
    1717                (GraphicsLayer
  • trunk/Source/WebCore/ChangeLog

    r168076 r168078  
     12014-04-30  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Some accerated overflow-scroll doesn't scroll correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=132375
     5
     6        Reviewed by Tim Horton.
     7       
     8        We set the size of the scrolling layer (which becomes the bounds of
     9        the UIScrollView) to a non-pixel-snapped padding box size, but the
     10        size of the contents layer is an integral-snapped scroll size.
     11        This would result in a fractional difference between the two, which
     12        makes us thing that the element is scrollable when it really is not.
     13       
     14        Fix by setting the size of the scroll layer to pixel snapped client size,
     15        which is what we also use for scrollability computation.
     16       
     17        Added some FIXMEs in code that requires pixel snapping.
     18       
     19        Also use #if PLATFORM(IOS)/#else to bracket some code that never runs on iOS
     20        but tries to do something similar to iOS-only code.
     21
     22        * rendering/RenderLayerBacking.cpp:
     23        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
     24
    1252014-04-30  David Hyatt  <hyatt@apple.com>
    226
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r167970 r168078  
    744744        // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
    745745        // position relative to it.
     746        // FIXME: need to do some pixel snapping here.
    746747        LayoutRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
    747748        graphicsLayerParentLocation = clippingBox.location();
     
    758759            renderBox->height() - renderBox->borderTop() - renderBox->borderBottom());
    759760
    760         LayoutSize scrollOffset = compAncestor->scrolledContentOffset();
     761        IntSize scrollOffset = compAncestor->scrolledContentOffset();
     762        // FIXME: pixel snap the padding box.
    761763        graphicsLayerParentLocation = paddingBox.location() - scrollOffset;
    762764    }
    763 #endif
    764 
     765#else
    765766    if (compAncestor && compAncestor->needsCompositedScrolling()) {
    766767        RenderBox& renderBox = toRenderBox(compAncestor->renderer());
     
    769770        graphicsLayerParentLocation = scrollOrigin - scrollOffset;
    770771    }
    771    
     772#endif
     773
    772774    if (compAncestor && m_ancestorClippingLayer) {
    773775        // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this
     
    814816    LayoutRect clippingBox;
    815817    if (GraphicsLayer* clipLayer = clippingLayer()) {
     818        // FIXME: need to do some pixel snapping here.
    816819        clippingBox = clipBox(toRenderBox(renderer()));
    817820        clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
     
    910913        LayoutSize scrollOffset = m_owningLayer.scrollOffset();
    911914
     915        // FIXME: need to do some pixel snapping here.
    912916        m_scrollingLayer->setPosition(FloatPoint(paddingBox.location() - localCompositingBounds.location()));
    913917
    914         m_scrollingLayer->setSize(paddingBox.size());
     918        IntSize pixelSnappedClientSize(renderBox.pixelSnappedClientWidth(), renderBox.pixelSnappedClientHeight());
     919        m_scrollingLayer->setSize(pixelSnappedClientSize);
    915920#if PLATFORM(IOS)
    916921        FloatSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
Note: See TracChangeset for help on using the changeset viewer.