Title: [132276] trunk
Revision
132276
Author
simon.fra...@apple.com
Date
2012-10-23 15:22:11 -0700 (Tue, 23 Oct 2012)

Log Message

Allow tests to run with a tile cache, and optionally dump the tile cache via layerTreeAsText()
https://bugs.webkit.org/show_bug.cgi?id=100159

Reviewed by Tim Horton.

Source/WebCore:

Add a LAYER_TREE_INCLUDES_PAGE_TILE_CACHE flag for layerTreeAsText(), and plumb it
through to GraphicsLayerCA, which dumps the TiledBacking tile coverage rect.

Test: platform/mac/tiled-drawing/use-tiled-drawing.html

* page/Frame.h:
* platform/graphics/GraphicsLayer.cpp:
(showGraphicsLayerTree):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::tiledBacking):
* platform/graphics/TiledBacking.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::tiledBacking):
(WebCore::GraphicsLayerCA::dumpAdditionalProperties):
* platform/graphics/ca/GraphicsLayerCA.h:
(GraphicsLayerCA):
* platform/graphics/ca/mac/TileCache.h:
(WebCore::TileCache::tileCoverageRect):
(TileCache):
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::computeTileCoverageRect):
(WebCore::TileCache::revalidateTiles):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerTreeAsText):
* testing/Internals.cpp:
(WebCore::Internals::layerTreeAsText):
* testing/Internals.h:
* testing/Internals.idl:

Tools:

Make WebKitTestRunner use a WKView with a tile cache for tests run in a directory
whose path includes "tiled-drawing". It does this by passing around a WKDictionary
of options, and if the current PlatformWebView doesn't support those options, it will
create a new one.

* WebKitTestRunner/PlatformWebView.h:
(PlatformWebView): Add a WKDictionaryRef options dictionary argument.
(WTR::PlatformWebView::viewSupportsOptions): Returns true if the view
supports the options in the WKDictionaryRef.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::initialize): Call createWebViewWithOptions() with
no options in the normal case.
(WTR::TestController::createWebViewWithOptions): Moved code into this fuction
so we can call it in two places.
(WTR::TestController::ensureViewSupportsOptions): If the current view
doesn't support the given options, throw it away and makea  new one that does.
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::shouldUseTiledDrawing): Return true if the directory contains "tiled-drawing".
(WTR::updateTiledDrawingForCurrentTest): Tell the TestController to check whether
the view supports the given options. No-op for non-Mac platforms.
(WTR::TestInvocation::invoke): Call updateTiledDrawingForCurrentTest().
* WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
(WTR::PlatformWebView::PlatformWebView): New constructor parameter.
* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::PlatformWebView):  New constructor parameter.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(-[TestRunnerWKView initWithFrame:contextRef:pageGroupRef:useTiledDrawing:]):
(-[TestRunnerWKView _shouldUseTiledDrawingArea]): Subclass the WKView so we can return
a custom value from this method.
(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):
* WebKitTestRunner/qt/PlatformWebViewQt.cpp:
(WTR::PlatformWebView::PlatformWebView): New constructor parameter.
* WebKitTestRunner/win/PlatformWebViewWin.cpp:
(WTR::PlatformWebView::PlatformWebView): New constructor parameter.

LayoutTests:

A new test that dumps tile cache data for a large page.

* platform/mac/tiled-drawing/use-tiled-drawing-expected.txt: Added.
* platform/mac/tiled-drawing/use-tiled-drawing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (132275 => 132276)


--- trunk/LayoutTests/ChangeLog	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/LayoutTests/ChangeLog	2012-10-23 22:22:11 UTC (rev 132276)
@@ -1,3 +1,15 @@
+2012-10-23  Simon Fraser  <simon.fra...@apple.com>
+
+        Allow tests to run with a tile cache, and optionally dump the tile cache via layerTreeAsText()
+        https://bugs.webkit.org/show_bug.cgi?id=100159
+
+        Reviewed by Tim Horton.
+
+        A new test that dumps tile cache data for a large page.
+
+        * platform/mac/tiled-drawing/use-tiled-drawing-expected.txt: Added.
+        * platform/mac/tiled-drawing/use-tiled-drawing.html: Added.
+
 2012-10-23  Chris Rogers  <crog...@google.com>
 
         Change setTargetValueAtTime() to setTargetAtTime()

Added: trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing-expected.txt (0 => 132276)


--- trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing-expected.txt	2012-10-23 22:22:11 UTC (rev 132276)
@@ -0,0 +1,19 @@
+(GraphicsLayer
+  (bounds 1208.00 2021.00)
+  (visible rect 0.00, 0.00 785.00 x 585.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 1208.00 2021.00)
+      (drawsContent 1)
+      (backgroundColor #FFFFFF)
+      (visible rect 0.00, 0.00 785.00 x 585.00)
+      (tile cache coverage 0, 0 1208 x 1536)
+      (children 1
+        (GraphicsLayer
+          (visible rect 0.00, 0.00 0.00 x 0.00)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing.html (0 => 132276)


--- trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing.html	2012-10-23 22:22:11 UTC (rev 132276)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            width: 1200px;
+            height: 2000px;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        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>
Property changes on: trunk/LayoutTests/platform/mac/tiled-drawing/use-tiled-drawing.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (132275 => 132276)


--- trunk/Source/WebCore/ChangeLog	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/ChangeLog	2012-10-23 22:22:11 UTC (rev 132276)
@@ -1,3 +1,39 @@
+2012-10-23  Simon Fraser  <simon.fra...@apple.com>
+
+        Allow tests to run with a tile cache, and optionally dump the tile cache via layerTreeAsText()
+        https://bugs.webkit.org/show_bug.cgi?id=100159
+
+        Reviewed by Tim Horton.
+
+        Add a LAYER_TREE_INCLUDES_PAGE_TILE_CACHE flag for layerTreeAsText(), and plumb it
+        through to GraphicsLayerCA, which dumps the TiledBacking tile coverage rect.
+
+        Test: platform/mac/tiled-drawing/use-tiled-drawing.html
+
+        * page/Frame.h:
+        * platform/graphics/GraphicsLayer.cpp:
+        (showGraphicsLayerTree):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::tiledBacking):
+        * platform/graphics/TiledBacking.h:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::tiledBacking):
+        (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        (GraphicsLayerCA):
+        * platform/graphics/ca/mac/TileCache.h:
+        (WebCore::TileCache::tileCoverageRect):
+        (TileCache):
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::computeTileCoverageRect):
+        (WebCore::TileCache::revalidateTiles):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::layerTreeAsText):
+        * testing/Internals.cpp:
+        (WebCore::Internals::layerTreeAsText):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2012-10-23  No'am Rosenthal  <noam.rosent...@nokia.com>
 
         Coordinated Graphics: Enable threaded/IPC animations

Modified: trunk/Source/WebCore/page/Frame.h (132275 => 132276)


--- trunk/Source/WebCore/page/Frame.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/page/Frame.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -78,7 +78,8 @@
 
     enum {
         LayerTreeFlagsIncludeDebugInfo = 1 << 0,
-        LayerTreeFlagsIncludeVisibleRects = 1 << 2
+        LayerTreeFlagsIncludeVisibleRects = 1 << 1,
+        LayerTreeFlagsIncludeTileCaches = 1 << 2
     };
     typedef unsigned LayerTreeFlags;
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -692,7 +692,7 @@
     if (!layer)
         return;
 
-    String output = layer->layerTreeAsText(LayerTreeAsTextDebug | LayerTreeAsTextIncludeVisibleRects);
+    String output = layer->layerTreeAsText(LayerTreeAsTextDebug | LayerTreeAsTextIncludeVisibleRects | LayerTreeAsTextIncludeTileCaches);
     fprintf(stderr, "%s\n", output.utf8().data());
 }
 #endif

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -48,6 +48,7 @@
     LayerTreeAsTextBehaviorNormal = 0,
     LayerTreeAsTextDebug = 1 << 0, // Dump extra debugging info like layer addresses.
     LayerTreeAsTextIncludeVisibleRects = 1 << 1,
+    LayerTreeAsTextIncludeTileCaches = 1 << 2
 };
 typedef unsigned LayerTreeAsTextBehavior;
 
@@ -401,7 +402,7 @@
 
     bool usingTiledLayer() const { return m_usingTiledLayer; }
 
-    virtual TiledBacking* tiledBacking() { return 0; }
+    virtual TiledBacking* tiledBacking() const { return 0; }
 
 #if PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL)
     // This allows several alternative GraphicsLayer implementations in the same port,

