Changeset 135287 in webkit


Ignore:
Timestamp:
Nov 20, 2012 9:14:24 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[WTR] WebKitTestRunner should be able to run tests using fixed layout
https://bugs.webkit.org/show_bug.cgi?id=102517

Patch by Thiago Marcos P. Santos <thiago.santos@intel.com> on 2012-11-20
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Update EFL private API so we can create a view with fixed layout. We
can keep this as private as I don't see a real life use case for it
outside WTR and the WebInspector.

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

(WKViewCreate):
(WKViewCreateWithFixedLayout):

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

(ewk_view_base_add):

  • UIProcess/API/efl/ewk_view_private.h:
  • UIProcess/efl/WebInspectorProxyEfl.cpp:

(WebKit::WebInspectorProxy::platformCreateInspectorPage):

Tools:

WTR will now request the creation of a view that has a page using
fixed layout for CSS Device Adaptation tests, but this feature might
be used in the future by any other test that requires a mobile-like type
of viewport (i.e. Viewport META tests should be ported).

The viewport type of the other tests remains unchanged and is restored
when the runner leaves the device-adapt/ folder.

  • WebKitTestRunner/PlatformWebView.h:

(PlatformWebView):

  • WebKitTestRunner/TestInvocation.cpp:

(WTR):
(WTR::shouldUseFixedLayout):
(WTR::updateLayoutType):
(WTR::TestInvocation::invoke):

  • WebKitTestRunner/efl/PlatformWebViewEfl.cpp:

(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::viewSupportsOptions):
(WTR):

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r135283 r135287  
     12012-11-20  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        [WTR] WebKitTestRunner should be able to run tests using fixed layout
     4        https://bugs.webkit.org/show_bug.cgi?id=102517
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Update EFL private API so we can create a view with fixed layout. We
     9        can keep this as private as I don't see a real life use case for it
     10        outside WTR and the WebInspector.
     11
     12        * UIProcess/API/C/efl/WKView.cpp:
     13        (WKViewCreate):
     14        (WKViewCreateWithFixedLayout):
     15        * UIProcess/API/C/efl/WKView.h:
     16        * UIProcess/API/efl/ewk_view.cpp:
     17        (ewk_view_base_add):
     18        * UIProcess/API/efl/ewk_view_private.h:
     19        * UIProcess/efl/WebInspectorProxyEfl.cpp:
     20        (WebKit::WebInspectorProxy::platformCreateInspectorPage):
     21
    1222012-11-20  Allan Sandfeld Jensen  <allan.jensen@digia.com>
    223
  • trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp

    r132405 r135287  
    2929WKViewRef WKViewCreate(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    3030{
    31     return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef));
     31    return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::LegacyBehavior));
     32}
     33
     34WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
     35{
     36    return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::DefaultBehavior));
    3237}
    3338
  • trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h

    r120925 r135287  
    3131WK_EXPORT WKViewRef WKViewCreate(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
    3232
     33WK_EXPORT WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
     34
    3335WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
    3436
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp

    r134953 r135287  
    522522 * Constructs a ewk_view Evas_Object with WKType parameters.
    523523 */
    524 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
    525 {
    526     return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(toImpl(contextRef)), pageGroupRef, EwkViewImpl::LegacyBehavior);
     524Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef, EwkViewImpl::ViewBehavior behavior)
     525{
     526    return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(toImpl(contextRef)), pageGroupRef, behavior);
    527527}
    528528
  • trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h

    r132463 r135287  
    2222#define ewk_view_private_h
    2323
     24#include "EwkViewImpl.h"
    2425#include <Evas.h>
    2526#include <WebKit2/WKBase.h>
    2627
    27 Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
     28Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef, EwkViewImpl::ViewBehavior);
    2829
    2930#endif // ewk_view_private_h
  • trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp

    r135194 r135287  
    9999        return 0;
    100100
    101     m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()));
     101    m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()), EwkViewImpl::LegacyBehavior);
    102102    EwkViewImpl* inspectorViewImpl = EwkViewImpl::fromEvasObject(m_inspectorView);
    103103    inspectorViewImpl->setThemePath(TEST_THEME_DIR "/default.edj");
  • trunk/Tools/ChangeLog

    r135275 r135287  
     12012-11-20  Thiago Marcos P. Santos  <thiago.santos@intel.com>
     2
     3        [WTR] WebKitTestRunner should be able to run tests using fixed layout
     4        https://bugs.webkit.org/show_bug.cgi?id=102517
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        WTR will now request the creation of a view that has a page using
     9        fixed layout for CSS Device Adaptation tests, but this feature might
     10        be used in the future by any other test that requires a mobile-like type
     11        of viewport (i.e. Viewport META tests should be ported).
     12
     13        The viewport type of the other tests remains unchanged and is restored
     14        when the runner leaves the device-adapt/ folder.
     15
     16        * WebKitTestRunner/PlatformWebView.h:
     17        (PlatformWebView):
     18        * WebKitTestRunner/TestInvocation.cpp:
     19        (WTR):
     20        (WTR::shouldUseFixedLayout):
     21        (WTR::updateLayoutType):
     22        (WTR::TestInvocation::invoke):
     23        * WebKitTestRunner/efl/PlatformWebViewEfl.cpp:
     24        (WTR::PlatformWebView::PlatformWebView):
     25        (WTR::PlatformWebView::viewSupportsOptions):
     26        (WTR):
     27
    1282012-11-20  Csaba Osztrogonác  <ossy@webkit.org>
    229
  • trunk/Tools/WebKitTestRunner/PlatformWebView.h

    r132301 r135287  
    9090    bool windowIsKey() const { return m_windowIsKey; }
    9191
    92 #if PLATFORM(MAC)
     92#if PLATFORM(MAC) || PLATFORM(EFL)
    9393    bool viewSupportsOptions(WKDictionaryRef) const;
    9494#else
     
    102102    PlatformWindow m_window;
    103103    bool m_windowIsKey;
     104#if PLATFORM(EFL)
     105    bool m_usingFixedLayout;
     106#endif
    104107#if PLATFORM(QT)
    105108    QEventLoop* m_modalEventLoop;
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r133768 r135287  
    11/*
    22 * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
     3 * Copyright (C) 2012 Intel Corporation. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    166167}
    167168
     169#if ENABLE(CSS_DEVICE_ADAPTATION)
     170static bool shouldUseFixedLayout(const char* pathOrURL)
     171{
     172    return strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\");
     173}
     174#endif
     175
     176static void updateLayoutType(const char* pathOrURL)
     177{
     178#if ENABLE(CSS_DEVICE_ADAPTATION)
     179    WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());
     180    WKRetainPtr<WKStringRef> useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout"));
     181    WKRetainPtr<WKBooleanRef> useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(pathOrURL)));
     182    WKDictionaryAddItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get());
     183
     184    TestController::shared().ensureViewSupportsOptions(viewOptions.get());
     185#else
     186    UNUSED_PARAM(pathOrURL);
     187#endif
     188}
     189
    168190void TestInvocation::invoke()
    169191{
    170192    sizeWebViewForCurrentTest(m_pathOrURL.c_str());
     193    updateLayoutType(m_pathOrURL.c_str());
    171194    updateTiledDrawingForCurrentTest(m_pathOrURL.c_str());
    172195
  • trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp

    r135246 r135287  
    11/*
    22 * Copyright (C) 2012 Samsung Electronics
     3 * Copyright (C) 2012 Intel Corporation. All rights reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    4950}
    5051
    51 PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKDictionaryRef /*options*/)
     52PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKDictionaryRef options)
    5253{
     54    WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
     55    m_usingFixedLayout = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false;
     56
    5357    m_window = initEcoreEvas();
    5458    Evas* evas = ecore_evas_get(m_window);
    55     m_view = toImpl(WKViewCreate(evas, context, pageGroup));
     59
     60    if (m_usingFixedLayout) {
     61        m_view = toImpl(WKViewCreateWithFixedLayout(evas, context, pageGroup));
     62        evas_object_resize(m_view, 800, 600);
     63    } else
     64        m_view = toImpl(WKViewCreate(evas, context, pageGroup));
    5665
    5766    ewk_view_theme_set(m_view, THEME_DIR"/default.edj");
     
    121130}
    122131
     132bool PlatformWebView::viewSupportsOptions(WKDictionaryRef options) const
     133{
     134    WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
     135
     136    return m_usingFixedLayout == (options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false);
     137}
     138
    123139} // namespace WTR
    124140
Note: See TracChangeset for help on using the changeset viewer.