Need a way to test the tile cache with margins enabled
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jan 2014 00:05:59 +0000 (00:05 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 18 Jan 2014 00:05:59 +0000 (00:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127194
-and corresponding-
<rdar://problem/15571327>

Reviewed by Tim Horton.

Source/WebCore:

This patch adds a new function to InternalSettings that will allow layout tests to
flip the setting Settings::setBackgroundShouldExtendBeyondPage(). This patch also
makes changing that setting take effect immediately.

To make this setting dynamic, we can no longer generate the Setting function, so
we have to export the symbol manually.
* WebCore.exp.in:

This new function on FrameView will call into RenderLayerBacking to add or remove
margins.
* page/FrameView.cpp:
(WebCore::FrameView::setBackgroundExtendsBeyondPage):
* page/FrameView.h:

Again, we’re no longer using the boiler-plate generated Setting functions, so now
we can call into FrameView to make the background extend.
* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setBackgroundShouldExtendBeyondPage):
* page/Settings.h:
(WebCore::Settings::backgroundShouldExtendBeyondPage):
* page/Settings.in:

Whenever tile margins are set, call setNeedsRevalidateTiles() to make the change
dynamic.
* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::setTileMargins):

Move the call to TiledBacking::setTileMargins() into a helper function so that the
same code can be used for FrameView.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
(WebCore::RenderLayerBacking::setTiledBackingHasMargins):
* rendering/RenderLayerBacking.h:

New InternalSetting.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setBackgroundShouldExtendBeyondPage):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebKit:

Attempt to keep Windows building.

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

LayoutTests:

* platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162230 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/page/Settings.in
Source/WebCore/platform/graphics/ca/mac/TileController.mm
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerBacking.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in

index 7f25e8a..991e347 100644 (file)
@@ -1,3 +1,15 @@
+2014-01-17  Beth Dakin  <bdakin@apple.com>
+
+        Need a way to test the tile cache with margins enabled
+        https://bugs.webkit.org/show_bug.cgi?id=127194
+        -and corresponding-
+        <rdar://problem/15571327>
+
+        Reviewed by Tim Horton.
+
+        * platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles-expected.txt: Added.
+        * platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html: Added.
+
 2014-01-17  Bem Jones-Bey  <bjonesbe@adobe.com>
 
         [CSS Shapes] Stacked floats with shape-outside should allow inline content to interact with the non-outermost float
diff --git a/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles-expected.txt b/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles-expected.txt
new file mode 100644 (file)
index 0000000..faa7c09
--- /dev/null
@@ -0,0 +1,17 @@
+(GraphicsLayer
+  (bounds 1208.00 2021.00)
+  (visible rect 0.00, 0.00 785.00 x 585.00)
+  (contentsScale 1.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 1208.00 2021.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 785.00 x 585.00)
+      (contentsScale 1.00)
+      (tile cache coverage -512, -512 2048 x 2048)
+      (tile size 512 x 512)
+      (top left tile -1, -1 tiles grid 4 x 4)
+    )
+  )
+)
+
diff --git a/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html b/LayoutTests/platform/mac-wk2/tiled-drawing/simple-document-with-margin-tiles.html
new file mode 100644 (file)
index 0000000..0360de0
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            width: 1200px;
+            height: 2000px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+        
+        if (window.internals)
+            window.internals.settings.setBackgroundShouldExtendBeyondPage(true);
+
+        function doTest()
+        {
+            if (window.internals) {
+                document.getElementById('layers').innerText = internals.layerTreeAsText(document,
+                    internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+            }
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>
index 4563507..73579c0 100644 (file)
@@ -1,3 +1,53 @@
+2014-01-17  Beth Dakin  <bdakin@apple.com>
+
+        Need a way to test the tile cache with margins enabled
+        https://bugs.webkit.org/show_bug.cgi?id=127194
+        -and corresponding-
+        <rdar://problem/15571327>
+
+        Reviewed by Tim Horton.
+
+        This patch adds a new function to InternalSettings that will allow layout tests to 
+        flip the setting Settings::setBackgroundShouldExtendBeyondPage(). This patch also         
+        makes changing that setting take effect immediately. 
+
+        To make this setting dynamic, we can no longer generate the Setting function, so 
+        we have to export the symbol manually.
+        * WebCore.exp.in:
+
+        This new function on FrameView will call into RenderLayerBacking to add or remove 
+        margins.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setBackgroundExtendsBeyondPage):
+        * page/FrameView.h:
+
+        Again, we’re no longer using the boiler-plate generated Setting functions, so now 
+        we can call into FrameView to make the background extend.
+        * page/Settings.cpp:
+        (WebCore::Settings::Settings):
+        (WebCore::Settings::setBackgroundShouldExtendBeyondPage):
+        * page/Settings.h:
+        (WebCore::Settings::backgroundShouldExtendBeyondPage):
+        * page/Settings.in:
+
+        Whenever tile margins are set, call setNeedsRevalidateTiles() to make the change 
+        dynamic.
+        * platform/graphics/ca/mac/TileController.mm:
+        (WebCore::TileController::setTileMargins):
+
+        Move the call to TiledBacking::setTileMargins() into a helper function so that the 
+        same code can be used for FrameView.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::RenderLayerBacking):
+        (WebCore::RenderLayerBacking::setTiledBackingHasMargins):
+        * rendering/RenderLayerBacking.h:
+
+        New InternalSetting.
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::setBackgroundShouldExtendBeyondPage):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2014-01-17  Anders Carlsson  <andersca@apple.com>
 
         Remove another unused FrameLoaderClient callback
