Changeset 134694 in webkit


Ignore:
Timestamp:
Nov 14, 2012, 4:49:59 PM (12 years ago)
Author:
commit-queue@webkit.org
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.choi@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.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r134693 r134694  
     12012-11-14  Ryuan Choi  <ryuan.choi@gmail.com>
     2
     3        [EFL] Refactor theme to choose whether to support foreground color of selection
     4        https://bugs.webkit.org/show_bug.cgi?id=102037
     5
     6        Reviewed by Gyuyoung Kim.
     7
     8        RenderThemeEfl can change foreground color of selection using theme file.
     9        But it can not disable supports of foreground color to keep the text color
     10        which is selected.
     11
     12        This patch refactors color classes of theme file from active/inactive classes
     13        to foreground/background classes so that RenderThemeEfl checks whether
     14        theme file supports foreground color class.
     15
     16        * platform/efl/RenderThemeEfl.cpp:
     17        (WebCore::fillColorsFromEdjeClass):
     18        (WebCore::RenderThemeEfl::setColorFromThemeClass):
     19        (WebCore::RenderThemeEfl::loadTheme):
     20        (WebCore::RenderThemeEfl::RenderThemeEfl):
     21        (WebCore::RenderThemeEfl::supportsSelectionForegroundColors):
     22        (WebCore):
     23        * platform/efl/RenderThemeEfl.h:
     24        (RenderThemeEfl):
     25
    1262012-11-14  Tony Chang  <tony@chromium.org>
    227
  • trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp

    r132112 r134694  
    415415}
    416416
    417 static void fillColorsFromEdjeClass(Evas_Object* o, const char* colorClass, Color* color1, Color* color2 = 0, Color* color3 = 0)
     417static bool fillColorsFromEdjeClass(Evas_Object* o, const char* colorClass, Color* color1, Color* color2 = 0, Color* color3 = 0)
    418418{
    419419    int r1, g1, b1, a1;
     
    422422
    423423    bool ok = edje_object_color_class_get(o, colorClass, &r1, &g1, &b1, &a1, &r2, &g2, &b2, &a2, &r3, &g3, &b3, &a3);
    424     _ASSERT_ON_RELEASE_RETURN(ok, "Could not get color class '%s'\n", colorClass);
     424    _ASSERT_ON_RELEASE_RETURN_VAL(ok, false, "Could not get color class '%s'\n", colorClass);
    425425
    426426    if (color1)
     
    430430    if (color3)
    431431        color3->setRGB(makeRGBA(r3, g3, b3, a3));
     432
     433    return true;
    432434}
    433435
     
    436438    ASSERT(edje());
    437439
    438     if (!strcmp("webkit/selection/active", colorClass))
    439         fillColorsFromEdjeClass(edje(), colorClass, &m_activeSelectionForegroundColor, &m_activeSelectionBackgroundColor);
    440     else if (!strcmp("webkit/selection/inactive", colorClass))
    441         fillColorsFromEdjeClass(edje(), colorClass, &m_inactiveSelectionForegroundColor, &m_inactiveSelectionBackgroundColor);
     440    if (!strcmp("webkit/selection/foreground", colorClass))
     441        m_supportsSelectionForegroundColor = fillColorsFromEdjeClass(edje(), colorClass, &m_activeSelectionForegroundColor, &m_inactiveSelectionForegroundColor);
     442    else if (!strcmp("webkit/selection/background", colorClass))
     443        fillColorsFromEdjeClass(edje(), colorClass, &m_activeSelectionBackgroundColor, &m_inactiveSelectionBackgroundColor);
    442444    else if (!strcmp("webkit/focus_ring", colorClass)) {
    443445        fillColorsFromEdjeClass(edje(), colorClass, &m_focusRingColor);
     
    502504    m_edje = o;
    503505
    504     edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/active", applyColorCallback, this);
    505     edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/inactive", applyColorCallback, this);
     506    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/foreground", applyColorCallback, this);
     507    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/selection/background", applyColorCallback, this);
    506508    edje_object_signal_callback_add(edje(), "color_class,set", "webkit/focus_ring", applyColorCallback, this);
    507509
    508510    applyPartDescriptionsFrom(m_themePath);
    509511
    510     setColorFromThemeClass("webkit/selection/active");
    511     setColorFromThemeClass("webkit/selection/inactive");
     512    setColorFromThemeClass("webkit/selection/foreground");
     513    setColorFromThemeClass("webkit/selection/background");
    512514    setColorFromThemeClass("webkit/focus_ring");
    513515
     
    607609    , m_mediaSliderColor(Color::white)
    608610#endif
     611    , m_supportsSelectionForegroundColor(false)
    609612{
    610613}
     
    684687    loadThemeIfNeeded();
    685688    return m_focusRingColor;
     689}
     690
     691bool RenderThemeEfl::supportsSelectionForegroundColors() const
     692{
     693    loadThemeIfNeeded();
     694    return m_supportsSelectionForegroundColor;
    686695}
    687696
  • trunk/Source/WebCore/platform/efl/RenderThemeEfl.h

    r132112 r134694  
    9595    // A general method asking if any control tinting is supported at all.
    9696    virtual bool supportsControlTints() const { return true; }
     97
     98    // A general method asking if foreground colors of selection are supported.
     99    virtual bool supportsSelectionForegroundColors() const;
    97100
    98101    // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
     
    254257    RefPtr<Evas_Object> m_edje;
    255258
     259    bool m_supportsSelectionForegroundColor;
     260
    256261    struct ThemePartDesc {
    257262        FormType type;
  • trunk/Source/WebKit/efl/ChangeLog

    r134365 r134694  
     12012-11-14  Ryuan Choi  <ryuan.choi@gmail.com>
     2
     3        [EFL] Refactor theme to choose whether to support foreground color of selection
     4        https://bugs.webkit.org/show_bug.cgi?id=102037
     5
     6        Reviewed by Gyuyoung Kim.
     7
     8        * DefaultTheme/default.edc:
     9        Refactored color classes from active/inactive to foreground/background.
     10
    1112012-11-12  KyungTae Kim  <ktf.kim@samsung.com>
    212
  • trunk/Source/WebKit/efl/DefaultTheme/default.edc

    r128049 r134694  
    2222color_classes {
    2323   color_class {
    24       name: "webkit/selection/active";
    25       color: 255 255 255 255; /* foreground */
    26       color2: 86 86 209 255; /* background */
     24      name: "webkit/selection/foreground";
     25      color: 255 255 255 255; /* active */
     26      color2: 255 255 255 255; /* inactive */
    2727   }
    2828   color_class {
    29       name: "webkit/selection/inactive";
    30       color: 255 255 255 255; /* foreground */
    31       color2: 0 0 128 128; /* background */
     29      name: "webkit/selection/background";
     30      color: 86 86 209 255; /* active */
     31      color2: 0 0 128 128; /* inactive */
    3232   }
    3333   color_class {
Note: See TracChangeset for help on using the changeset viewer.