Title: [134694] trunk/Source
Revision
134694
Author
commit-qu...@webkit.org
Date
2012-11-14 16:49:59 -0800 (Wed, 14 Nov 2012)

Log Message

[EFL] Refactor theme to choose whether to support foreground color of selection
https://bugs.webkit.org/show_bug.cgi?id=102037

Patch by Ryuan Choi <ryuan.c...@gmail.com> on 2012-11-14
Reviewed by Gyuyoung Kim.

Source/WebCore:

RenderThemeEfl can change foreground color of selection using theme file.
But it can not disable supports of foreground color to keep the text color
which is selected.

This patch refactors color classes of theme file from active/inactive classes
to foreground/background classes so that RenderThemeEfl checks whether
theme file supports foreground color class.

* platform/efl/RenderThemeEfl.cpp:
(WebCore::fillColorsFromEdjeClass):
(WebCore::RenderThemeEfl::setColorFromThemeClass):
(WebCore::RenderThemeEfl::loadTheme):
(WebCore::RenderThemeEfl::RenderThemeEfl):
(WebCore::RenderThemeEfl::supportsSelectionForegroundColors):
(WebCore):
* platform/efl/RenderThemeEfl.h:
(RenderThemeEfl):

Source/WebKit/efl:

* DefaultTheme/default.edc:
Refactored color classes from active/inactive to foreground/background.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134693 => 134694)


--- trunk/Source/WebCore/ChangeLog	2012-11-15 00:48:05 UTC (rev 134693)
+++ trunk/Source/WebCore/ChangeLog	2012-11-15 00:49:59 UTC (rev 134694)
@@ -1,3 +1,28 @@
+2012-11-14  Ryuan Choi  <ryuan.c...@gmail.com>
+
+        [EFL] Refactor theme to choose whether to support foreground color of selection
+        https://bugs.webkit.org/show_bug.cgi?id=102037
+
+        Reviewed by Gyuyoung Kim.
+
+        RenderThemeEfl can change foreground color of selection using theme file.
+        But it can not disable supports of foreground color to keep the text color
+        which is selected.
+
+        This patch refactors color classes of theme file from active/inactive classes
+        to foreground/background classes so that RenderThemeEfl checks whether
+        theme file supports foreground color class.
+
+        * platform/efl/RenderThemeEfl.cpp:
+        (WebCore::fillColorsFromEdjeClass):
+        (WebCore::RenderThemeEfl::setColorFromThemeClass):
+        (WebCore::RenderThemeEfl::loadTheme):
+        (WebCore::RenderThemeEfl::RenderThemeEfl):
+        (WebCore::RenderThemeEfl::supportsSelectionForegroundColors):
+        (WebCore):
+        * platform/efl/RenderThemeEfl.h:
+        (RenderThemeEfl):
+
 2012-11-14  Tony Chang  <t...@chromium.org>
 
         Convert m_selectorVector back to a stack allocated m_reusableSelectorVector

Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp (134693 => 134694)


--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp	2012-11-15 00:48:05 UTC (rev 134693)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp	2012-11-15 00:49:59 UTC (rev 134694)
@@ -414,14 +414,14 @@
     that->platformColorsDidChange(); // Triggers relayout.
 }
 
