[EFL][DRT] Implement tracking and painting repaint rectangles.
authorrakuco@webkit.org <rakuco@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 21:45:46 +0000 (21:45 +0000)
committerrakuco@webkit.org <rakuco@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 20 Oct 2012 21:45:46 +0000 (21:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=99838

Reviewed by Gyuyoung Kim.

Source/WebKit/efl:

Add the required DumpRenderTreeSupport plumbing functions to
interact with FrameView and track/obtain repaint rectangles for
DumpRenderTree.

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled):
(DumpRenderTreeSupportEfl::setTracksRepaints):
(DumpRenderTreeSupportEfl::resetTrackedRepaints):
(DumpRenderTreeSupportEfl::isTrackingRepaints):
(DumpRenderTreeSupportEfl::trackedRepaintRects):
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Tools:

Implement displayWebView() and start tracking/painting the repaint
rectangles for the repaint tests that rely on it.

* DumpRenderTree/efl/DumpRenderTree.cpp:
(displayWebView):
* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(DumpRenderTreeChrome::resetDefaultsToConsistentValues):
* DumpRenderTree/efl/PixelDumpSupportEfl.cpp:
(createBitmapContextFromWebView):

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

Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h
Tools/ChangeLog
Tools/DumpRenderTree/efl/DumpRenderTree.cpp
Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp
Tools/DumpRenderTree/efl/PixelDumpSupportEfl.cpp

index c8704bc..b3f3f6c 100644 (file)
@@ -1,3 +1,22 @@
+2012-10-20  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
+
+        [EFL][DRT] Implement tracking and painting repaint rectangles.
+        https://bugs.webkit.org/show_bug.cgi?id=99838
+
+        Reviewed by Gyuyoung Kim.
+
+        Add the required DumpRenderTreeSupport plumbing functions to
+        interact with FrameView and track/obtain repaint rectangles for
+        DumpRenderTree.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled):
+        (DumpRenderTreeSupportEfl::setTracksRepaints):
+        (DumpRenderTreeSupportEfl::resetTrackedRepaints):
+        (DumpRenderTreeSupportEfl::isTrackingRepaints):
+        (DumpRenderTreeSupportEfl::trackedRepaintRects):
+        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
+
 2012-10-18  Kangil Han  <kangil.han@samsung.com>
 
         [EFL] Add unit test for ewk_frame_source_get.
