- Revision
- 163190
- Author
- [email protected]
- Date
- 2014-01-31 13:06:38 -0800 (Fri, 31 Jan 2014)
Log Message
Extended background should only create margin tiles for pages with background
images
https://bugs.webkit.org/show_bug.cgi?id=127876
-and corresponding-
<rdar://problem/15827632>
Reviewed by Simon Fraser.
Source/WebCore:
Settings::backgroundShouldExtendBeyondPage() doesn't need to create margin tiles
for pages with simple background colors. Instead, those pages should achieve the
same effect by setting a background color on RenderLayerCompositor's
m_layerForOverhangAreas. For now, we should only create tiles when there is a
background image. We may want to extend this to other types of complicated
backgrounds in the future.
This patch makes callers that only care about the value of the setting always call
Settings::backgroundShouldExtendBeyondPage() rather than asking about margin
tiles. And callers that want to know about margin tiles can either keep querying
that directly or they can call FrameView::hasExtendedBackgroundRectForPainting().
An extended background does not necessarily require an extended background rect
for painting, and this new FrameView function can make that distinction.
When setBackgroundExtendsBeyondPage() is called, call RenderLayerCompositor::
setRootExtendedBackgroundColor() with either the document background color, or an
invalid color, depending on whether you have or do not have an extended
background. Also call needsExtendedBackgroundRectForPainting() to determine if we
also need to extend the background rect, and then call
setHasExtendedBackgroundRectForPainting() with its value.
* page/FrameView.cpp:
(WebCore::FrameView::setBackgroundExtendsBeyondPage):
(WebCore::FrameView::hasExtendedBackgroundRectForPainting):
Right now we only need to extend the background rect for documents with
background images on the root. This may be extended in the future.
(WebCore::FrameView::needsExtendedBackgroundRectForPainting):
(WebCore::FrameView::setHasExtendedBackgroundRectForPainting):
(WebCore::FrameView::extendedBackgroundRectForPainting):
* page/FrameView.h:
Expose defaultTileWidth and defaultTileHeight from TiledBacking.h so that we can
access the values from RenderLayerBacking.
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/mac/TileController.mm:
hasExtendedBackgroundForPainting() is now called
hasExtendedBackgroundRectForPainting() to distinguish
the case where an extended RECT is needed.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::repaintLayerRectsForImage):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
Call setHasExtendedBackgroundRectForPainting() if relevant.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
Don't call setTiledBackingHasMargins() right in the constructor because we only
want margins if we have a background image, and we won't have that information
yet.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
Clean up the variable name here. We are only setting margins when we need to
extend the background rect for painting. Also make us of newly-exposed
defaultTileWidth and Height.
(WebCore::RenderLayerBacking::setTiledBackingHasMargins):
Remove RenderLayerBacking::tiledBackingHasMargin() since there aren't any more
callers.
* rendering/RenderLayerBacking.h:
(WebCore::RenderLayerBacking::usingTiledBacking):
setMasksToBounds(false) based on the Setting, and not based on whether there are
tile margins.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):
Return false from RenderLayerCompositor::requiresContentShadowLayer() if there is
an extended background.
(WebCore::RenderLayerCompositor::requiresContentShadowLayer):
Setting the background color on m_layerForOverhangAreas is all we need to do to
create the extended background effect on pages that only have background colors.
(WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
Remove mainFrameBackingIsTiledWithMargin() since there aren't any more callers,
and add setRootExtendedBackgroundColor() so that we can update the color from
RenderView.
* rendering/RenderLayerCompositor.h:
Revert the code that was added to paint background color here, since this should
all be covered by calling RenderLayerCompositor::setExtendedBackgroundColor().
More complicated backgrounds will run through the full background painting code.
* rendering/RenderView.cpp:
(WebCore::RenderView::paintBoxDecorations):
(WebCore::RenderView::backgroundRect):
LayoutTests:
We can only test margin tiles if we also give the document a background image.
* platform/mac-wk2/tiled-drawing/resources/greenbox.png: Added.
* platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (163189 => 163190)
--- trunk/LayoutTests/ChangeLog 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/LayoutTests/ChangeLog 2014-01-31 21:06:38 UTC (rev 163190)
@@ -1,3 +1,17 @@
+2014-01-30 Beth Dakin <[email protected]>
+
+ Extended background should only create margin tiles for pages with background
+ images
+ https://bugs.webkit.org/show_bug.cgi?id=127876
+ -and corresponding-
+ <rdar://problem/15827632>
+
+ Reviewed by Simon Fraser.
+
+ We can only test margin tiles if we also give the document a background image.
+ * platform/mac-wk2/tiled-drawing/resources/greenbox.png: Added.
+ * platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html:
+
2014-01-31 Hans Muller <[email protected]>
[CSS Shapes] Image valued shape can fail
Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/resources/greenbox.png
(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/resources/greenbox.png
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html (163189 => 163190)
--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html 2014-01-31 21:06:38 UTC (rev 163190)
@@ -6,18 +6,20 @@
body {
width: 1200px;
height: 2000px;
+ /* The setBackgroundShouldExtendBeyondPage setting will only create margin tiles for documents
+ that have background images. */
+ background-image:url(resources/greenbox.png);
+ background-repeat:repeat;
}
</style>
<script>
if (window.testRunner)
testRunner.dumpAsText();
-
- if (window.internals)
- window.internals.settings.setBackgroundShouldExtendBeyondPage(true);
function doTest()
{
if (window.internals) {
+ window.internals.settings.setBackgroundShouldExtendBeyondPage(true);
document.getElementById('layers').innerText = internals.layerTreeAsText(document,
internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
}
@@ -25,6 +27,7 @@
window.addEventListener('load', doTest, false);
</script>
</head>
+
<body>
<pre id="layers">Layer tree goes here</p>
</body>
Modified: trunk/Source/WebCore/ChangeLog (163189 => 163190)
--- trunk/Source/WebCore/ChangeLog 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/ChangeLog 2014-01-31 21:06:38 UTC (rev 163190)
@@ -1,3 +1,103 @@
+2014-01-31 Beth Dakin <[email protected]>
+
+ Extended background should only create margin tiles for pages with background
+ images
+ https://bugs.webkit.org/show_bug.cgi?id=127876
+ -and corresponding-
+ <rdar://problem/15827632>
+
+ Reviewed by Simon Fraser.
+
+ Settings::backgroundShouldExtendBeyondPage() doesn't need to create margin tiles
+ for pages with simple background colors. Instead, those pages should achieve the
+ same effect by setting a background color on RenderLayerCompositor's
+ m_layerForOverhangAreas. For now, we should only create tiles when there is a
+ background image. We may want to extend this to other types of complicated
+ backgrounds in the future.
+
+ This patch makes callers that only care about the value of the setting always call
+ Settings::backgroundShouldExtendBeyondPage() rather than asking about margin
+ tiles. And callers that want to know about margin tiles can either keep querying
+ that directly or they can call FrameView::hasExtendedBackgroundRectForPainting().
+ An extended background does not necessarily require an extended background rect
+ for painting, and this new FrameView function can make that distinction.
+
+ When setBackgroundExtendsBeyondPage() is called, call RenderLayerCompositor::
+ setRootExtendedBackgroundColor() with either the document background color, or an
+ invalid color, depending on whether you have or do not have an extended
+ background. Also call needsExtendedBackgroundRectForPainting() to determine if we
+ also need to extend the background rect, and then call
+ setHasExtendedBackgroundRectForPainting() with its value.
+ * page/FrameView.cpp:
+ (WebCore::FrameView::setBackgroundExtendsBeyondPage):
+ (WebCore::FrameView::hasExtendedBackgroundRectForPainting):
+
+ Right now we only need to extend the background rect for documents with
+ background images on the root. This may be extended in the future.
+ (WebCore::FrameView::needsExtendedBackgroundRectForPainting):
+ (WebCore::FrameView::setHasExtendedBackgroundRectForPainting):
+ (WebCore::FrameView::extendedBackgroundRectForPainting):
+ * page/FrameView.h:
+
+ Expose defaultTileWidth and defaultTileHeight from TiledBacking.h so that we can
+ access the values from RenderLayerBacking.
+ * platform/graphics/TiledBacking.h:
+ * platform/graphics/ca/mac/TileController.mm:
+
+ hasExtendedBackgroundForPainting() is now called
+ hasExtendedBackgroundRectForPainting() to distinguish
+ the case where an extended RECT is needed.
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::repaintLayerRectsForImage):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+
+ Call setHasExtendedBackgroundRectForPainting() if relevant.
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::styleWillChange):
+
+ Don't call setTiledBackingHasMargins() right in the constructor because we only
+ want margins if we have a background image, and we won't have that information
+ yet.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::RenderLayerBacking):
+
+ Clean up the variable name here. We are only setting margins when we need to
+ extend the background rect for painting. Also make us of newly-exposed
+ defaultTileWidth and Height.
+ (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
+
+ Remove RenderLayerBacking::tiledBackingHasMargin() since there aren't any more
+ callers.
+ * rendering/RenderLayerBacking.h:
+ (WebCore::RenderLayerBacking::usingTiledBacking):
+
+ setMasksToBounds(false) based on the Setting, and not based on whether there are
+ tile margins.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateBacking):
+
+ Return false from RenderLayerCompositor::requiresContentShadowLayer() if there is
+ an extended background.
+ (WebCore::RenderLayerCompositor::requiresContentShadowLayer):
+
+ Setting the background color on m_layerForOverhangAreas is all we need to do to
+ create the extended background effect on pages that only have background colors.
+ (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
+ (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+
+ Remove mainFrameBackingIsTiledWithMargin() since there aren't any more callers,
+ and add setRootExtendedBackgroundColor() so that we can update the color from
+ RenderView.
+ * rendering/RenderLayerCompositor.h:
+
+ Revert the code that was added to paint background color here, since this should
+ all be covered by calling RenderLayerCompositor::setExtendedBackgroundColor().
+ More complicated backgrounds will run through the full background painting code.
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::paintBoxDecorations):
+ (WebCore::RenderView::backgroundRect):
+
2014-01-31 Jochen Eisinger <[email protected]>
Remove FrameLoader's reloadWithOverrideURL and reloadWithRequest
Modified: trunk/Source/WebCore/page/FrameView.cpp (163189 => 163190)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -2447,8 +2447,18 @@
}
}
-bool FrameView::hasExtendedBackground() const
+void FrameView::setBackgroundExtendsBeyondPage(bool extendBackground)
{
+ RenderView* renderView = this->renderView();
+ if (!renderView)
+ return;
+
+ renderView->compositor().setRootExtendedBackgroundColor(extendBackground ? documentBackgroundColor() : Color());
+ setHasExtendedBackgroundRectForPainting(needsExtendedBackgroundRectForPainting());
+}
+
+bool FrameView::hasExtendedBackgroundRectForPainting() const
+{
if (!frame().settings().backgroundShouldExtendBeyondPage())
return false;
@@ -2459,17 +2469,39 @@
return tiledBacking->hasMargins();
}
-IntRect FrameView::extendedBackgroundRect() const
+bool FrameView::needsExtendedBackgroundRectForPainting() const
{
- TiledBacking* tiledBacking = this->tiledBacking();
- if (!tiledBacking)
- return IntRect();
+ // Just because Settings::backgroundShouldExtendBeyondPage() is true does not necessarily mean
+ // that the background rect needs to be extended for painting. Simple backgrounds can be extended
+ // just with RenderLayerCompositor::setRootExtendedBackgroundColor(). More complicated backgrounds,
+ // such as images, require extending the background rect to continue painting into the extended
+ // region. This function finds out if it is necessary to extend the background rect for painting.
- return tiledBacking->bounds();
+ if (!frame().settings().backgroundShouldExtendBeyondPage())
+ return false;
+
+ if (!frame().isMainFrame())
+ return false;
+
+ Document* document = frame().document();
+ if (!document)
+ return false;
+
+ auto documentElement = document->documentElement();
+ auto bodyElement = document->body();
+ auto documentElementRenderer = documentElement ? documentElement->renderer() : nullptr;
+ auto bodyRenderer = bodyElement ? bodyElement->renderer() : nullptr;
+ bool rootBackgroundHasImage = (documentElementRenderer && documentElementRenderer->style().hasBackgroundImage())
+ || (bodyRenderer && bodyRenderer->style().hasBackgroundImage());
+
+ return rootBackgroundHasImage;
}
-void FrameView::setBackgroundExtendsBeyondPage(bool extendBackground)
+void FrameView::setHasExtendedBackgroundRectForPainting(bool shouldHaveExtendedBackgroundRect)
{
+ if (shouldHaveExtendedBackgroundRect == hasExtendedBackgroundRectForPainting())
+ return;
+
RenderView* renderView = this->renderView();
if (!renderView)
return;
@@ -2478,9 +2510,18 @@
if (!backing)
return;
- backing->setTiledBackingHasMargins(extendBackground);
+ backing->setTiledBackingHasMargins(frame().settings().backgroundShouldExtendBeyondPage() && shouldHaveExtendedBackgroundRect);
}
+IntRect FrameView::extendedBackgroundRectForPainting() const
+{
+ TiledBacking* tiledBacking = this->tiledBacking();
+ if (!tiledBacking)
+ return IntRect();
+
+ return tiledBacking->bounds();
+}
+
bool FrameView::shouldUpdateWhileOffscreen() const
{
return m_shouldUpdateWhileOffscreen;
Modified: trunk/Source/WebCore/page/FrameView.h (163189 => 163190)
--- trunk/Source/WebCore/page/FrameView.h 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/page/FrameView.h 2014-01-31 21:06:38 UTC (rev 163190)
@@ -191,11 +191,18 @@
void setBaseBackgroundColor(const Color&);
void updateBackgroundRecursively(const Color&, bool);
- // extendedBackgroundRect() is in the viewport's coordinate space.
- bool hasExtendedBackground() const;
- IntRect extendedBackgroundRect() const;
-
+ // setBackgroundExtendsBeyondPage() is controlled by Settings::setBackgroundShouldExtendBeyondPage(). Some
+ // extended backgrounds require an extended background rect for painting, (at this time, that corresponds
+ // to documents with background images) and needsExtendedBackgroundRectForPainting() determines if this
+ // FrameView is one of those special FrameViews that does require an extended rect for painting. Since
+ // needing an extended background rect for painting is something that can change in the course of a FrameView's
+ // life, the extended rect is set and unset using setHasExtendedBackgroundRectForPainting(). The
+ // extendedBackgroundRectForPainting() is in the viewport's coordinate space.
void setBackgroundExtendsBeyondPage(bool);
+ bool needsExtendedBackgroundRectForPainting() const;
+ void setHasExtendedBackgroundRectForPainting(bool shouldHaveExtendedBackgroundRect);
+ bool hasExtendedBackgroundRectForPainting() const;
+ IntRect extendedBackgroundRectForPainting() const;
bool shouldUpdateWhileOffscreen() const;
void setShouldUpdateWhileOffscreen(bool);
Modified: trunk/Source/WebCore/platform/graphics/TiledBacking.h (163189 => 163190)
--- trunk/Source/WebCore/platform/graphics/TiledBacking.h 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h 2014-01-31 21:06:38 UTC (rev 163190)
@@ -28,6 +28,9 @@
namespace WebCore {
+static const int defaultTileWidth = 512;
+static const int defaultTileHeight = 512;
+
class IntRect;
#if PLATFORM(MAC)
class PlatformCALayer;
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (163189 => 163190)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm 2014-01-31 21:06:38 UTC (rev 163190)
@@ -47,9 +47,6 @@
UnparentAllTiles = 1 << 1
};
-static const int defaultTileWidth = 512;
-static const int defaultTileHeight = 512;
-
PassOwnPtr<TileController> TileController::create(PlatformCALayer* rootPlatformLayer)
{
return adoptPtr(new TileController(rootPlatformLayer));
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -1608,9 +1608,9 @@
// If this is the root background layer, we may need to extend the repaintRect if the FrameView has an
// extendedBackground. We should only extend the rect if it is already extending the full width or height
// of the rendererRect.
- if (drawingRootBackground && view().frameView().hasExtendedBackground()) {
+ if (drawingRootBackground && view().frameView().hasExtendedBackgroundRectForPainting()) {
shouldClipToLayer = false;
- IntRect extendedBackgroundRect = view().frameView().extendedBackgroundRect();
+ IntRect extendedBackgroundRect = view().frameView().extendedBackgroundRectForPainting();
if (rectToRepaint.width() == rendererRect.width()) {
rectToRepaint.move(extendedBackgroundRect.x(), 0);
rectToRepaint.setWidth(extendedBackgroundRect.width());
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -1094,8 +1094,8 @@
// the background positioning area.
if (isRoot()) {
positioningAreaSize = pixelSnappedIntSize(toRenderBox(this)->size() - LayoutSize(left + right, top + bottom), toRenderBox(this)->location());
- if (view().frameView().hasExtendedBackground()) {
- IntRect extendedBackgroundRect = view().frameView().extendedBackgroundRect();
+ if (view().frameView().hasExtendedBackgroundRectForPainting()) {
+ IntRect extendedBackgroundRect = view().frameView().extendedBackgroundRectForPainting();
left += (marginLeft() - extendedBackgroundRect.x());
top += (marginTop() - extendedBackgroundRect.y());
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -897,6 +897,12 @@
if (newStyleSlowScroll)
view().frameView().addSlowRepaintObject(this);
}
+
+ if (isRoot() || isBody()) {
+ bool needsExtendedBackground = view().frameView().needsExtendedBackgroundRectForPainting();
+ if (view().frameView().hasExtendedBackgroundRectForPainting() != needsExtendedBackground)
+ view().frameView().setHasExtendedBackgroundRectForPainting(needsExtendedBackground);
+ }
}
#if !PLATFORM(IOS)
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -138,7 +138,6 @@
if (m_isMainFrameRenderViewLayer) {
tiledBacking->setExposedRect(renderer().frame().view()->exposedRect());
tiledBacking->setUnparentsOffscreenTiles(true);
- setTiledBackingHasMargins(page->settings().backgroundShouldExtendBeyondPage());
}
tiledBacking->setScrollingPerformanceLoggingEnabled(page->settings().scrollingPerformanceLoggingEnabled());
@@ -192,11 +191,6 @@
return m_usingTiledCacheLayer && m_creatingPrimaryGraphicsLayer;
}
-bool RenderLayerBacking::tiledBackingHasMargin() const
-{
- return m_usingTiledCacheLayer && tiledBacking()->hasMargins();
-}
-
void RenderLayerBacking::tiledBackingUsageChanged(const GraphicsLayer* layer, bool usingTiledBacking)
{
compositor().layerTiledBackingUsageChanged(layer, usingTiledBacking);
@@ -240,13 +234,14 @@
tiledBacking()->setTileCoverage(tileCoverage);
}
-void RenderLayerBacking::setTiledBackingHasMargins(bool extendBackground)
+void RenderLayerBacking::setTiledBackingHasMargins(bool hasExtendedBackgroundRect)
{
if (!m_usingTiledCacheLayer)
return;
- int marginSize = extendBackground ? 512 : 0;
- tiledBacking()->setTileMargins(marginSize, marginSize, marginSize, marginSize);
+ int marginLeftAndRightSize = hasExtendedBackgroundRect ? defaultTileWidth : 0;
+ int marginTopAndBottomSize = hasExtendedBackgroundRect ? defaultTileHeight : 0;
+ tiledBacking()->setTileMargins(marginTopAndBottomSize, marginTopAndBottomSize, marginLeftAndRightSize, marginLeftAndRightSize);
}
void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaintCounter)
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2014-01-31 21:06:38 UTC (rev 163190)
@@ -152,7 +152,6 @@
bool hasUnpositionedOverflowControlsLayers() const;
bool usingTiledBacking() const { return m_usingTiledCacheLayer; }
- bool tiledBackingHasMargin() const;
TiledBacking* tiledBacking() const;
void adjustTiledBackingCoverage();
void setTiledBackingHasMargins(bool);
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -789,7 +789,7 @@
updateLayerForFooter(page->footerHeight());
}
#endif
- if (mainFrameBackingIsTiledWithMargin())
+ if (m_renderView.frameView().frame().settings().backgroundShouldExtendBeyondPage())
m_rootContentLayer->setMasksToBounds(false);
}
@@ -2736,19 +2736,6 @@
return backing->usingTiledBacking();
}
-bool RenderLayerCompositor::mainFrameBackingIsTiledWithMargin() const
-{
- RenderLayer* layer = m_renderView.layer();
- if (!layer)
- return false;
-
- RenderLayerBacking* backing = layer->backing();
- if (!backing)
- return false;
-
- return backing->tiledBackingHasMargin();
-}
-
bool RenderLayerCompositor::shouldCompositeOverflowControls() const
{
FrameView& frameView = m_renderView.frameView();
@@ -2807,6 +2794,10 @@
if (viewHasTransparentBackground())
return false;
+ // If the background is going to extend, then it doesn't make sense to have a shadow layer.
+ if (m_renderView.frameView().frame().settings().backgroundShouldExtendBeyondPage())
+ return false;
+
// On Mac, we want a content shadow layer if we're using tiled drawing and can scroll.
if (mainFrameBackingIsTiled() && !m_renderView.frameView().prohibitsScrolling())
return true;
@@ -2963,6 +2954,19 @@
return documentBackgroundColor.hasAlpha();
}
+void RenderLayerCompositor::setRootExtendedBackgroundColor(const Color& color)
+{
+#if ENABLE(RUBBER_BANDING)
+ if (!m_layerForOverhangAreas)
+ return;
+
+ m_layerForOverhangAreas->setBackgroundColor(color);
+
+ if (!color.isValid())
+ m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
+#endif
+}
+
void RenderLayerCompositor::updateOverflowControlsLayers()
{
#if ENABLE(RUBBER_BANDING)
@@ -2974,8 +2978,12 @@
#endif
m_layerForOverhangAreas->setDrawsContent(false);
m_layerForOverhangAreas->setSize(m_renderView.frameView().frameRect().size());
- m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
+ if (m_renderView.frameView().frame().settings().backgroundShouldExtendBeyondPage())
+ m_layerForOverhangAreas->setBackgroundColor(m_renderView.frameView().documentBackgroundColor());
+ else
+ m_layerForOverhangAreas->setCustomAppearance(GraphicsLayer::ScrollingOverhang);
+
// We want the overhang areas layer to be positioned below the frame contents,
// so insert it below the clip layer.
m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.get(), m_clipLayer.get());
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-01-31 21:06:38 UTC (rev 163190)
@@ -299,7 +299,7 @@
void didPaintBacking(RenderLayerBacking*);
- bool mainFrameBackingIsTiledWithMargin() const;
+ void setRootExtendedBackgroundColor(const Color&);
private:
class OverlapMap;
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (163189 => 163190)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2014-01-31 21:03:52 UTC (rev 163189)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2014-01-31 21:06:38 UTC (rev 163190)
@@ -44,6 +44,7 @@
#include "RenderNamedFlowThread.h"
#include "RenderSelectionInfo.h"
#include "RenderWidget.h"
+#include "Settings.h"
#include "StyleInheritedData.h"
#include "TransformState.h"
#include <wtf/StackStats.h>
@@ -554,14 +555,14 @@
rootObscuresBackground = rendererObscuresBackground(rootRenderer);
}
- bool hasTiledMargin = false;
- hasTiledMargin = compositor().mainFrameBackingIsTiledWithMargin();
+ compositor().setRootExtendedBackgroundColor(frameView().frame().settings().backgroundShouldExtendBeyondPage()
+ ? frameView().documentBackgroundColor() : Color());
Page* page = document().page();
float pageScaleFactor = page ? page->pageScaleFactor() : 1;
// If painting will entirely fill the view, no need to fill the background.
- if (!hasTiledMargin && rootFillsViewport && rootObscuresBackground && pageScaleFactor >= 1)
+ if (rootFillsViewport && rootObscuresBackground && pageScaleFactor >= 1)
return;
// This code typically only executes if the root element's visibility has been set to hidden,
@@ -571,7 +572,7 @@
if (frameView().isTransparent()) // FIXME: This needs to be dynamic. We should be able to go back to blitting if we ever stop being transparent.
frameView().setCannotBlitToWindow(); // The parent must show behind the child.
else {
- Color backgroundColor = hasTiledMargin ? frameView().documentBackgroundColor() : frameView().baseBackgroundColor();
+ Color backgroundColor = frameView().baseBackgroundColor();
if (backgroundColor.alpha()) {
CompositeOperator previousOperator = paintInfo.context->compositeOperation();
paintInfo.context->setCompositeOperation(CompositeCopy);
@@ -1035,7 +1036,7 @@
LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const
{
if (!hasColumns())
- return frameView().hasExtendedBackground() ? frameView().extendedBackgroundRect() : unscaledDocumentRect();
+ return frameView().hasExtendedBackgroundRectForPainting() ? frameView().extendedBackgroundRectForPainting() : unscaledDocumentRect();
ColumnInfo* columnInfo = this->columnInfo();
LayoutRect backgroundRect(0, 0, columnInfo->desiredColumnWidth(), columnInfo->columnHeight() * columnInfo->columnCount());