[EFL] Move codes related to theme setting from Widget to RenderTheme
authorryuan.choi@samsung.com <ryuan.choi@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 07:52:29 +0000 (07:52 +0000)
committerryuan.choi@samsung.com <ryuan.choi@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Jul 2012 07:52:29 +0000 (07:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89842

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

WebKit/Efl uses custom theme for Scrollbar, RenderTheme and Cursor.
However, theme information itself is in WidgetEfl so it is accessed by
calling recursive function.
Because theme is managed by each page, this patch moves codes related to
theme from WidgetEfl to RenderThemeEfl which is contained by page.

* platform/Widget.h: Removed functions related to theme.
* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::setThemePath): Added to set theme path.
(WebCore::RenderThemeEfl::createEdje): Updated method to use RenderThemeEfl's theme.
(WebCore::RenderThemeEfl::RenderThemeEfl):
* platform/efl/RenderThemeEfl.h:
(WebCore::RenderThemeEfl::themePath): Added to get theme path
* platform/efl/ScrollbarEfl.cpp: Updated method to use RenderThemeEfl's theme.
(ScrollbarEfl::setParent):
* platform/efl/WidgetEfl.cpp: Removed codes related theme.
(WidgetPrivate):

Source/WebKit:

* CMakeLists.txt: Added html/shadow to WebKit_INCLUDE_DIRECTORIES.

Source/WebKit/efl:

* ewk/ewk_frame.cpp:
(ewk_frame_view_create_for_view): Removed codes which set theme in FrameView.
* ewk/ewk_view.cpp:
(ewk_view_theme_set): Called RenderThemeEfl::setThemePath instead of setting theme in FrameView.

Source/WebKit2:

* CMakeLists.txt: Added html/shadow to WebKit_INCLUDE_DIRECTORIES.
* WebProcess/WebPage/efl/WebPageEfl.cpp:
(WebKit::WebPage::setThemePath): Called RenderThemeEfl::setThemePath instead of setting theme in FrameView.

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

14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/Widget.h
Source/WebCore/platform/efl/RenderThemeEfl.cpp
Source/WebCore/platform/efl/RenderThemeEfl.h
Source/WebCore/platform/efl/ScrollbarEfl.cpp
Source/WebCore/platform/efl/WidgetEfl.cpp
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_frame.cpp
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp

index 5159984..bcb0524 100644 (file)
@@ -1,3 +1,28 @@
+2012-07-17  Ryuan Choi  <ryuan.choi@samsung.com>
+
+        [EFL] Move codes related to theme setting from Widget to RenderTheme
+        https://bugs.webkit.org/show_bug.cgi?id=89842
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        WebKit/Efl uses custom theme for Scrollbar, RenderTheme and Cursor.
+        However, theme information itself is in WidgetEfl so it is accessed by
+        calling recursive function.
+        Because theme is managed by each page, this patch moves codes related to
+        theme from WidgetEfl to RenderThemeEfl which is contained by page.
+
+        * platform/Widget.h: Removed functions related to theme.
+        * platform/efl/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::setThemePath): Added to set theme path.
+        (WebCore::RenderThemeEfl::createEdje): Updated method to use RenderThemeEfl's theme.
+        (WebCore::RenderThemeEfl::RenderThemeEfl):
+        * platform/efl/RenderThemeEfl.h:
+        (WebCore::RenderThemeEfl::themePath): Added to get theme path
+        * platform/efl/ScrollbarEfl.cpp: Updated method to use RenderThemeEfl's theme.
+        (ScrollbarEfl::setParent):
+        * platform/efl/WidgetEfl.cpp: Removed codes related theme.
+        (WidgetPrivate):
+
 2012-07-17  Shinya Kawanaka  <shinyak@chromium.org>
 
         HTMLMediaElement should not use Element::ensureShadowRoot()
index fbb0020..345b321 100644 (file)
@@ -221,10 +221,6 @@ public:
 
     void setEvasObject(Evas_Object*);
     Evas_Object* evasObject() const;
-
-    const String edjeTheme() const;
-    void setEdjeTheme(const String &);
-    const String edjeThemeRecursive() const;
 #endif
 
 #if PLATFORM(CHROMIUM)
index 462ee94..ed3d692 100644 (file)
@@ -27,9 +27,6 @@
 #include "RenderThemeEfl.h"
 
 #include "CSSValueKeywords.h"
-#include "FileSystem.h"
-#include "Frame.h"
-#include "FrameView.h"
 #include "GraphicsContext.h"
 #include "HTMLInputElement.h"
 #include "NotImplemented.h"
@@ -422,6 +419,15 @@ static void renderThemeEflColorClassFocusRing(void* data, Evas_Object* object, c
     that->setFocusRingColor(fr, fg, fb, fa);
 }
 
