Title: [141827] trunk/Source/WebKit2
Revision
141827
Author
[email protected]
Date
2013-02-04 15:57:37 -0800 (Mon, 04 Feb 2013)

Log Message

[EFL][WK2] Use C API inside EwkView
https://bugs.webkit.org/show_bug.cgi?id=108825

Reviewed by Anders Carlsson.

A straight-forward port towards the C API.

* UIProcess/API/efl/EwkView.cpp:
(EwkView::EwkView): Use C API for common default preferences.
(EwkView::wkPage): Make it const and remove useless comment.
(EwkView::deviceScaleFactor):
(EwkView::title):
(EwkView::customTextEncodingName):
(EwkView::setCustomTextEncodingName):
(EwkView::informURLChange):
* UIProcess/API/efl/EwkView.h:
(EwkView):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (141826 => 141827)


--- trunk/Source/WebKit2/ChangeLog	2013-02-04 23:55:06 UTC (rev 141826)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-04 23:57:37 UTC (rev 141827)
@@ -1,3 +1,23 @@
+2013-02-04  Kenneth Rohde Christiansen  <[email protected]>
+
+        [EFL][WK2] Use C API inside EwkView
+        https://bugs.webkit.org/show_bug.cgi?id=108825
+
+        Reviewed by Anders Carlsson.
+
+        A straight-forward port towards the C API.
+
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkView::EwkView): Use C API for common default preferences.
+        (EwkView::wkPage): Make it const and remove useless comment.
+        (EwkView::deviceScaleFactor):
+        (EwkView::title):
+        (EwkView::customTextEncodingName):
+        (EwkView::setCustomTextEncodingName):
+        (EwkView::informURLChange):
+        * UIProcess/API/efl/EwkView.h:
+        (EwkView):
+
 2013-02-04  Alexey Proskuryakov  <[email protected]>
 
         Remove an unnecessary sandbox rule.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (141826 => 141827)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-02-04 23:55:06 UTC (rev 141826)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-02-04 23:57:37 UTC (rev 141827)
@@ -37,6 +37,7 @@
 #include "WKDictionary.h"
 #include "WKGeometry.h"
 #include "WKNumber.h"
+#include "WKPageGroup.h"
 #include "WKString.h"
 #include "WebContext.h"
 #include "WebImage.h"
@@ -146,6 +147,16 @@
     ASSERT(m_context);
     ASSERT(m_pageProxy);
 
+    WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior);
+
+    WKPageGroupRef wkPageGroup = WKPageGetPageGroup(wkPage());
+    WKPreferencesRef wkPreferences = WKPageGroupGetPreferences(wkPageGroup);
+
+    WKPreferencesSetWebGLEnabled(wkPreferences, true);
+    WKPreferencesSetFullScreenEnabled(wkPreferences, true);
+    WKPreferencesSetWebAudioEnabled(wkPreferences, true);
+    WKPreferencesSetOfflineWebApplicationCacheEnabled(wkPreferences, true);
+
 #if USE(COORDINATED_GRAPHICS)
     m_pageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true);
     m_pageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
@@ -153,25 +164,14 @@
     bool showDebugVisuals = debugVisualsEnvironment && !strcmp(debugVisualsEnvironment, "1");
     m_pageProxy->pageGroup()->preferences()->setCompositingBordersVisible(showDebugVisuals);
     m_pageProxy->pageGroup()->preferences()->setCompositingRepaintCountersVisible(showDebugVisuals);
-#if ENABLE(WEBGL)
-    m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(true);
 #endif
-    if (behavior == DefaultBehavior)
-        m_pageProxy->setUseFixedLayout(true);
-#endif
 
     m_pageProxy->initializeWebPage();
 
 #if ENABLE(FULLSCREEN_API)
     m_pageProxy->fullScreenManager()->setWebView(m_evasObject);
-    m_pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
 #endif
-#if ENABLE(WEB_AUDIO)
-    m_pageProxy->pageGroup()->preferences()->setWebAudioEnabled(true);
-#endif
 
-    m_pageProxy->pageGroup()->preferences()->setOfflineWebApplicationCacheEnabled(true);
-
     // Enable mouse events by default
     setMouseEventsEnabled(true);
 
@@ -211,11 +211,7 @@
     return sd->priv;
 }
 
-/**
- * @internal
- * Retrieves the internal WKPage for this view.
- */
-WKPageRef EwkView::wkPage()
+WKPageRef EwkView::wkPage() const
 {
     return toAPI(m_pageProxy.get());
 }
@@ -301,7 +297,7 @@
 
 float EwkView::deviceScaleFactor() const
 {
-    return m_pageProxy->deviceScaleFactor();
+    return WKPageGetBackingScaleFactor(wkPage());
 }
 
 AffineTransform EwkView::transformFromScene() const
@@ -527,7 +523,7 @@
 
 const char* EwkView::title() const
 {
-    m_title = m_pageProxy->pageTitle().utf8().data();
+    m_title = WKEinaSharedString(AdoptWK, WKPageCopyTitle(wkPage()));
 
     return m_title;
 }
@@ -556,18 +552,19 @@
 
 const char* EwkView::customTextEncodingName() const
 {
-    String customEncoding = m_pageProxy->customTextEncodingName();
-    if (customEncoding.isEmpty())
+    WKRetainPtr<WKStringRef> customEncoding = adoptWK(WKPageCopyCustomTextEncodingName(wkPage()));
+    if (WKStringIsEmpty(customEncoding.get()))
         return 0;
 
-    m_customEncoding = customEncoding.utf8().data();
+    m_customEncoding = WKEinaSharedString(customEncoding.get());
 
     return m_customEncoding;
 }
 
 void EwkView::setCustomTextEncodingName(const String& encoding)
 {
-    m_pageProxy->setCustomTextEncodingName(encoding);
+    WKRetainPtr<WKStringRef> wkEncoding = adoptWK(toCopiedAPI(encoding));
+    WKPageSetCustomTextEncodingName(wkPage(), wkEncoding.get());
 }
 
 void EwkView::setMouseEventsEnabled(bool enabled)
@@ -894,15 +891,13 @@
  */
 void EwkView::informURLChange()
 {
-    String activeURL = m_pageProxy->activeURL();
-    if (activeURL.isEmpty())
-        return;
+    WKRetainPtr<WKURLRef> wkActiveURL = adoptWK(WKPageCopyActiveURL(wkPage()));
+    WKRetainPtr<WKStringRef> wkURLString = wkActiveURL ? adoptWK(WKURLCopyString(wkActiveURL.get())) : adoptWK(WKStringCreateWithUTF8CString(""));
 
-    CString rawActiveURL = activeURL.utf8();
-    if (m_url == rawActiveURL.data())
+    if (WKStringIsEqualToUTF8CString(wkURLString.get(), m_url))
         return;
 
-    m_url = rawActiveURL.data();
+    m_url = WKEinaSharedString(wkURLString.get());
     smartCallback<URLChanged>().call(m_url);
 
     // Update the view's favicon.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h (141826 => 141827)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-02-04 23:55:06 UTC (rev 141826)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-02-04 23:57:37 UTC (rev 141827)
@@ -108,7 +108,7 @@
     static EwkView* fromEvasObject(const Evas_Object* view);
     Evas_Object* view() { return m_evasObject; }
 
-    WKPageRef wkPage();
+    WKPageRef wkPage() const;
     WebKit::WebPageProxy* page() { return m_pageProxy.get(); }
     EwkContext* ewkContext() { return m_context.get(); }
     EwkSettings* settings() { return m_settings.get(); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to