Title: [135287] trunk
Revision
135287
Author
commit-qu...@webkit.org
Date
2012-11-20 09:14:24 -0800 (Tue, 20 Nov 2012)

Log 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.san...@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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (135286 => 135287)


--- trunk/Source/WebKit2/ChangeLog	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-20 17:14:24 UTC (rev 135287)
@@ -1,3 +1,24 @@
+2012-11-20  Thiago Marcos P. Santos  <thiago.san...@intel.com>
+
+        [WTR] WebKitTestRunner should be able to run tests using fixed layout
+        https://bugs.webkit.org/show_bug.cgi?id=102517
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        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):
+
 2012-11-20  Allan Sandfeld Jensen  <allan.jen...@digia.com>
 
         [Qt] PageViewportControllerClient::didChangeViewportAttributes called twice

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp (135286 => 135287)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp	2012-11-20 17:14:24 UTC (rev 135287)
@@ -28,9 +28,14 @@
 
 WKViewRef WKViewCreate(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
 {
-    return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef));
+    return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::LegacyBehavior));
 }
 
+WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+{
+    return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::DefaultBehavior));
+}
+
 WKPageRef WKViewGetPage(WKViewRef viewRef)
 {
     EwkViewImpl* viewImpl = EwkViewImpl::fromEvasObject(toImpl(viewRef));

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h (135286 => 135287)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKView.h	2012-11-20 17:14:24 UTC (rev 135287)
@@ -30,6 +30,8 @@
 
 WK_EXPORT WKViewRef WKViewCreate(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
 
+WK_EXPORT WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
+
 WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
 
 #ifdef __cplusplus

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (135286 => 135287)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-11-20 17:14:24 UTC (rev 135287)
@@ -521,9 +521,9 @@
  * @internal
  * Constructs a ewk_view Evas_Object with WKType parameters.
  */
-Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef, EwkViewImpl::ViewBehavior behavior)
 {
-    return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(toImpl(contextRef)), pageGroupRef, EwkViewImpl::LegacyBehavior);
+    return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(toImpl(contextRef)), pageGroupRef, behavior);
 }
 
 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h (135286 => 135287)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h	2012-11-20 17:14:24 UTC (rev 135287)
@@ -21,9 +21,10 @@
 #ifndef ewk_view_private_h
 #define ewk_view_private_h
 
+#include "EwkViewImpl.h"
 #include <Evas.h>
 #include <WebKit2/WKBase.h>
 
-Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
+Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef, EwkViewImpl::ViewBehavior);
 
 #endif // ewk_view_private_h

Modified: trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp (135286 => 135287)


--- trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Source/WebKit2/UIProcess/efl/WebInspectorProxyEfl.cpp	2012-11-20 17:14:24 UTC (rev 135287)
@@ -98,7 +98,7 @@
     if (!m_inspectorWindow)
         return 0;
 
-    m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()));
+    m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup()), EwkViewImpl::LegacyBehavior);
     EwkViewImpl* inspectorViewImpl = EwkViewImpl::fromEvasObject(m_inspectorView);
     inspectorViewImpl->setThemePath(TEST_THEME_DIR "/default.edj");
 

Modified: trunk/Tools/ChangeLog (135286 => 135287)


--- trunk/Tools/ChangeLog	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Tools/ChangeLog	2012-11-20 17:14:24 UTC (rev 135287)
@@ -1,3 +1,30 @@
+2012-11-20  Thiago Marcos P. Santos  <thiago.san...@intel.com>
+
+        [WTR] WebKitTestRunner should be able to run tests using fixed layout
+        https://bugs.webkit.org/show_bug.cgi?id=102517
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        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):
+
 2012-11-20  Csaba Osztrogonác  <o...@webkit.org>
 
         [Qt] REGRESSION(r128174): Fast build path doesn't work now

Modified: trunk/Tools/WebKitTestRunner/PlatformWebView.h (135286 => 135287)