+void RenderThemeEfl::setThemePath(const String& path)
+{
+    if (path == m_themePath)
+        return;
+
+    m_themePath = path;
+    themeChanged();
+}
+
 void RenderThemeEfl::createCanvas()
 {
     ASSERT(!m_canvas);
@@ -432,20 +438,17 @@ void RenderThemeEfl::createCanvas()
 void RenderThemeEfl::createEdje()
 {
     ASSERT(!m_edje);
-    Frame* frame = m_page ? m_page->mainFrame() : 0;
-    FrameView* view = frame ? frame->view() : 0;
-    String theme = view ? view->edjeThemeRecursive() : "";
-    if (theme.isEmpty())
+    if (m_themePath.isEmpty())
         EINA_LOG_ERR("No theme defined, unable to set RenderThemeEfl.");
     else {
         m_edje = edje_object_add(ecore_evas_get(m_canvas));
         if (!m_edje)
             EINA_LOG_ERR("Could not create base edje object.");
-        else if (!edje_object_file_set(m_edje, theme.utf8().data(), "webkit/base")) {
+        else if (!edje_object_file_set(m_edje, m_themePath.utf8().data(), "webkit/base")) {
             Edje_Load_Error err = edje_object_load_error_get(m_edje);
             const char* errmsg = edje_load_error_str(err);
             EINA_LOG_ERR("Could not load 'webkit/base' from theme %s: %s",
-                         theme.utf8().data(), errmsg);
+                         m_themePath.utf8().data(), errmsg);
             evas_object_del(m_edje);
             m_edje = 0;
         } else {
@@ -660,8 +663,6 @@ RenderThemeEfl::RenderThemeEfl(Page* page)
     , m_canvas(0)
     , m_edje(0)
 {
-    if (page && page->mainFrame() && page->mainFrame()->view())
-        themeChanged();
 }
 
 RenderThemeEfl::~RenderThemeEfl()
index c2e47d0..bbcb4e3 100644 (file)
@@ -196,6 +196,8 @@ public:
     virtual bool paintMediaCurrentTime(RenderObject*, const PaintInfo&, const IntRect&);
 #endif
 
+    void setThemePath(const String&);
+    String themePath() { return m_themePath; }
 protected:
     static float defaultFontSize;
 
@@ -225,6 +227,8 @@ private:
     Color m_mediaPanelColor;
     Color m_mediaSliderColor;
 #endif
+
+    String m_themePath;
     Ecore_Evas* m_canvas;
     Evas_Object* m_edje;
 
index 65dd68d..ce7f7bf 100644 (file)
 #include "config.h"
 #include "ScrollbarEfl.h"
 
-#include "ChromeClient.h"
 #include "Frame.h"
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "HostWindow.h"
 #include "IntRect.h"
 #include "Page.h"
+#include "RenderThemeEfl.h"
 #include "ScrollbarTheme.h"
 #include "Settings.h"
 
@@ -112,9 +112,17 @@ void ScrollbarEfl::setParent(ScrollView* view)
         return;
     }
 
+    Frame* frame = static_cast<FrameView*>(view)->frame();
+    if (!frame)
+        return;
+
+    Page* page = frame->page();
+    if (!page)
+        return;
+
     const char* group = (orientation() == HorizontalScrollbar)
         ? "scrollbar.horizontal" : "scrollbar.vertical";
-    String theme(edjeThemeRecursive());
+    String theme = static_cast<RenderThemeEfl*>(page->theme())->themePath();
 
     if (theme.isEmpty()) {
         EINA_LOG_ERR("Could not load theme '%s': no theme path set.", group);
index 138bdfa..8f8f2e7 100644 (file)
@@ -51,7 +51,6 @@ class WidgetPrivate {
 public:
     Evas* m_evas;
     Evas_Object* m_evasObject;
-    String m_theme;
 
     WidgetPrivate()
         : m_evas(0)
@@ -145,29 +144,6 @@ void Widget::setIsSelected(bool)
     notImplemented();
 }
 
-const String Widget::edjeTheme() const
-{
-    return m_data->m_theme;
-}
-
-void Widget::setEdjeTheme(const String& themePath)
-{
-    if (m_data->m_theme == themePath)
-        return;
-
-    m_data->m_theme = themePath;
-}
-
-const String Widget::edjeThemeRecursive() const
-{
-    if (!m_data->m_theme.isNull())
-        return m_data->m_theme;
-    if (m_parent)
-        return m_parent->edjeThemeRecursive();
-
-    return String();
-}
-
 Evas* Widget::evas() const
 {
     return m_data->m_evas;
index 37ad197..d25fb81 100644 (file)
@@ -16,6 +16,7 @@ SET(WebKit_INCLUDE_DIRECTORIES
     "${WEBCORE_DIR}/editing"
     "${WEBCORE_DIR}/history"
     "${WEBCORE_DIR}/html"
+    "${WEBCORE_DIR}/html/shadow"
     "${WEBCORE_DIR}/inspector"
     "${WEBCORE_DIR}/loader"
     "${WEBCORE_DIR}/loader/appcache"
index 9cb80bb..b23ac6d 100644 (file)
@@ -1,3 +1,12 @@
+2012-07-17  Ryuan Choi  <ryuan.choi@samsung.com>
+
+        [EFL] Move codes related to theme setting from Widget to RenderTheme
+        https://bugs.webkit.org/show_bug.cgi?id=89842
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * CMakeLists.txt: Added html/shadow to WebKit_INCLUDE_DIRECTORIES.
+
 2012-07-16  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Add RegisterProtocolHandlerClient to the Modules/protocolhandler
index 20c30a4..624bea7 100644 (file)
@@ -1,3 +1,15 @@
+2012-07-17  Ryuan Choi  <ryuan.choi@samsung.com>
+
+        [EFL] Move codes related to theme setting from Widget to RenderTheme
+        https://bugs.webkit.org/show_bug.cgi?id=89842
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_view_create_for_view): Removed codes which set theme in FrameView.
+        * ewk/ewk_view.cpp:
+        (ewk_view_theme_set): Called RenderThemeEfl::setThemePath instead of setting theme in FrameView.
+
 2012-07-16  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Add RegisterProtocolHandlerClient to the Modules/protocolhandler
index 67a9bc8..6a4b1a3 100644 (file)
@@ -1654,8 +1654,6 @@ void ewk_frame_view_create_for_view(Evas_Object* ewkFrame, Evas_Object* view)
     if (!smartData->frame->view())
         return;
 
-    const char* theme = ewk_view_theme_get(view);
-    smartData->frame->view()->setEdjeTheme(theme);
     smartData->frame->view()->setEvasObject(ewkFrame);
 
     ewk_frame_mixed_content_displayed_set(ewkFrame, false);
index 77e9250..f0859df 100644 (file)
@@ -53,7 +53,7 @@
 #include "PopupMenuClient.h"
 #include "ProgressTracker.h"
 #include "RefPtrCairo.h"
-#include "RenderTheme.h"
+#include "RenderThemeEfl.h"
 #include "ResourceHandle.h"
 #include "Settings.h"
 #include "c_instance.h"
@@ -1384,12 +1384,8 @@ void ewk_view_theme_set(Evas_Object* ewkView, const char* path)
     if (!eina_stringshare_replace(&priv->settings.theme, path))
         return;
 
-    WebCore::FrameView* view = priv->mainFrame->view();
-    if (view) {
-        view->setEdjeTheme(WTF::String(path));
-        priv->page->theme()->themeChanged();
-    }
-
+    WebCore::RenderThemeEfl* theme = static_cast<WebCore::RenderThemeEfl*>(priv->page->theme());
+    theme->setThemePath(path);
 }
 
 const char* ewk_view_theme_get(const Evas_Object* ewkView)
index 1da9a6a..c8d1c35 100644 (file)
@@ -55,6 +55,7 @@ SET(WebKit2_INCLUDE_DIRECTORIES
     "${WEBCORE_DIR}/editing"
     "${WEBCORE_DIR}/history"
     "${WEBCORE_DIR}/html"
+    "${WEBCORE_DIR}/html/shadow"
     "${WEBCORE_DIR}/html/track"
     "${WEBCORE_DIR}/inspector"
     "${WEBCORE_DIR}/loader"
index f93f443..af1d1f4 100644 (file)
@@ -1,3 +1,14 @@
+2012-07-17  Ryuan Choi  <ryuan.choi@samsung.com>
+
+        [EFL] Move codes related to theme setting from Widget to RenderTheme
+        https://bugs.webkit.org/show_bug.cgi?id=89842
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * CMakeLists.txt: Added html/shadow to WebKit_INCLUDE_DIRECTORIES.
+        * WebProcess/WebPage/efl/WebPageEfl.cpp:
+        (WebKit::WebPage::setThemePath): Called RenderThemeEfl::setThemePath instead of setting theme in FrameView.
+
 2012-07-17  David Barr  <davidbarr@chromium.org>
 
         Introduce ENABLE_CSS_IMAGE_ORIENTATION compile flag
index 6c1ec8b..fa57035 100644 (file)
@@ -38,7 +38,7 @@
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/Page.h>
 #include <WebCore/PlatformKeyboardEvent.h>
-#include <WebCore/RenderTheme.h>
+#include <WebCore/RenderThemeEfl.h>
 #include <WebCore/Settings.h>
 
 using namespace WebCore;
@@ -108,15 +108,8 @@ const char* WebPage::interpretKeyEvent(const KeyboardEvent* event)
 
 void WebPage::setThemePath(const String& themePath)
 {
-    Frame* mainFrame = m_page->mainFrame();
-    if (!mainFrame)
-        return;
-
-    WebCore::FrameView* view = mainFrame->view();
-    if (view) {
-        view->setEdjeTheme(themePath);
-        m_page->theme()->themeChanged();
-    }
+    WebCore::RenderThemeEfl* theme = static_cast<WebCore::RenderThemeEfl*>(m_page->theme());
+    theme->setThemePath(themePath);
 }
 
 } // namespace WebKit