Unreviewed, rolling out r127573.
authordominik.rottsches@intel.com <dominik.rottsches@intel.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2012 12:34:58 +0000 (12:34 +0000)
committerdominik.rottsches@intel.com <dominik.rottsches@intel.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2012 12:34:58 +0000 (12:34 +0000)
http://trac.webkit.org/changeset/127573
https://bugs.webkit.org/show_bug.cgi?id=95844

Breaks EFL Debug bot tests. (Requested by drott on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-05

* platform/efl/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::themePartCacheEntryReset):
(WebCore::RenderThemeEfl::cacheThemePartNew):
(WebCore::RenderThemeEfl::paintThemePart):
(WebCore::RenderThemeEfl::setThemePath):
(WebCore::RenderThemeEfl::createCanvas):
(WebCore::RenderThemeEfl::createEdje):
(WebCore::RenderThemeEfl::applyPartDescriptions):
(WebCore::RenderThemeEfl::themeChanged):
(WebCore):
* platform/efl/RenderThemeEfl.h:
(RenderThemeEfl):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/efl/RenderThemeEfl.cpp
Source/WebCore/platform/efl/RenderThemeEfl.h

index 274d39d..df4e1d6 100644 (file)
@@ -1,3 +1,24 @@
+2012-09-05  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r127573.
+        http://trac.webkit.org/changeset/127573
+        https://bugs.webkit.org/show_bug.cgi?id=95844
+
+        Breaks EFL Debug bot tests. (Requested by drott on #webkit).
+
+        * platform/efl/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::themePartCacheEntryReset):
+        (WebCore::RenderThemeEfl::cacheThemePartNew):
+        (WebCore::RenderThemeEfl::paintThemePart):
+        (WebCore::RenderThemeEfl::setThemePath):
+        (WebCore::RenderThemeEfl::createCanvas):
+        (WebCore::RenderThemeEfl::createEdje):
+        (WebCore::RenderThemeEfl::applyPartDescriptions):
+        (WebCore::RenderThemeEfl::themeChanged):
+        (WebCore):
+        * platform/efl/RenderThemeEfl.h:
+        (RenderThemeEfl):
+
 2012-09-05  MORITA Hajime  <morrita@google.com>
 
         ShadowRoot.cloneNode() must always throw a DATA_CLONE_ERR exception.