--- trunk/Tools/WebKitTestRunner/PlatformWebView.h	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Tools/WebKitTestRunner/PlatformWebView.h	2012-11-20 17:14:24 UTC (rev 135287)
@@ -89,7 +89,7 @@
     void setWindowIsKey(bool isKey) { m_windowIsKey = isKey; }
     bool windowIsKey() const { return m_windowIsKey; }
 
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(EFL)
     bool viewSupportsOptions(WKDictionaryRef) const;
 #else
     bool viewSupportsOptions(WKDictionaryRef) const { return true; }
@@ -101,6 +101,9 @@
     PlatformWKView m_view;
     PlatformWindow m_window;
     bool m_windowIsKey;
+#if PLATFORM(EFL)
+    bool m_usingFixedLayout;
+#endif
 #if PLATFORM(QT)
     QEventLoop* m_modalEventLoop;
 #endif

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (135286 => 135287)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2012-11-20 17:14:24 UTC (rev 135287)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * 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
@@ -165,9 +166,31 @@
 #endif
 }
 
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+static bool shouldUseFixedLayout(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "device-adapt/") || strstr(pathOrURL, "device-adapt\\");
+}
+#endif
+
+static void updateLayoutType(const char* pathOrURL)
+{
+#if ENABLE(CSS_DEVICE_ADAPTATION)
+    WKRetainPtr<WKMutableDictionaryRef> viewOptions = adoptWK(WKMutableDictionaryCreate());
+    WKRetainPtr<WKStringRef> useFixedLayoutKey = adoptWK(WKStringCreateWithUTF8CString("UseFixedLayout"));
+    WKRetainPtr<WKBooleanRef> useFixedLayoutValue = adoptWK(WKBooleanCreate(shouldUseFixedLayout(pathOrURL)));
+    WKDictionaryAddItem(viewOptions.get(), useFixedLayoutKey.get(), useFixedLayoutValue.get());
+
+    TestController::shared().ensureViewSupportsOptions(viewOptions.get());
+#else
+    UNUSED_PARAM(pathOrURL);
+#endif
+}
+
 void TestInvocation::invoke()
 {
     sizeWebViewForCurrentTest(m_pathOrURL.c_str());
+    updateLayoutType(m_pathOrURL.c_str());
     updateTiledDrawingForCurrentTest(m_pathOrURL.c_str());
 
     WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("BeginTest"));

Modified: trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp (135286 => 135287)


--- trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp	2012-11-20 16:32:32 UTC (rev 135286)
+++ trunk/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp	2012-11-20 17:14:24 UTC (rev 135287)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 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
@@ -48,12 +49,20 @@
     return ecoreEvas;
 }
 
-PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKDictionaryRef /*options*/)
+PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKDictionaryRef options)
 {
+    WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
+    m_usingFixedLayout = options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false;
+
     m_window = initEcoreEvas();
     Evas* evas = ecore_evas_get(m_window);
-    m_view = toImpl(WKViewCreate(evas, context, pageGroup));
 
+    if (m_usingFixedLayout) {
+        m_view = toImpl(WKViewCreateWithFixedLayout(evas, context, pageGroup));
+        evas_object_resize(m_view, 800, 600);
+    } else
+        m_view = toImpl(WKViewCreate(evas, context, pageGroup));
+
     ewk_view_theme_set(m_view, THEME_DIR"/default.edj");
     m_windowIsKey = false;
     evas_object_show(m_view);
@@ -120,5 +129,12 @@
     return 0;
 }
 
+bool PlatformWebView::viewSupportsOptions(WKDictionaryRef options) const
+{
+    WKRetainPtr<WKStringRef> useFixedLayoutKey(AdoptWK, WKStringCreateWithUTF8CString("UseFixedLayout"));
+
+    return m_usingFixedLayout == (options ? WKBooleanGetValue(static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(options, useFixedLayoutKey.get()))) : false);
+}
+
 } // namespace WTR
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to