Changeset 135935 in webkit


Ignore:
Timestamp:
Nov 27, 2012, 3:56:54 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL][WK2] 3D pixel tests are failing
https://bugs.webkit.org/show_bug.cgi?id=102833

Patch by Yael Aharon <yael.aharon@intel.com> on 2012-11-27
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Added an API for generating a snapshot, to be used from WebKitTestRunner.

  • PlatformEfl.cmake:
  • UIProcess/API/C/efl/WKView.cpp:

(WKViewGetSnapshot):

  • UIProcess/API/C/efl/WKView.h:
  • UIProcess/API/efl/EwkViewImpl.cpp:

(EwkViewImpl::onFaviconChanged):
(EwkViewImpl::takeSnapshot):

  • UIProcess/API/efl/EwkViewImpl.h:

(EwkViewImpl):

  • UIProcess/API/efl/SnapshotImageGL.cpp: Added.

(getImageFromCurrentTexture):

  • UIProcess/API/efl/SnapshotImageGL.h: Added.

Tools:

Generate a snapshot of the view in the UI process instead of the web process.
We have to use Texture Mapper in order to correctly paint 3D transforms etc.

  • WebKitTestRunner/TestInvocation.h:

(TestInvocation):

  • WebKitTestRunner/cairo/TestInvocationCairo.cpp:

(WTR::writeFunction):
(WTR::paintRepaintRectOverlay):
(WTR):
(WTR::TestInvocation::forceRepaintDoneCallback):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):

  • WebKitTestRunner/efl/PlatformWebViewEfl.cpp:

(WTR::PlatformWebView::windowSnapshotImage):