index c38f918..fd5d40f 100644 (file)
@@ -1229,6 +1229,7 @@ __ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
 __ZN7WebCore8Settings32setScreenFontSubstitutionEnabledEb
 __ZN7WebCore8Settings33setAggressiveTileRetentionEnabledEb
 __ZN7WebCore8Settings33setFontFallbackPrefersPictographsEb
+__ZN7WebCore8Settings35setBackgroundShouldExtendBeyondPageEb
 __ZN7WebCore8Settings37setScrollingPerformanceLoggingEnabledEb
 __ZN7WebCore8Settings38setLowPowerVideoAudioBufferSizeEnabledEb
 __ZN7WebCore8Settings38setSimpleLineLayoutDebugBordersEnabledEb
index c3a6a35..7678988 100644 (file)
@@ -2678,6 +2678,21 @@ IntRect FrameView::extendedBackgroundRect() const
 #endif
 }
 
+#if USE(ACCELERATED_COMPOSITING)
+void FrameView::setBackgroundExtendsBeyondPage(bool extendBackground)
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return;
+
+    RenderLayerBacking* backing = renderView->layer()->backing();
+    if (!backing)
+        return;
+
+    backing->setTiledBackingHasMargins(extendBackground);
+}
+#endif
+
 bool FrameView::shouldUpdateWhileOffscreen() const
 {
     return m_shouldUpdateWhileOffscreen;
index 99685ce..e0a1c84 100644 (file)
@@ -196,6 +196,10 @@ public:
     // extendedBackgroundRect() is in the viewport's coordinate space. 
     bool hasExtendedBackground() const;
     IntRect extendedBackgroundRect() const;
+    
+#if USE(ACCELERATED_COMPOSITING)
+    void setBackgroundExtendsBeyondPage(bool);
+#endif
 
     bool shouldUpdateWhileOffscreen() const;
     void setShouldUpdateWhileOffscreen(bool);
index e756655..96b0793 100644 (file)
@@ -192,6 +192,7 @@ Settings::Settings(Page* page)
 #endif
     , m_showTiledScrollingIndicator(false)
     , m_tiledBackingStoreEnabled(false)
+    , m_backgroundShouldExtendBeyondPage(false)
     , m_dnsPrefetchingEnabled(false)
 #if ENABLE(TOUCH_EVENTS)
     , m_touchEventEmulationEnabled(false)
@@ -596,6 +597,18 @@ void Settings::setTiledBackingStoreEnabled(bool enabled)
 #endif
 }
 
+void Settings::setBackgroundShouldExtendBeyondPage(bool shouldExtend)
+{
+    if (m_backgroundShouldExtendBeyondPage == shouldExtend)
+        return;
+
+    m_backgroundShouldExtendBeyondPage = shouldExtend;
+
+#if USE(ACCELERATED_COMPOSITING)
+    m_page->mainFrame().view()->setBackgroundExtendsBeyondPage(shouldExtend);
+#endif
+}
+
 #if USE(AVFOUNDATION)
 void Settings::setAVFoundationEnabled(bool enabled)
 {
index 96205fd..cabb0a5 100644 (file)
@@ -235,6 +235,9 @@ public:
     void setTiledBackingStoreEnabled(bool);
     bool tiledBackingStoreEnabled() const { return m_tiledBackingStoreEnabled; }
 
+    void setBackgroundShouldExtendBeyondPage(bool);
+    bool backgroundShouldExtendBeyondPage() const { return m_backgroundShouldExtendBeyondPage; }
+
 #if USE(AVFOUNDATION)
     static void setAVFoundationEnabled(bool flag);
     static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
@@ -357,6 +360,7 @@ private:
 #endif
     bool m_showTiledScrollingIndicator : 1;
     bool m_tiledBackingStoreEnabled : 1;
+    bool m_backgroundShouldExtendBeyondPage : 1;
     bool m_dnsPrefetchingEnabled : 1;
 
 #if ENABLE(TOUCH_EVENTS)
index a37417c..6766d76 100644 (file)
@@ -211,7 +211,6 @@ minimumZoomFontSize type=float, initial=15, conditional=IOS_TEXT_AUTOSIZING
 simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
 simpleLineLayoutDebugBordersEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
 
-backgroundShouldExtendBeyondPage initial=false
 mediaSourceEnabled initial=false
 
 # FIXME: Rename to allowMultiElementImplicitFormSubmission once we upstream the iOS changes to WebView.mm.
index d00880d..3091a4c 100644 (file)
@@ -1067,6 +1067,8 @@ void TileController::setTileMargins(int marginTop, int marginBottom, int marginL
     m_marginBottom = marginBottom;
     m_marginLeft = marginLeft;
     m_marginRight = marginRight;
+
+    setNeedsRevalidateTiles();
 }
 
 bool TileController::hasMargins() const
index c1f8c24..e5e37c5 100644 (file)
@@ -144,8 +144,7 @@ RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
         if (m_isMainFrameRenderViewLayer) {
             tiledBacking->setExposedRect(renderer().frame().view()->exposedRect());
             tiledBacking->setUnparentsOffscreenTiles(true);
-            if (page->settings().backgroundShouldExtendBeyondPage())
-                tiledBacking->setTileMargins(512, 512, 512, 512);
+            setTiledBackingHasMargins(page->settings().backgroundShouldExtendBeyondPage());
         }
 
         tiledBacking->setScrollingPerformanceLoggingEnabled(page->settings().scrollingPerformanceLoggingEnabled());
@@ -254,6 +253,15 @@ void RenderLayerBacking::adjustTiledBackingCoverage()
     tiledBacking()->setTileCoverage(tileCoverage);
 }
 