Modified: trunk/Source/WebCore/platform/graphics/TiledBacking.h (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/TiledBacking.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/TiledBacking.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -54,6 +54,10 @@
 
     virtual void setScrollingPerformanceLoggingEnabled(bool) = 0;
     virtual bool scrollingPerformanceLoggingEnabled() const = 0;
+    
+    // Exposed for testing
+    virtual IntRect tileCoverageRect() const = 0;
+
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -910,7 +910,7 @@
     commitLayerChangesAfterSublayers();
 }
 
-TiledBacking* GraphicsLayerCA::tiledBacking()
+TiledBacking* GraphicsLayerCA::tiledBacking() const
 {
     return m_layer->tiledBacking();
 }
@@ -2522,6 +2522,12 @@
         writeIndent(textStream, indent + 1);
         textStream << "(visible rect " << m_visibleRect.x() << ", " << m_visibleRect.y() << " " << m_visibleRect.width() << " x " << m_visibleRect.height() << ")\n";
     }
+
+    if (tiledBacking() && (behavior & LayerTreeAsTextIncludeTileCaches)) {
+        writeIndent(textStream, indent + 1);
+        IntRect tileCoverageRect = tiledBacking()->tileCoverageRect();
+        textStream << "(tile cache coverage " << tileCoverageRect.x() << ", " << tileCoverageRect.y() << " " << tileCoverageRect.width() << " x " << tileCoverageRect.height() << ")\n";
+    }
 }
 
 void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth)

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -134,7 +134,7 @@
     virtual void flushCompositingState(const FloatRect&);
     virtual void flushCompositingStateForThisLayerOnly();
 
-    virtual TiledBacking* tiledBacking() OVERRIDE;
+    virtual TiledBacking* tiledBacking() const OVERRIDE;
 
     bool allowTiledLayer() const { return m_allowTiledLayer; }
     virtual void setAllowTiledLayer(bool b);

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -89,6 +89,8 @@
     virtual void forceRepaint() OVERRIDE;
     virtual void setScrollingPerformanceLoggingEnabled(bool flag) OVERRIDE { m_scrollingPerformanceLoggingEnabled = flag; }
     virtual bool scrollingPerformanceLoggingEnabled() const OVERRIDE { return m_scrollingPerformanceLoggingEnabled; }
+
+    virtual IntRect tileCoverageRect() const { return m_tileCoverageRect; }
     
     IntRect bounds() const;
 
@@ -96,7 +98,7 @@
     IntRect rectForTileIndex(const TileIndex&) const;
     void getTileIndexRangeForRect(const IntRect&, TileIndex& topLeft, TileIndex& bottomRight);
 
-    IntRect tileCoverageRect() const;
+    IntRect computeTileCoverageRect() const;
 
     void scheduleTileRevalidation(double interval);
     void tileRevalidationTimerFired(Timer<TileCache>*);

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (132275 => 132276)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-23 22:22:11 UTC (rev 132276)
@@ -304,7 +304,7 @@
     bottomRight.setY(max(clampedRect.maxY() / m_tileSize.height(), 0));
 }
 
-IntRect TileCache::tileCoverageRect() const
+IntRect TileCache::computeTileCoverageRect() const
 {
     IntRect tileCoverageRect = m_visibleRect;
 
@@ -377,7 +377,7 @@
     if (m_visibleRect.isEmpty() || bounds().isEmpty())
         return;
 
-    IntRect tileCoverageRect = this->tileCoverageRect();
+    IntRect tileCoverageRect = computeTileCoverageRect();
 
     Vector<TileIndex> tilesToRemove;
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (132275 => 132276)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -1137,7 +1137,9 @@
         layerTreeBehavior |= LayerTreeAsTextDebug;
     if (flags & LayerTreeFlagsIncludeVisibleRects)
         layerTreeBehavior |= LayerTreeAsTextIncludeVisibleRects;
-    
+    if (flags & LayerTreeFlagsIncludeTileCaches)
+        layerTreeBehavior |= LayerTreeAsTextIncludeTileCaches;
+
     // We skip dumping the scroll and clip layers to keep layerTreeAsText output
     // similar between platforms.
     return m_rootContentLayer->layerTreeAsText(layerTreeBehavior);

Modified: trunk/Source/WebCore/testing/Internals.cpp (132275 => 132276)


--- trunk/Source/WebCore/testing/Internals.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/testing/Internals.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -1237,6 +1237,8 @@
     LayerTreeFlags layerTreeFlags = 0;
     if (flags & LAYER_TREE_INCLUDES_VISIBLE_RECTS)
         layerTreeFlags |= LayerTreeFlagsIncludeVisibleRects;
+    if (flags & LAYER_TREE_INCLUDES_TILE_CACHES)
+        layerTreeFlags |= LayerTreeFlagsIncludeTileCaches;
 
     return document->frame()->layerTreeAsText(layerTreeFlags);
 }