Location:
trunk
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r135925 r135935  
     12012-11-27  Yael Aharon  <yael.aharon@intel.com>
     2
     3        [EFL][WK2] 3D pixel tests are failing
     4        https://bugs.webkit.org/show_bug.cgi?id=102833
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Added an API for generating a snapshot, to be used from WebKitTestRunner.
     9
     10        * PlatformEfl.cmake:
     11        * UIProcess/API/C/efl/WKView.cpp:
     12        (WKViewGetSnapshot):
     13        * UIProcess/API/C/efl/WKView.h:
     14        * UIProcess/API/efl/EwkViewImpl.cpp:
     15        (EwkViewImpl::onFaviconChanged):
     16        (EwkViewImpl::takeSnapshot):
     17        * UIProcess/API/efl/EwkViewImpl.h:
     18        (EwkViewImpl):
     19        * UIProcess/API/efl/SnapshotImageGL.cpp: Added.
     20        (getImageFromCurrentTexture):
     21        * UIProcess/API/efl/SnapshotImageGL.h: Added.
     22
    1232012-11-27  Tim Horton  <timothy_horton@apple.com>
    224
  • trunk/Source/WebKit2/PlatformEfl.cmake

    r135394 r135935  
    4545    UIProcess/API/efl/EvasGLContext.cpp
    4646    UIProcess/API/efl/EvasGLSurface.cpp
     47    UIProcess/API/efl/SnapshotImageGL.cpp
    4748    UIProcess/API/efl/ewk_auth_request.cpp
    4849    UIProcess/API/efl/ewk_back_forward_list.cpp
  • trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp

    r135287 r135935  
    4343    return viewImpl->wkPage();
    4444}
     45
     46WKImageRef WKViewGetSnapshot(WKViewRef viewRef)
     47{
     48    EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(toImpl(viewRef));
     49
     50    return viewImpl->takeSnapshot();
     51}
  • trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h

    r135287 r135935  
    3535WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
    3636
     37WK_EXPORT WKImageRef WKViewGetSnapshot(WKViewRef viewRef);
     38
    3739#ifdef __cplusplus
    3840}
  • trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp

    r135609 r135935  
    3636#include "PageUIClientEfl.h"
    3737#include "ResourceLoadClientEfl.h"
     38#include "SnapshotImageGL.h"
    3839#include "WKDictionary.h"
    3940#include "WKGeometry.h"
     
    4142#include "WKString.h"
    4243#include "WebContext.h"
     44#include "WebImage.h"
    4345#include "WebPageGroup.h"
    4446#include "WebPageProxy.h"
     
    6365#include <WebCore/CairoUtilitiesEfl.h>
    6466#include <WebCore/Cursor.h>
     67#include <WebKit2/WKImageCairo.h>
    6568
    6669#if ENABLE(VIBRATION)
     
    10131016    viewImpl->informIconChange();
    10141017}
     1018
     1019WKImageRef EwkViewImpl::takeSnapshot()
     1020{
     1021    Ewk_View_Smart_Data* sd = smartData();
     1022#if USE(ACCELERATED_COMPOSITING)
     1023    if (!m_isHardwareAccelerated)
     1024#endif
     1025        return WKImageCreateFromCairoSurface(createSurfaceForImage(sd->image).get(), 0);
     1026
     1027#if USE(ACCELERATED_COMPOSITING)
     1028    Evas_Native_Surface* nativeSurface = evas_object_image_native_surface_get(sd->image);
     1029    unsigned char* buffer = getImageFromCurrentTexture(sd->view.w, sd->view.h, nativeSurface->data.opengl.texture_id);
     1030    RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, sd->view.w, sd->view.h, sd->view.w * 4));
     1031    WKImageRef image = WKImageCreateFromCairoSurface(surface.get(), 0);
     1032    delete[] buffer;
     1033
     1034    return image;
     1035#endif
     1036}
  • trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h

    r135514 r135935  
    216216    void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
    217217
     218    WKImageRef takeSnapshot();
     219
    218220private:
    219221    inline Ewk_View_Smart_Data* smartData() const;
  • trunk/Tools/ChangeLog

    r135930 r135935  
     12012-11-27  Yael Aharon  <yael.aharon@intel.com>
     2
     3        [EFL][WK2] 3D pixel tests are failing
     4        https://bugs.webkit.org/show_bug.cgi?id=102833
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Generate a snapshot of the view in the UI process instead of the web process.
     9        We have to use Texture Mapper in order to correctly paint 3D transforms etc.
     10
     11        * WebKitTestRunner/TestInvocation.h:
     12        (TestInvocation):
     13        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
     14        (WTR::writeFunction):
     15        (WTR::paintRepaintRectOverlay):
     16        (WTR):
     17        (WTR::TestInvocation::forceRepaintDoneCallback):
     18        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
     19        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
     20        (WTR::PlatformWebView::windowSnapshotImage):
     21
    1222012-11-27  Adam Barth  <abarth@webkit.org>
    223
  • trunk/Tools/WebKitTestRunner/TestInvocation.h

    r133768 r135935  
    5252    bool compareActualHashToExpectedAndDumpResults(const char[33]);
    5353
    54 #if PLATFORM(QT)
     54#if PLATFORM(QT) || PLATFORM(EFL)
    5555    static void forceRepaintDoneCallback(WKErrorRef, void* context);
    5656    void forceRepaintDone();
  • trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp

    r134074 r135935  
    3131
    3232#include "PixelDumpSupport.h"
     33#include "PlatformWebView.h"
     34#include "TestController.h"
    3335#include <WebKit2/WKImageCairo.h>
    3436#include <cairo/cairo.h>
     
    6264}
    6365
    64 static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length)
     66static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned length)
    6567{
    6668    Vector<unsigned char>* in = reinterpret_cast<Vector<unsigned char>*>(closure);
     
    105107}
    106108
     109#if PLATFORM(EFL)
     110void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context)
     111{
     112    static_cast<TestInvocation*>(context)->m_gotRepaint = true;
     113    TestController::shared().notifyDone();
     114}
     115#endif
     116
    107117void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
    108118{
     119#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
     120    UNUSED_PARAM(wkImage);
     121
     122    cairo_surface_t* surface;
     123
     124    WKPageRef page = TestController::shared().mainWebView()->page();
     125    WKPageForceRepaint(page, this, &forceRepaintDoneCallback);
     126
     127    TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout);
     128
     129    if (!m_gotRepaint) {
     130        m_error = true;
     131        m_errorMessage = "Timed out waiting for repaint\n";
     132        m_webProcessIsUnrensponsive = true;
     133        return;
     134    }
     135
     136    surface = WKImageCreateCairoSurface(TestController::shared().mainWebView()->windowSnapshotImage().get());
     137#else
    109138    cairo_surface_t* surface = WKImageCreateCairoSurface(wkImage);
     139#endif
    110140
    111141    if (repaintRects)
  • trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp

    r135287 r135935  
    2525#include "WebKit2/WKAPICast.h"
    2626#include <Ecore_Evas.h>
     27#include <WebCore/RefPtrCairo.h>
     28#include <WebKit2/WKImageCairo.h>
     29#include <cairo.h>
    2730
    2831using namespace WebKit;
     
    125128WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
    126129{
    127     // FIXME: implement to capture pixels in the UI process,
    128     // which may be necessary to capture things like 3D transforms.
    129     return 0;
     130    Ecore_Evas* ee = ecore_evas_ecore_evas_get(evas_object_evas_get(m_view));
     131    ASSERT(ee);
     132
     133    int width;
     134    int height;
     135    ecore_evas_geometry_get(ee, 0, 0, &width, &height);
     136    ASSERT(width > 0 && height > 0);
     137
     138    return adoptWK(WKViewGetSnapshot(toAPI(m_view)));
    130139}
    131140
Note: See TracChangeset for help on using the changeset viewer.