+void RenderLayerBacking::setTiledBackingHasMargins(bool extendBackground)
+{
+    if (!m_usingTiledCacheLayer)
+        return;
+
+    int marginSize = extendBackground ? 512 : 0;
+    tiledBacking()->setTileMargins(marginSize, marginSize, marginSize, marginSize);
+}
+
 void RenderLayerBacking::updateDebugIndicators(bool showBorder, bool showRepaintCounter)
 {
     m_graphicsLayer->setShowDebugBorder(showBorder);
index 31f920e..9645e05 100644 (file)
@@ -157,6 +157,7 @@ public:
     bool tiledBackingHasMargin() const;
     TiledBacking* tiledBacking() const;
     void adjustTiledBackingCoverage();
+    void setTiledBackingHasMargins(bool);
     
     void updateDebugIndicators(bool showBorder, bool showRepaintCounter);
 
index d71590b..dc7da1e 100644 (file)
@@ -521,4 +521,10 @@ void InternalSettings::setPluginReplacementEnabled(bool enabled)
     RuntimeEnabledFeatures::sharedFeatures().setPluginReplacementEnabled(enabled);
 }
 
+void InternalSettings::setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode& ec)
+{
+    InternalSettingsGuardForSettings();
+    settings()->setBackgroundShouldExtendBeyondPage(hasExtendedBackground);
+}
+
 }
index b153b60..768d575 100644 (file)
@@ -135,6 +135,8 @@ public:
     void setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode&);
     void setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode&);
     void setPluginReplacementEnabled(bool);
+    void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&);
+
 
 private:
     explicit InternalSettings(Page*);
index a7de5f8..f9fbfb1 100644 (file)
@@ -59,4 +59,5 @@
     [RaisesException] void setAutoscrollForDragAndDropEnabled(boolean enabled);
     [RaisesException] void setFontFallbackPrefersPictographs(boolean preferPictographs);
     void setPluginReplacementEnabled(boolean enabled);
+    [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground);
 };
index 620f0a5..5c9aee6 100644 (file)
@@ -1,3 +1,16 @@
+2014-01-17  Beth Dakin  <bdakin@apple.com>
+
+        Need a way to test the tile cache with margins enabled
+        https://bugs.webkit.org/show_bug.cgi?id=127194
+        -and corresponding-
+        <rdar://problem/15571327>
+
+        Reviewed by Tim Horton.
+
+        Attempt to keep Windows building.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:
+
 2014-01-16  Andy Estes  <aestes@apple.com>
 
         [iOS] Fix build issues with exported headers
index c692287..23a2b39 100644 (file)
@@ -280,6 +280,7 @@ EXPORTS
         symbolWithPointer(?setFantasyFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z, ?setFantasyFontFamily@Settings@WebCore@@QEAAXAEBVAtomicString@WTF@@W4UScriptCode@@@Z)
         symbolWithPointer(?setFixedFontFamily@Settings@WebCore@@QAEXABVAtomicString@WTF@@W4UScriptCode@@@Z, ?setFixedFontFamily@Settings@WebCore@@QEAAXAEBVAtomicString@WTF@@W4UScriptCode@@@Z)
         symbolWithPointer(?setFontFallbackPrefersPictographs@Settings@WebCore@@QAEX_N@Z, ?setFontFallbackPrefersPictographs@Settings@WebCore@@QEAAX_N@Z)
+        symbolWithPointer(?setBackgroundShouldExtendBeyondPage@Settings@WebCore@@QAEX_N@Z, ?setBackgroundShouldExtendBeyondPage@InternalSettings@WebCore@@QAEX_NAAH@Z)
         symbolWithPointer(?setFooterHeight@FrameView@WebCore@@QAEXH@Z, ?setFooterHeight@FrameView@WebCore@@QEAAXH@Z)
         symbolWithPointer(?setHeaderHeight@FrameView@WebCore@@QAEXH@Z, ?setHeaderHeight@FrameView@WebCore@@QEAAXH@Z)
         symbolWithPointer(?setImagesEnabled@Settings@WebCore@@QAEX_N@Z, ?setImagesEnabled@Settings@WebCore@@QEAAX_N@Z)