Modified: trunk/Source/WebCore/testing/Internals.h (132275 => 132276)


--- trunk/Source/WebCore/testing/Internals.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/testing/Internals.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -188,7 +188,10 @@
     void resumeAnimations(Document*, ExceptionCode&) const;
 
     enum {
-        LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1 // Values need to kept in sync with Internals.idl.
+        // Values need to be kept in sync with Internals.idl.
+        LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1,
+        LAYER_TREE_INCLUDES_TILE_CACHES = 2
+        
     };
     String layerTreeAsText(Document*, unsigned flags, ExceptionCode&) const;
     String layerTreeAsText(Document*, ExceptionCode&) const;

Modified: trunk/Source/WebCore/testing/Internals.idl (132275 => 132276)


--- trunk/Source/WebCore/testing/Internals.idl	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Source/WebCore/testing/Internals.idl	2012-10-23 22:22:11 UTC (rev 132276)
@@ -158,6 +158,7 @@
 
     // Flags for layerTreeAsText.
     const unsigned short LAYER_TREE_INCLUDES_VISIBLE_RECTS = 1;
+    const unsigned short LAYER_TREE_INCLUDES_TILE_CACHES = 2;
     DOMString layerTreeAsText(in Document document, in [Optional] unsigned short flags) raises (DOMException);
 
     void garbageCollectDocumentResources(in Document document) raises (DOMException);

Modified: trunk/Tools/ChangeLog (132275 => 132276)


--- trunk/Tools/ChangeLog	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/ChangeLog	2012-10-23 22:22:11 UTC (rev 132276)
@@ -1,3 +1,47 @@
+2012-10-23  Simon Fraser  <simon.fra...@apple.com>
+
+        Allow tests to run with a tile cache, and optionally dump the tile cache via layerTreeAsText()
+        https://bugs.webkit.org/show_bug.cgi?id=100159
+
+        Reviewed by Tim Horton.
+
+        Make WebKitTestRunner use a WKView with a tile cache for tests run in a directory
+        whose path includes "tiled-drawing". It does this by passing around a WKDictionary 
+        of options, and if the current PlatformWebView doesn't support those options, it will
+        create a new one.
+
+        * WebKitTestRunner/PlatformWebView.h:
+        (PlatformWebView): Add a WKDictionaryRef options dictionary argument.
+        (WTR::PlatformWebView::viewSupportsOptions): Returns true if the view
+        supports the options in the WKDictionaryRef.
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::initialize): Call createWebViewWithOptions() with
+        no options in the normal case.
+        (WTR::TestController::createWebViewWithOptions): Moved code into this fuction
+        so we can call it in two places.
+        (WTR::TestController::ensureViewSupportsOptions): If the current view
+        doesn't support the given options, throw it away and makea  new one that does.
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::shouldUseTiledDrawing): Return true if the directory contains "tiled-drawing".
+        (WTR::updateTiledDrawingForCurrentTest): Tell the TestController to check whether
+        the view supports the given options. No-op for non-Mac platforms.
+        (WTR::TestInvocation::invoke): Call updateTiledDrawingForCurrentTest().
+        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
+        (WTR::PlatformWebView::PlatformWebView): New constructor parameter.
+        * WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
+        (WTR::PlatformWebView::PlatformWebView):  New constructor parameter.
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (-[TestRunnerWKView initWithFrame:contextRef:pageGroupRef:useTiledDrawing:]):
+        (-[TestRunnerWKView _shouldUseTiledDrawingArea]): Subclass the WKView so we can return
+        a custom value from this method.
+        (WTR::PlatformWebView::PlatformWebView):
+        (WTR::PlatformWebView::viewSupportsOptions):
+        * WebKitTestRunner/qt/PlatformWebViewQt.cpp:
+        (WTR::PlatformWebView::PlatformWebView): New constructor parameter.
+        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
+        (WTR::PlatformWebView::PlatformWebView): New constructor parameter.
+
 2012-10-23  David Barton  <dbar...@mathscribe.com>
 
         [MathML] Symbol font uses greek letters for roman ones on linux and Windows

Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/PlatformWebView.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -64,7 +64,7 @@
 
 class PlatformWebView {
 public:
-    PlatformWebView(WKContextRef, WKPageGroupRef);
+    PlatformWebView(WKContextRef, WKPageGroupRef, WKDictionaryRef options = 0);
     ~PlatformWebView();
 
     WKPageRef page();
@@ -88,7 +88,13 @@
     void makeWebViewFirstResponder();
     void setWindowIsKey(bool isKey) { m_windowIsKey = isKey; }
     bool windowIsKey() const { return m_windowIsKey; }
-    
+
+#if PLATFORM(MAC)
+    bool viewSupportsOptions(WKDictionaryRef) const;
+#else
+    bool viewSupportsOptions(WKDictionaryRef) const { return true; }
+#endif
+
     WKRetainPtr<WKImageRef> windowSnapshotImage();
 
 private:

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -343,8 +343,12 @@
     if (testPluginDirectory())
         WKContextSetAdditionalPluginsDirectory(m_context.get(), testPluginDirectory());
 
-    m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get()));
+    createWebViewWithOptions(0);
+}
 
