⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 187116 in webkit


Ignore:
Timestamp:
Jul 21, 2015, 12:56:24 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
https://bugs.webkit.org/show_bug.cgi?id=147049
<rdar://problem/21110936>

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2015-07-21
Reviewed by Simon Fraser.
Source/WebCore:

The fixed-attached background-image rendering is special. In general, to
display it, the destinationSize should be set to visibleContentSize. The
destinationLocation should be set such that the background-image does
not move with scrolling. The topContentInset should be subtracted from
the destinationLocation such that background-image can be rendered blurred
in the topContentArea. However there are cases in which these rules have to
be changed.

-- destinationSize: In the case of fixed layout size, the fixedLayoutSize
is bigger than the visibleContentSize. In this case, if the background-image
belongs to the root element, the destinationSize has to be set to fixedLayoutSize.
Otherwise it has to be set to the borderBoxSize unless the overflow is
hidden.

-- destinationLocation: If the background-image belongs to the root element, no
scroll offset to added to destinationLocation. For non-root element case,
FrameView::documentScrollOffsetRelativeToViewOrigin() should be used if no page
scaling is applied. Otherwise FrameView::scrollOffsetForFixedPosition() should be
used instead.

Tests: platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html

platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ensure
the geometry for the fixed-attached background-image is calculated correctly.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::updateGeometry): Ensure the background layer
gets the correct size for the fixedLayoutSize mode.

LayoutTests:

fixedLayoutSize background-image rendering for root and non-root elements.

  • platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html: Added.
  • platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html: Added.
  • platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html: Added.
  • platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r187114 r187116  
     12015-07-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
     4        https://bugs.webkit.org/show_bug.cgi?id=147049
     5        <rdar://problem/21110936>
     6
     7        Reviewed by Simon Fraser.
     8       
     9        fixedLayoutSize background-image rendering for root and non-root elements.
     10
     11        * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html: Added.
     12        * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html: Added.
     13        * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html: Added.
     14        * platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html: Added.
     15
    1162015-07-21  Sungmann Cho  <sungmann.cho@navercorp.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r187112 r187116  
     12015-07-21  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
     4        https://bugs.webkit.org/show_bug.cgi?id=147049
     5        <rdar://problem/21110936>
     6
     7        Reviewed by Simon Fraser.
     8
     9        The fixed-attached background-image rendering is special. In general, to
     10        display it, the destinationSize should be set to visibleContentSize. The
     11        destinationLocation should be set such that the background-image does
     12        not move with scrolling. The topContentInset should be subtracted from
     13        the destinationLocation such that background-image can be rendered blurred
     14        in the topContentArea. However there are cases in which these rules have to
     15        be changed.
     16       
     17        -- destinationSize: In the case of fixed layout size, the fixedLayoutSize
     18        is bigger than the visibleContentSize. In this case, if the background-image
     19        belongs to the root element, the destinationSize has to be set to fixedLayoutSize.
     20        Otherwise it has to be set to the borderBoxSize unless the overflow is
     21        hidden.
     22       
     23        -- destinationLocation: If the background-image belongs to the root element, no
     24        scroll offset to added to destinationLocation. For non-root element case,
     25        FrameView::documentScrollOffsetRelativeToViewOrigin() should be used if no page
     26        scaling is applied. Otherwise FrameView::scrollOffsetForFixedPosition() should be
     27        used instead.
     28       
     29        Tests: platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html
     30               platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html
     31
     32        * rendering/RenderBoxModelObject.cpp:
     33        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ensure
     34        the geometry for the fixed-attached background-image is calculated correctly.
     35       
     36        * rendering/RenderLayerBacking.cpp:
     37        (WebCore::RenderLayerBacking::updateGeometry): Ensure the background layer
     38        gets the correct size for the fixedLayoutSize mode.
     39
    1402015-07-21  Csaba Osztrogonác  <ossy@webkit.org>
    241
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r186391 r187116  
    11161116        else {
    11171117            FrameView& frameView = view().frameView();
    1118             viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
    1119             topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
    1120 
    1121             if (fixedBackgroundPaintsInLocalCoordinates())
    1122                 viewportRect.setLocation(LayoutPoint(0, -topContentInset));
    1123             else
     1118            bool useFixedLayout = frameView.useFixedLayout() && !frameView.fixedLayoutSize().isEmpty();
     1119
     1120            if (useFixedLayout) {
     1121                // Use the fixedLayoutSize() when useFixedLayout() because the rendering will scale
     1122                // down the frameView to to fit in the current viewport.
     1123                viewportRect.setSize(frameView.fixedLayoutSize());
     1124            } else
     1125                viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
     1126
     1127            if (fixedBackgroundPaintsInLocalCoordinates()) {
     1128                if (!useFixedLayout) {
     1129                    // Shifting location up by topContentInset is needed for layout tests which expect
     1130                    // layout to be shifted down when calling window.internals.setTopContentInset().
     1131                    topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
     1132                    viewportRect.setLocation(LayoutPoint(0, -topContentInset));
     1133                }
     1134            } else if (useFixedLayout || frameView.frameScaleFactor() != 1) {
     1135                // scrollOffsetForFixedPosition() is adjusted for page scale and it does not include
     1136                // topContentInset so do not add it to the calculation below.
     1137                viewportRect.setLocation(toLayoutPoint(frameView.scrollOffsetForFixedPosition()));
     1138            } else {
     1139                // documentScrollOffsetRelativeToViewOrigin() includes -topContentInset in its height
     1140                // so we need to account for that in calculating the phase size
     1141                topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
    11241142                viewportRect.setLocation(toLayoutPoint(frameView.documentScrollOffsetRelativeToViewOrigin()));
     1143            }
    11251144
    11261145            top += topContentInset;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r186968 r187116  
    926926            const FrameView& frameView = renderer().view().frameView();
    927927            backgroundPosition = toLayoutPoint(frameView.scrollOffsetForFixedPosition());
    928             backgroundSize = frameView.visibleContentRect().size();
     928            backgroundSize = frameView.layoutSize();
    929929        }
    930930        m_backgroundLayer->setPosition(backgroundPosition);
Note: See TracChangeset for help on using the changeset viewer.