Title: [187116] trunk
Revision
187116
Author
commit-qu...@webkit.org
Date
2015-07-21 12:56:24 -0700 (Tue, 21 Jul 2015)

Log 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 <sabouhall...@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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (187115 => 187116)


--- trunk/LayoutTests/ChangeLog	2015-07-21 19:54:23 UTC (rev 187115)
+++ trunk/LayoutTests/ChangeLog	2015-07-21 19:56:24 UTC (rev 187116)
@@ -1,3 +1,18 @@
+2015-07-21  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
+        https://bugs.webkit.org/show_bug.cgi?id=147049
+        <rdar://problem/21110936>
+
+        Reviewed by Simon Fraser.
+        
+        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.
+
 2015-07-21  Sungmann Cho  <sungmann....@navercorp.com>
 
         Make PluginProxy::handleMouseEvent() asynchronous.

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html (0 => 187116)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover-expected.html	2015-07-21 19:56:24 UTC (rev 187116)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<style>
+  body {
+    margin: 0;
+  }
+  .container {
+    height: 2000px;
+    overflow: hidden;
+    width: 50%;
+    height: 50%;
+    background-image: url('resources/green-blue.png');
+    background-attachment: fixed;
+    background-repeat: no-repeat;
+    background-size: 300px;
+  }
+</style>
+</head>
+<body>
+  <div class="container"></div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html (0 => 187116)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-cover.html	2015-07-21 19:56:24 UTC (rev 187116)
@@ -0,0 +1,27 @@
+<html>
+<head>
+<style>
+  body {
+    margin: 0;
+    height: 2000px;
+    overflow: hidden;
+    background: url('resources/green-blue.png') white;
+    background-attachment: fixed;
+    background-size: contain;
+    background-repeat: no-repeat;
+  }
+</style>
+<script>
+  function runTest() {
+    if (window.internals) {
+      window.internals.setFixedLayoutSize(800, 600);
+      window.internals.setPageScaleFactor(0.5, 0, 0);
+      window.internals.setUseFixedLayout(true);
+    }
+  }
+  window.addEventListener('load', runTest, false);
+</script>
+</head>
+<body>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html (0 => 187116)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local-expected.html	2015-07-21 19:56:24 UTC (rev 187116)
@@ -0,0 +1,22 @@
+<html>
+<head>
+<style>
+  body {
+    margin: 0;
+  }
+  .container {
+    height: 2000px;
+    overflow: hidden;
+    width: 50%;
+    height: 50%;
+    background-image: url('resources/green-blue.png');
+    background-attachment: fixed;
+    background-repeat: no-repeat;
+    background-size: 300px;
+  }
+</style>
+</head>
+<body>
+  <div class="container"></div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html (0 => 187116)


--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-layout-size-fixed-attachment-local.html	2015-07-21 19:56:24 UTC (rev 187116)
@@ -0,0 +1,30 @@
+<html>
+<head>
+  <style>
+    html {
+      background: white;
+    }
+    body {
+      margin: 0;
+      height: 2000px;
+      overflow: hidden;
+      background: url(resources/green-blue.png);
+      background-attachment: fixed;
+      background-size: contain;
+      background-repeat: no-repeat;
+    }
+  </style>
+  <script>
+  function runTest() {
+    if (window.internals) {
+      window.internals.setFixedLayoutSize(800, 600);
+      window.internals.setPageScaleFactor(0.5, 0, 0);
+      window.internals.setUseFixedLayout(true);
+    }
+  }
+  window.addEventListener('load', runTest, false);
+  </script>
+</head>
+<body>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (187115 => 187116)


--- trunk/Source/WebCore/ChangeLog	2015-07-21 19:54:23 UTC (rev 187115)
+++ trunk/Source/WebCore/ChangeLog	2015-07-21 19:56:24 UTC (rev 187116)
@@ -1,3 +1,42 @@
+2015-07-21  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        REGRESSION (r172417, r184065): Multiple rendering issues with fixed attached background-image
+        https://bugs.webkit.org/show_bug.cgi?id=147049
+        <rdar://problem/21110936>
+
+        Reviewed by Simon Fraser.
+
+        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.
+
 2015-07-21  Csaba Osztrogonác  <o...@webkit.org>
 
         Fix the !ENABLE(DETAILS_ELEMENT) build after r186598

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (187115 => 187116)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-07-21 19:54:23 UTC (rev 187115)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-07-21 19:56:24 UTC (rev 187116)
@@ -1115,13 +1115,32 @@
             viewportRect = view().unscaledDocumentRect();
         else {
             FrameView& frameView = view().frameView();
-            viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
-            topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
+            bool useFixedLayout = frameView.useFixedLayout() && !frameView.fixedLayoutSize().isEmpty();
 
-            if (fixedBackgroundPaintsInLocalCoordinates())
-                viewportRect.setLocation(LayoutPoint(0, -topContentInset));
-            else
+            if (useFixedLayout) {
+                // Use the fixedLayoutSize() when useFixedLayout() because the rendering will scale
+                // down the frameView to to fit in the current viewport.
+                viewportRect.setSize(frameView.fixedLayoutSize());
+            } else
+                viewportRect.setSize(frameView.unscaledVisibleContentSizeIncludingObscuredArea());
+
+            if (fixedBackgroundPaintsInLocalCoordinates()) {
+                if (!useFixedLayout) {
+                    // Shifting location up by topContentInset is needed for layout tests which expect
+                    // layout to be shifted down when calling window.internals.setTopContentInset().
+                    topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
+                    viewportRect.setLocation(LayoutPoint(0, -topContentInset));
+                }
+            } else if (useFixedLayout || frameView.frameScaleFactor() != 1) {
+                // scrollOffsetForFixedPosition() is adjusted for page scale and it does not include
+                // topContentInset so do not add it to the calculation below.
+                viewportRect.setLocation(toLayoutPoint(frameView.scrollOffsetForFixedPosition()));
+            } else {
+                // documentScrollOffsetRelativeToViewOrigin() includes -topContentInset in its height
+                // so we need to account for that in calculating the phase size
+                topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
                 viewportRect.setLocation(toLayoutPoint(frameView.documentScrollOffsetRelativeToViewOrigin()));
+            }
 
             top += topContentInset;
         }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (187115 => 187116)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-07-21 19:54:23 UTC (rev 187115)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-07-21 19:56:24 UTC (rev 187116)
@@ -925,7 +925,7 @@
         if (backgroundLayerPaintsFixedRootBackground()) {
             const FrameView& frameView = renderer().view().frameView();
             backgroundPosition = toLayoutPoint(frameView.scrollOffsetForFixedPosition());
-            backgroundSize = frameView.visibleContentRect().size();
+            backgroundSize = frameView.layoutSize();
         }
         m_backgroundLayer->setPosition(backgroundPosition);
         m_backgroundLayer->setSize(backgroundSize);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to