index 7466029..eee7122 100644 (file)
@@ -1,6 +1,7 @@
 /*
     Copyright (C) 2011 ProFUSION embedded systems
     Copyright (C) 2011 Samsung Electronics
+    Copyright (C) 2012 Intel Corporation. All rights reserved.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -378,6 +379,51 @@ void DumpRenderTreeSupportEfl::setSelectTrailingWhitespaceEnabled(Evas_Object* e
     editorClient->setSelectTrailingWhitespaceEnabled(enabled);
 }
 
+void DumpRenderTreeSupportEfl::setTracksRepaints(Evas_Object* ewkFrame, bool enabled)
+{
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
+
+    if (frame->view())
+        frame->view()->setTracksRepaints(enabled);
+}
+
+void DumpRenderTreeSupportEfl::resetTrackedRepaints(Evas_Object* ewkFrame)
+{
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame);
+
+    if (frame->view())
+        frame->view()->resetTrackedRepaints();
+}
+
+bool DumpRenderTreeSupportEfl::isTrackingRepaints(const Evas_Object* ewkFrame)
+{
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, false);
+
+    if (!frame->view())
+        return false;
+
+    return frame->view()->isTrackingRepaints();
+}
+
+Eina_List* DumpRenderTreeSupportEfl::trackedRepaintRects(const Evas_Object* ewkFrame)
+{
+    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, 0);
+
+    if (!frame->view())
+        return 0;
+
+    const Vector<WebCore::IntRect>& repaintRects = frame->view()->trackedRepaintRects();
+    size_t count = repaintRects.size();
+    Eina_List* rectList = 0;
+
+    for (size_t i = 0; i < count; ++i) {
+        Eina_Rectangle* rect = eina_rectangle_new(repaintRects[i].x(), repaintRects[i].y(), repaintRects[i].width(), repaintRects[i].height());
+        rectList = eina_list_append(rectList, rect);
+    }
+
+    return rectList;
+}
+
 void DumpRenderTreeSupportEfl::garbageCollectorCollect()
 {
     WebCore::gcController().garbageCollectNow();
index ccc0873..35c0500 100644 (file)
@@ -1,6 +1,7 @@
 /*
     Copyright (C) 2011 ProFUSION embedded systems
     Copyright (C) 2011 Samsung Electronics
+    Copyright (C) 2012 Intel Corporation. All rights reserved.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -83,6 +84,11 @@ public:
     static void setSmartInsertDeleteEnabled(Evas_Object* ewkView, bool enabled);
     static void setSelectTrailingWhitespaceEnabled(Evas_Object* ewkView, bool enabled);
 
+    static void setTracksRepaints(Evas_Object* ewkFrame, bool enabled);
+    static void resetTrackedRepaints(Evas_Object* ewkFrame);
+    static bool isTrackingRepaints(const Evas_Object* ewkFrame);
+    static Eina_List* trackedRepaintRects(const Evas_Object* ewkFrame);
+
     static void garbageCollectorCollect();
     static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone);
     static size_t javaScriptObjectsCount();
index 7da0867..e9887ac 100644 (file)
@@ -1,3 +1,20 @@
+2012-10-20  Raphael Kubo da Costa  <raphael.kubo.da.costa@intel.com>
+
+        [EFL][DRT] Implement tracking and painting repaint rectangles.
+        https://bugs.webkit.org/show_bug.cgi?id=99838
+
+        Reviewed by Gyuyoung Kim.
+
+        Implement displayWebView() and start tracking/painting the repaint
+        rectangles for the repaint tests that rely on it.
+
+        * DumpRenderTree/efl/DumpRenderTree.cpp:
+        (displayWebView):
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        (DumpRenderTreeChrome::resetDefaultsToConsistentValues):
+        * DumpRenderTree/efl/PixelDumpSupportEfl.cpp:
+        (createBitmapContextFromWebView):
+
 2012-10-19  Dan Bernstein  <mitz@apple.com>
 
         Add bundle API for hit-testing
index 69a4211..a0dec4e 100644 (file)
@@ -382,7 +382,8 @@ static void shutdownEfl()
 
 void displayWebView()
 {
-    notImplemented();
+    DumpRenderTreeSupportEfl::setTracksRepaints(browser->mainFrame(), true);
+    DumpRenderTreeSupportEfl::resetTrackedRepaints(browser->mainFrame());
 }
 
 void dump()
index 9249eae..d1ba5ff 100644 (file)
@@ -320,6 +320,7 @@ void DumpRenderTreeChrome::resetDefaultsToConsistentValues()
     DumpRenderTreeSupportEfl::setMinimumLogicalFontSize(mainView(), 9);
     DumpRenderTreeSupportEfl::setCSSRegionsEnabled(mainView(), true);
     DumpRenderTreeSupportEfl::setShouldTrackVisitedLinks(false);
+    DumpRenderTreeSupportEfl::setTracksRepaints(mainFrame(), false);
 
     // Reset capacities for the memory cache for dead objects.
     static const unsigned cacheTotalCapacity =  8192 * 1024;
index 4af774d..efc5061 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2010 Igalia S.L.
  * Copyright (C) 2011 ProFUSION Embedded Systems
  * Copyright (C) 2011 Samsung Electronics
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,6 +57,32 @@ PassRefPtr<BitmapContext> createBitmapContextFromWebView(bool, bool, bool, bool
     if (!ewk_view_paint(privateData, context.get(), &rect))
         return 0;
 
+    if (DumpRenderTreeSupportEfl::isTrackingRepaints(mainFrame)) {
+        cairo_push_group(context.get());
+
+        // Paint the gray mask over the original image.
+        cairo_set_source_rgba(context.get(), 0, 0, 0, 0.66);
+        cairo_paint(context.get());
+
+        // Paint transparent rectangles over the mask to show the repainted regions.
+        cairo_set_source_rgba(context.get(), 0, 0, 0, 0);
+        cairo_set_operator(context.get(), CAIRO_OPERATOR_SOURCE);
+
+        Eina_List* repaintRects = DumpRenderTreeSupportEfl::trackedRepaintRects(mainFrame);
+        void* iter = 0;
+        EINA_LIST_FREE(repaintRects, iter) {
+            Eina_Rectangle* rect = static_cast<Eina_Rectangle*>(iter);
+
+            cairo_rectangle(context.get(), rect->x, rect->y, rect->w, rect->h);
+            cairo_fill(context.get());
+
+            eina_rectangle_free(rect);
+        }
+
+        cairo_pop_group_to_source(context.get());
+        cairo_paint(context.get());
+    }
+
     if (drawSelectionRect) {
         const WebCore::IntRect selectionRect = DumpRenderTreeSupportEfl::selectionRectangle(mainFrame);