+void TestController::createWebViewWithOptions(WKDictionaryRef options)
+{
+    m_mainWebView = adoptPtr(new PlatformWebView(m_context.get(), m_pageGroup.get(), options));
     WKPageUIClient pageUIClient = {
         kWKPageUIClientCurrentVersion,
         m_mainWebView.get(),
@@ -446,6 +450,21 @@
     WKPageSetPagePolicyClient(m_mainWebView->page(), &pagePolicyClient);
 }
 
+void TestController::ensureViewSupportsOptions(WKDictionaryRef options)
+{
+    if (m_mainWebView && !m_mainWebView->viewSupportsOptions(options)) {
+        WKPageSetPageUIClient(m_mainWebView->page(), 0);
+        WKPageSetPageLoaderClient(m_mainWebView->page(), 0);
+        WKPageSetPagePolicyClient(m_mainWebView->page(), 0);
+        WKPageClose(m_mainWebView->page());
+        
+        m_mainWebView = nullptr;
+
+        createWebViewWithOptions(options);
+        resetStateToConsistentValues();
+    }
+}
+
 bool TestController::resetStateToConsistentValues()
 {
     m_state = Resetting;

Modified: trunk/Tools/WebKitTestRunner/TestController.h (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/TestController.h	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2012-10-23 22:22:11 UTC (rev 132276)
@@ -57,6 +57,8 @@
     PlatformWebView* mainWebView() { return m_mainWebView.get(); }
     WKContextRef context() { return m_context.get(); }
 
+    void ensureViewSupportsOptions(WKDictionaryRef options);
+    
     // Runs the run loop until `done` is true or the timeout elapses.
     enum TimeoutDuration { ShortTimeout, LongTimeout, NoTimeout };
     bool useWaitToDumpWatchdogTimer() { return m_useWaitToDumpWatchdogTimer; }
@@ -83,6 +85,7 @@
 
 private:
     void initialize(int argc, const char* argv[]);
+    void createWebViewWithOptions(WKDictionaryRef);
     void run();
 
     void runTestingServerLoop();

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -143,9 +143,31 @@
 }
 #endif
 
+#if PLATFORM(MAC)
+static bool shouldUseTiledDrawing(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "tiled-drawing/") || strstr(pathOrURL, "tiled-drawing\\");
+}
+#endif
+
+static void updateTiledDrawingForCurrentTest(const char* pathOrURL)
+{
+#if PLATFORM(MAC)
+    WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());
+    WKRetainPtr<WKStringRef> useTiledDrawingKey = adoptWK(WKStringCreateWithUTF8CString("TiledDrawing"));
+    WKRetainPtr<WKBooleanRef> useTiledDrawingValue = adoptWK(WKBooleanCreate(shouldUseTiledDrawing(pathOrURL)));
+    WKDictionaryAddItem(viewOptions.get(), useTiledDrawingKey.get(), useTiledDrawingValue.get());
+
+    TestController::shared().ensureViewSupportsOptions(viewOptions.get());
+#else
+    UNUSED_PARAM(pathOrURL);
+#endif
+}
+
 void TestInvocation::invoke()
 {
     sizeWebViewForCurrentTest(m_pathOrURL.c_str());
+    updateTiledDrawingForCurrentTest(m_pathOrURL.c_str());
 
     WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest"));
     WKRetainPtr<WKMutableDictionaryRef> beginTestMessageBody = adoptWK(WKMutableDictionaryCreate());

Modified: trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -40,7 +40,7 @@
     return ecoreEvas;
 }
 
-PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup)
+PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKDictionaryRef /*options*/)
 {
     m_window = initEcoreEvas();
     Evas* evas = ecore_evas_get(m_window);

Modified: trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/gtk/PlatformWebViewGtk.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -33,7 +33,7 @@
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup)
+PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKDictionaryRef /*options*/)
     : m_view(WKViewCreate(context, pageGroup))
     , m_window(gtk_window_new(GTK_WINDOW_POPUP))
     , m_windowIsKey(true)

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2012-10-23 22:22:11 UTC (rev 132276)
@@ -25,6 +25,7 @@
 
 #include "config.h"
 #include "PlatformWebView.h"
+#include "TestController.h"
 
 #import <WebKit2/WKImageCG.h>
 #import <WebKit2/WKViewPrivate.h>
@@ -37,6 +38,32 @@
 @property (nonatomic, assign) WTR::PlatformWebView* platformWebView;
 @end
 
+@interface TestRunnerWKView : WKView {
+    BOOL _useTiledDrawing;
+}
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)context pageGroupRef:(WKPageGroupRef)pageGroup useTiledDrawing:(BOOL)useTiledDrawing;
+
+@property (nonatomic, assign) BOOL useTiledDrawing;
+@end
+
+@implementation TestRunnerWKView
+
+@synthesize useTiledDrawing = _useTiledDrawing;
+
+- (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)context pageGroupRef:(WKPageGroupRef)pageGroup useTiledDrawing:(BOOL)useTiledDrawing
+{
+    _useTiledDrawing = useTiledDrawing;
+    return [super initWithFrame:frame contextRef:context pageGroupRef:pageGroup];
+}
+
+- (BOOL)_shouldUseTiledDrawingArea
+{
+    return _useTiledDrawing;
+}
+
+@end
+
 @implementation WebKitTestRunnerWindow
 @synthesize platformWebView = _platformWebView;
 
@@ -78,11 +105,14 @@
 
 namespace WTR {
 
-PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, WKDictionaryRef options)
     : m_windowIsKey(true)
 {
+    WKRetainPtr<WKStringRef> useTiledDrawingKey(AdoptWK, WKStringCreateWithUTF8CString("TiledDrawing"));
+    bool useTiledDrawing = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useTiledDrawingKey.get()))) : false;
+
     NSRect rect = NSMakeRect(0, 0, 800, 600);
-    m_view = [[WKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef];
+    m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef useTiledDrawing:useTiledDrawing];
 
     NSRect windowRect = NSOffsetRect(rect, -10000, [(NSScreen *)[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
     m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
@@ -168,4 +198,12 @@
     return adoptWK(WKImageCreateFromCGImage(windowSnapshotImage.get(), 0));
 }
 
+bool PlatformWebView::viewSupportsOptions(WKDictionaryRef options) const
+{
+    WKRetainPtr<WKStringRef> useTiledDrawingKey(AdoptWK, WKStringCreateWithUTF8CString("TiledDrawing"));
+    bool useTiledDrawing = WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useTiledDrawingKey.get())));
+
+    return useTiledDrawing == [(TestRunnerWKView *)m_view useTiledDrawing];
+}
+
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -79,7 +79,7 @@
     QQuickWebView* m_view;
 };
 
-PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, WKDictionaryRef /*options*/)
     : m_view(new QQuickWebView(contextRef, pageGroupRef))
     , m_window(new WrapperWindow(m_view))
     , m_windowIsKey(true)

Modified: trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp (132275 => 132276)


--- trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp	2012-10-23 22:19:37 UTC (rev 132275)
+++ trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp	2012-10-23 22:22:11 UTC (rev 132276)
@@ -48,7 +48,7 @@
     RegisterClassExW(&wndClass);
 }
 
-PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, WKDictionaryRef /*options*/)
     : m_windowIsKey(true)
 {
     registerWindowClass();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to