index 37b6a35..98c81c2 100644 (file)
@@ -103,6 +103,9 @@ bool RenderThemeEfl::themePartCacheEntryReset(struct ThemePartCacheEntry* entry,
 {
     const char *file, *group;
 
+    ASSERT(entry);
+    ASSERT(m_edje);
+
     edje_object_file_get(m_edje, &file, 0);
     group = edjeGroupFromFormType(type);
     ASSERT(file);
@@ -156,7 +159,7 @@ bool RenderThemeEfl::isFormElementTooLargeToDisplay(const IntSize& elementSize)
 struct RenderThemeEfl::ThemePartCacheEntry* RenderThemeEfl::cacheThemePartNew(FormType type, const IntSize& size)
 {
     if (isFormElementTooLargeToDisplay(size)) {
-        EINA_LOG_ERR("Cannot render an element of size %dx%d.", size.width(), size.height());
+        EINA_LOG_ERR("cannot render an element of size %dx%d", size.width(), size.height());
         return 0;
     }
 
@@ -308,15 +311,13 @@ void RenderThemeEfl::applyEdjeStateFromForm(Evas_Object* object, ControlStates s
 
 bool RenderThemeEfl::paintThemePart(RenderObject* object, FormType type, const PaintInfo& info, const IntRect& rect)
 {
-    if (!edje()) {
-        EINA_LOG_ERR("Could not paint native HTML part due to missing theme.");
-        return false;
-    }
-
     ThemePartCacheEntry* entry;
     Eina_List* updates;
     cairo_t* cairo;
 
+    ASSERT(m_canvas);
+    ASSERT(m_edje);
+
     entry = cacheThemePartGet(type, rect.size());
     if (!entry)
         return false;
@@ -437,59 +438,44 @@ void RenderThemeEfl::setThemePath(const String& path)
         return;
 
     m_themePath = path;
+    themeChanged();
+}
 
-    if (m_themePath.isEmpty()) {
-        EINA_LOG_ERR("No theme defined, unable to set theme for HTML Forms.");
-        return;
-    }
-
-    if (!m_canvas) {
-        m_canvas = ecore_evas_buffer_new(1, 1);
-        if (!m_canvas)
-            EINA_LOG_ERR("Could not create canvas.");
-    }
-
-    if (m_edje) {
-        // Get rid of current theme.
-        cacheThemePartFlush();
-        evas_object_del(m_edje);
-        m_edje = 0;
-    }
+void RenderThemeEfl::createCanvas()
+{
+    ASSERT(!m_canvas);
+    m_canvas = ecore_evas_buffer_new(1, 1);
+    ASSERT(m_canvas);
 }
 
-Evas_Object* RenderThemeEfl::edje()
+void RenderThemeEfl::createEdje()
 {
-    if (!m_edje) {
+    ASSERT(!m_edje);
+    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_CRIT("Could not create base Edje object.");
-            return 0;
-        }
-
-        if (!edje_object_file_set(m_edje, m_themePath.utf8().data(), "webkit/base")) {
+        if (!m_edje)
+            EINA_LOG_ERR("Could not create base edje object.");
+        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_CRIT("Could not set file '%s': %s", m_themePath.utf8().data(),  errmsg);
-
+            EINA_LOG_ERR("Could not set file: %s", errmsg);
             evas_object_del(m_edje);
             m_edje = 0;
-            return 0;
-        }
-
+        } else {
 #define CONNECT(cc, func)                                               \
             edje_object_signal_callback_add(m_edje, "color_class,set",  \
                                             "webkit/"cc, func, this)
 
-        CONNECT("selection/active", renderThemeEflColorClassSelectionActive);
-        CONNECT("selection/inactive", renderThemeEflColorClassSelectionInactive);
-        CONNECT("focus_ring", renderThemeEflColorClassFocusRing);
+            CONNECT("selection/active",
+                    renderThemeEflColorClassSelectionActive);
+            CONNECT("selection/inactive",
+                    renderThemeEflColorClassSelectionInactive);
+            CONNECT("focus_ring", renderThemeEflColorClassFocusRing);
 #undef CONNECT
-
-        applyEdjeColors();
-        applyPartDescriptions();
+        }
     }
-
-    return m_edje;
 }
 
 void RenderThemeEfl::applyEdjeColors()
@@ -625,14 +611,11 @@ void RenderThemeEfl::applyPartDescriptions()
     unsigned int i;
     const char* file;
 
+    ASSERT(m_canvas);
     ASSERT(m_edje);
 
     edje_object_file_get(m_edje, &file, 0);
     ASSERT(file);
-    if (!file) {
-        EINA_LOG_ERR("Could not retrieve Edje theme file.");
-        return;
-    }
 
     object = edje_object_add(ecore_evas_get(m_canvas));
     if (!object) {
@@ -657,6 +640,26 @@ void RenderThemeEfl::applyPartDescriptions()
     evas_object_del(object);
 }
 
+void RenderThemeEfl::themeChanged()
+{
+    cacheThemePartFlush();
+
+    if (!m_canvas) {
+        createCanvas();
+        if (!m_canvas)
+            return;
+    }
+
+    if (!m_edje) {
+        createEdje();
+        if (!m_edje)
+            return;
+    }
+
+    applyEdjeColors();
+    applyPartDescriptions();
+}
+
 RenderThemeEfl::RenderThemeEfl(Page* page)
     : RenderTheme()
     , m_page(page)
index dfa5365..ed42f37 100644 (file)
@@ -102,6 +102,8 @@ public:
     virtual Color platformInactiveSelectionForegroundColor() const { return m_inactiveSelectionForegroundColor; }
     virtual Color platformFocusRingColor() const { return m_focusRingColor; }
 
+    virtual void themeChanged();
+
     // Set platform colors and notify they changed
     void setActiveSelectionColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
     void setInactiveSelectionColor(int foreR, int foreG, int foreB, int foreA, int backR, int backG, int backB, int backA);
@@ -210,11 +212,10 @@ protected:
     static float defaultFontSize;
 
 private:
-    Evas_Object* edje();
-
+    void createCanvas();
+    void createEdje();
     void applyEdjeColors();
     void applyPartDescriptions();
-
     const char* edjeGroupFromFormType(FormType) const;
     void applyEdjeStateFromForm(Evas_Object*, ControlStates);
     bool paintThemePart(RenderObject*, FormType, const PaintInfo&, const IntRect&);