Title: [117947] trunk
Revision
117947
Author
[email protected]
Date
2012-05-22 04:21:52 -0700 (Tue, 22 May 2012)

Log Message

[Gtk][LayoutTests] Repaint the complete WebKitWebView before dumping pixel results
https://bugs.webkit.org/show_bug.cgi?id=86284

Reviewed by Martin Robinson.

Source/WebKit/gtk: 

Add an additional method to the ChromeClient through which it is
possible to bypass the painting timer and force an immediate repaint of
the current dirty regions.

Add a new method to DumpRenderTreeSupportGtk class that calls that
method, making it possible to force an instant paint from
DumpRenderTree.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::ChromeClient):
(WebKit::ChromeClient::paint): Only delay the painting if the paint is
not forced.
(WebKit::ChromeClient::forcePaint):
(WebKit):
* WebCoreSupport/ChromeClientGtk.h:
(ChromeClient):
* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::getFrameChildren): Refactor getFrameChildren
to use the kit() function on the core child frames rather than using
the FrameLoaderClient of that frame, which is what the kit() function does in the first
place. This makes it possible to remove the inclusion of the FrameLoaderClientGtk.h
header which causes symbol name conflicts when included along with ChromeClientGtk.h
that originate in the Xlib headers included through the former header.
(DumpRenderTreeSupportGtk::forceWebViewPaint):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):

Tools: 

Paint the current dirty regions of the web view once more before
dumping pixel results.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(dump):

Modified Paths

Diff

Modified: trunk/Source/WebKit/gtk/ChangeLog (117946 => 117947)


--- trunk/Source/WebKit/gtk/ChangeLog	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Source/WebKit/gtk/ChangeLog	2012-05-22 11:21:52 UTC (rev 117947)
@@ -1,3 +1,37 @@
+2012-05-22  Zan Dobersek  <[email protected]>
+
+        [Gtk][LayoutTests] Repaint the complete WebKitWebView before dumping pixel results
+        https://bugs.webkit.org/show_bug.cgi?id=86284
+
+        Reviewed by Martin Robinson.
+
+        Add an additional method to the ChromeClient through which it is
+        possible to bypass the painting timer and force an immediate repaint of
+        the current dirty regions.
+
+        Add a new method to DumpRenderTreeSupportGtk class that calls that
+        method, making it possible to force an instant paint from
+        DumpRenderTree.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::ChromeClient):
+        (WebKit::ChromeClient::paint): Only delay the painting if the paint is
+        not forced.
+        (WebKit::ChromeClient::forcePaint):
+        (WebKit):
+        * WebCoreSupport/ChromeClientGtk.h:
+        (ChromeClient):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::getFrameChildren): Refactor getFrameChildren
+        to use the kit() function on the core child frames rather than using
+        the FrameLoaderClient of that frame, which is what the kit() function does in the first
+        place. This makes it possible to remove the inclusion of the FrameLoaderClientGtk.h
+        header which causes symbol name conflicts when included along with ChromeClientGtk.h
+        that originate in the Xlib headers included through the former header.
+        (DumpRenderTreeSupportGtk::forceWebViewPaint):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
+        (DumpRenderTreeSupportGtk):
+
 2012-05-21  Sudarsana Nagineni  <[email protected]>
 
         [GTK] DRT support for layoutTestController.setSerializeHTTPLoads

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (117946 => 117947)


--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2012-05-22 11:21:52 UTC (rev 117947)
@@ -85,6 +85,7 @@
     , m_adjustmentWatcher(webView)
     , m_closeSoonTimer(0)
     , m_displayTimer(this, &ChromeClient::paint)