-static void fillColorsFromEdjeClass(Evas_Object* o, const char* colorClass, Color* color1, Color* color2 = 0, Color* color3 = 0)
+static bool fillColorsFromEdjeClass(Evas_Object* o, const char* colorClass, Color* color1, Color* color2 = 0, Color* color3 = 0)
 {
     int r1, g1, b1, a1;
     int r2, g2, b2, a2;
     int r3, g3, b3, a3;
 
     bool ok = edje_object_color_class_get(o, colorClass, &r1, &g1, &b1, &a1, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3);
-    _ASSERT_ON_RELEASE_RETURN(ok, "Could not get color class '%s'\n", colorClass);
+    _ASSERT_ON_RELEASE_RETURN_VAL(ok, false, "Could not get color class '%s'\n", colorClass);
 
     if (color1)
         color1->setRGB(makeRGBA(r1, g1, b1, a1));
@@ -429,16 +429,18 @@
         color2->setRGB(makeRGBA(r2, g2, b2, a2));
     if (color3)
         color3->setRGB(makeRGBA(r3, g3, b3, a3));
+
+    return true;
 }
 
 void RenderThemeEfl::setColorFromThemeClass(const char* colorClass)
 {
     ASSERT(edje());
 
-    if (!strcmp("webkit/selection/active", colorClass))
-        fillColorsFromEdjeClass(edje(), colorClass, &m_activeSelectionForegroundColor, &m_activeSelectionBackgroundColor);
-    else if (!strcmp("webkit/selection/inactive", colorClass))
-        fillColorsFromEdjeClass(edje(), colorClass, &m_inactiveSelectionForegroundColor, &m_inactiveSelectionBackgroundColor);
+    if (!strcmp("webkit/selection/foreground", colorClass))
+        m_supportsSelectionForegroundColor = fillColorsFromEdjeClass(edje(), colorClass, &m_activeSelectionForegroundColor, &m_inactiveSelectionForegroundColor);
+    else if (!strcmp("webkit/selection/background", colorClass))
+        fillColorsFromEdjeClass(edje(), colorClass, &m_activeSelectionBackgroundColor, &m_inactiveSelectionBackgroundColor);
     else if (!strcmp("webkit/focus_ring", colorClass)) {
         fillColorsFromEdjeClass(edje(), colorClass, &m_focusRingColor);
         // platformFocusRingColor() is only used for the default theme (without page)
@@ -501,14 +503,14 @@
     // Set new loaded theme, and apply it.
     m_edje = o;
 
-    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/active", applyColorCallback, this);
-    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/inactive", applyColorCallback, this);
+    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/foreground", applyColorCallback, this);
+    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/background", applyColorCallback, this);
     edje_object_signal_callback_add(edje(), "color_class,set", "webkit/focus_ring", applyColorCallback, this);
 
     applyPartDescriptionsFrom(m_themePath);
 
-    setColorFromThemeClass("webkit/selection/active");
-    setColorFromThemeClass("webkit/selection/inactive");
+    setColorFromThemeClass("webkit/selection/foreground");
+    setColorFromThemeClass("webkit/selection/background");
     setColorFromThemeClass("webkit/focus_ring");
 
     platformColorsDidChange(); // Schedules a relayout, do last.
@@ -606,6 +608,7 @@
     , m_mediaPanelColor(220, 220, 195) // light tannish color.
     , m_mediaSliderColor(Color::white)
 #endif
+    , m_supportsSelectionForegroundColor(false)
 {
 }
 
@@ -685,6 +688,12 @@
     return m_focusRingColor;
 }
 
+bool RenderThemeEfl::supportsSelectionForegroundColors() const
+{
+    loadThemeIfNeeded();
+    return m_supportsSelectionForegroundColor;
+}
+
 bool RenderThemeEfl::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect)
 {
     if (object->style()->appearance() == SliderHorizontalPart)

Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.h (134693 => 134694)


--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.h	2012-11-15 00:48:05 UTC (rev 134693)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.h	2012-11-15 00:49:59 UTC (rev 134694)
@@ -95,6 +95,9 @@
     // A general method asking if any control tinting is supported at all.
     virtual bool supportsControlTints() const { return true; }
 
+    // A general method asking if foreground colors of selection are supported.
+    virtual bool supportsSelectionForegroundColors() const;
+
     // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
     // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
     // controls that need to do this.
@@ -253,6 +256,8 @@
     OwnPtr<Ecore_Evas> m_canvas;
     RefPtr<Evas_Object> m_edje;
 
+    bool m_supportsSelectionForegroundColor;
+
     struct ThemePartDesc {
         FormType type;
         LengthSize min;

Modified: trunk/Source/WebKit/efl/ChangeLog (134693 => 134694)


--- trunk/Source/WebKit/efl/ChangeLog	2012-11-15 00:48:05 UTC (rev 134693)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-11-15 00:49:59 UTC (rev 134694)
@@ -1,3 +1,13 @@
+2012-11-14  Ryuan Choi  <ryuan.c...@gmail.com>
+
+        [EFL] Refactor theme to choose whether to support foreground color of selection
+        https://bugs.webkit.org/show_bug.cgi?id=102037
+
+        Reviewed by Gyuyoung Kim.
+
+        * DefaultTheme/default.edc:
+        Refactored color classes from active/inactive to foreground/background.
+
 2012-11-12  KyungTae Kim  <ktf....@samsung.com>
 
         [EFL] In ewk_tiled_backing_store_pre_render_region, the 'slicer' may be uninitialized

Modified: trunk/Source/WebKit/efl/DefaultTheme/default.edc (134693 => 134694)


--- trunk/Source/WebKit/efl/DefaultTheme/default.edc	2012-11-15 00:48:05 UTC (rev 134693)
+++ trunk/Source/WebKit/efl/DefaultTheme/default.edc	2012-11-15 00:49:59 UTC (rev 134694)
@@ -21,14 +21,14 @@
 
 color_classes {
    color_class {
-      name: "webkit/selection/active";
-      color: 255 255 255 255; /* foreground */
-      color2: 86 86 209 255; /* background */
+      name: "webkit/selection/foreground";
+      color: 255 255 255 255; /* active */
+      color2: 255 255 255 255; /* inactive */
    }
    color_class {
-      name: "webkit/selection/inactive";
-      color: 255 255 255 255; /* foreground */
-      color2: 0 0 128 128; /* background */
+      name: "webkit/selection/background";
+      color: 86 86 209 255; /* active */
+      color2: 0 0 128 128; /* inactive */
    }
    color_class {
       name: "webkit/focus_ring";
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to