+    , m_forcePaint(false)
     , m_lastDisplayTime(0)
     , m_repaintSoonSourceId(0)
 {
@@ -566,7 +567,7 @@
     double timeSinceLastDisplay = currentTime() - m_lastDisplayTime;
     double timeUntilNextDisplay = minimumFrameInterval - timeSinceLastDisplay;
 
-    if (timeUntilNextDisplay > 0) {
+    if (timeUntilNextDisplay > 0 && !m_forcePaint) {
         m_displayTimer.startOneShot(timeUntilNextDisplay);
         return;
     }
@@ -608,6 +609,13 @@
         m_webView->priv->imFilter.setCursorRect(frame->selection()->absoluteCaretBounds());
 }
 
+void ChromeClient::forcePaint()
+{
+    m_forcePaint = true;
+    paint(0);
+    m_forcePaint = false;
+}
+
 void ChromeClient::invalidateRootView(const IntRect&, bool immediate)
 {
 }

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h (117946 => 117947)


--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h	2012-05-22 11:21:52 UTC (rev 117947)
@@ -166,6 +166,7 @@
 
         void performAllPendingScrolls();
         void paint(Timer<ChromeClient>*);
+        void forcePaint();
         void widgetSizeChanged(const IntSize& oldWidgetSize, IntSize newSize);
 
     private:
@@ -175,6 +176,7 @@
         unsigned int m_closeSoonTimer;
 
         Timer <ChromeClient> m_displayTimer;
+        bool m_forcePaint;
         Region m_dirtyRegion;
         Vector<IntRect> m_rectsToScroll;
         Vector<IntSize> m_scrollOffsets;

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp (117946 => 117947)


--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp	2012-05-22 11:21:52 UTC (rev 117947)
@@ -27,12 +27,13 @@
 #include "AccessibilityObject.h"
 #include "AnimationController.h"
 #include "CSSComputedStyleDeclaration.h"
+#include "Chrome.h"
+#include "ChromeClientGtk.h"
 #include "DOMWrapperWorld.h"
 #include "Document.h"
 #include "EditorClientGtk.h"
 #include "Element.h"
 #include "FocusController.h"
-#include "FrameLoaderClientGtk.h"
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "GCController.h"
@@ -133,10 +134,9 @@
 
     GSList* children = 0;
     for (Frame* child = coreFrame->tree()->firstChild(); child; child = child->tree()->nextSibling()) {
-        FrameLoader* loader = child->loader();
-        WebKit::FrameLoaderClient* client = static_cast<WebKit::FrameLoaderClient*>(loader->client());
-        if (client)
-          children = g_slist_append(children, client->webFrame());
+        WebKitWebFrame* kitFrame = kit(child);
+        if (kitFrame)
+          children = g_slist_append(children, kitFrame);
     }
 
     return children;
@@ -588,6 +588,13 @@
     client->setSmartInsertDeleteEnabled(enabled);
 }
 
+void DumpRenderTreeSupportGtk::forceWebViewPaint(WebKitWebView* webView)
+{
+    g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
+
+    static_cast<WebKit::ChromeClient*>(core(webView)->chrome()->client())->forcePaint();
+}
+
 void DumpRenderTreeSupportGtk::whiteListAccessFromOrigin(const gchar* sourceOrigin, const gchar* destinationProtocol, const gchar* destinationHost, bool allowDestinationSubdomains)
 {
     SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(sourceOrigin), destinationProtocol, destinationHost, allowDestinationSubdomains);

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h (117946 => 117947)


--- trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h	2012-05-22 11:21:52 UTC (rev 117947)
@@ -92,6 +92,7 @@
     static void scalePageBy(WebKitWebView*, float, float, float);
     static void setDefersLoading(WebKitWebView*, bool);
     static void setSmartInsertDeleteEnabled(WebKitWebView*, bool);
+    static void forceWebViewPaint(WebKitWebView*);
 
     // Accessibility
     static void incrementAccessibilityValue(AtkObject*);

Modified: trunk/Tools/ChangeLog (117946 => 117947)


--- trunk/Tools/ChangeLog	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Tools/ChangeLog	2012-05-22 11:21:52 UTC (rev 117947)
@@ -1,3 +1,16 @@
+2012-05-22  Zan Dobersek  <[email protected]>
+
+        [Gtk][LayoutTests] Repaint the complete WebKitWebView before dumping pixel results
+        https://bugs.webkit.org/show_bug.cgi?id=86284
+
+        Reviewed by Martin Robinson.
+
+        Paint the current dirty regions of the web view once more before
+        dumping pixel results.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (dump):
+
 2012-05-22  Allan Sandfeld Jensen  <[email protected]>
 
         GCC 4.7 and C++11 support.

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (117946 => 117947)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2012-05-22 11:16:16 UTC (rev 117946)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2012-05-22 11:21:52 UTC (rev 117947)
@@ -572,8 +572,10 @@
     if (dumpPixels
      && gLayoutTestController->generatePixelResults()
      && !gLayoutTestController->dumpDOMAsWebArchive()
-     && !gLayoutTestController->dumpSourceAsWebArchive())
+     && !gLayoutTestController->dumpSourceAsWebArchive()) {
+        DumpRenderTreeSupportGtk::forceWebViewPaint(webView);
         dumpWebViewAsPixelsAndCompareWithExpected(gLayoutTestController->expectedPixelHash());
+    }
 
     // FIXME: call displayWebView here when we support --paint
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to