OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the WebKit project. | 2 * This file is part of the WebKit project. |
3 * | 3 * |
4 * Copyright (C) 2006 Apple Computer, Inc. | 4 * Copyright (C) 2006 Apple Computer, Inc. |
5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com | 5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com |
6 * Copyright (C) 2007 Holger Hans Peter Freyther | 6 * Copyright (C) 2007 Holger Hans Peter Freyther |
7 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
8 * Copyright (C) 2008, 2009 Google, Inc. | 8 * Copyright (C) 2008, 2009 Google, Inc. |
9 * All rights reserved. | 9 * All rights reserved. |
10 * Copyright (C) 2009 Kenneth Rohde Christiansen | 10 * Copyright (C) 2009 Kenneth Rohde Christiansen |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
33 #include "core/layout/LayoutTheme.h" | 33 #include "core/layout/LayoutTheme.h" |
34 #include "core/paint/ThemePainterDefault.h" | 34 #include "core/paint/ThemePainterDefault.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class LayoutProgress; | 38 class LayoutProgress; |
39 | 39 |
40 class CORE_EXPORT LayoutThemeDefault : public LayoutTheme { | 40 class CORE_EXPORT LayoutThemeDefault : public LayoutTheme { |
41 public: | 41 public: |
42 virtual String extraDefaultStyleSheet() override; | 42 String extraDefaultStyleSheet() override; |
43 virtual String extraQuirksStyleSheet() override; | 43 String extraQuirksStyleSheet() override; |
44 | 44 |
45 virtual Color systemColor(CSSValueID) const override; | 45 Color systemColor(CSSValueID) const override; |
46 | 46 |
47 virtual bool supportsFocusRing(const ComputedStyle&) const override; | 47 bool supportsFocusRing(const ComputedStyle&) const override; |
48 | 48 |
49 // List Box selection color | 49 // List Box selection color |
50 virtual Color activeListBoxSelectionBackgroundColor() const; | 50 virtual Color activeListBoxSelectionBackgroundColor() const; |
51 virtual Color activeListBoxSelectionForegroundColor() const; | 51 virtual Color activeListBoxSelectionForegroundColor() const; |
52 virtual Color inactiveListBoxSelectionBackgroundColor() const; | 52 virtual Color inactiveListBoxSelectionBackgroundColor() const; |
53 virtual Color inactiveListBoxSelectionForegroundColor() const; | 53 virtual Color inactiveListBoxSelectionForegroundColor() const; |
54 | 54 |
55 virtual Color platformActiveSelectionBackgroundColor() const override; | 55 Color platformActiveSelectionBackgroundColor() const override; |
56 virtual Color platformInactiveSelectionBackgroundColor() const override; | 56 Color platformInactiveSelectionBackgroundColor() const override; |
57 virtual Color platformActiveSelectionForegroundColor() const override; | 57 Color platformActiveSelectionForegroundColor() const override; |
58 virtual Color platformInactiveSelectionForegroundColor() const override; | 58 Color platformInactiveSelectionForegroundColor() const override; |
59 | 59 |
60 virtual IntSize sliderTickSize() const override; | 60 IntSize sliderTickSize() const override; |
61 virtual int sliderTickOffsetFromTrackCenter() const override; | 61 int sliderTickOffsetFromTrackCenter() const override; |
62 virtual void adjustSliderThumbSize(ComputedStyle&, Element*) const override; | 62 void adjustSliderThumbSize(ComputedStyle&, Element*) const override; |
63 | 63 |
64 static void setCaretBlinkInterval(double); | 64 static void setCaretBlinkInterval(double); |
65 | 65 |
66 virtual void setCheckboxSize(ComputedStyle&) const override; | 66 void setCheckboxSize(ComputedStyle&) const override; |
67 virtual void setRadioSize(ComputedStyle&) const override; | 67 void setRadioSize(ComputedStyle&) const override; |
68 virtual void adjustInnerSpinButtonStyle(ComputedStyle&, Element*) const over
ride; | 68 void adjustInnerSpinButtonStyle(ComputedStyle&, Element*) const override; |
69 | 69 |
70 virtual bool popsMenuBySpaceKey() const override final { return true; } | 70 bool popsMenuBySpaceKey() const final { return true; } |
71 virtual bool popsMenuByReturnKey() const override final { return true; } | 71 bool popsMenuByReturnKey() const final { return true; } |
72 virtual bool popsMenuByAltDownUpOrF4Key() const override { return true; } | 72 bool popsMenuByAltDownUpOrF4Key() const override { return true; } |
73 | 73 |
74 virtual bool shouldOpenPickerWithF4Key() const override; | 74 bool shouldOpenPickerWithF4Key() const override; |
75 | 75 |
76 virtual Color platformTapHighlightColor() const override | 76 Color platformTapHighlightColor() const override |
77 { | 77 { |
78 return Color(defaultTapHighlightColor); | 78 return Color(defaultTapHighlightColor); |
79 } | 79 } |
80 | 80 |
81 // A method asking if the theme's controls actually care about redrawing | 81 // A method asking if the theme's controls actually care about redrawing |
82 // when hovered. | 82 // when hovered. |
83 virtual bool supportsHover(const ComputedStyle&) const override final; | 83 bool supportsHover(const ComputedStyle&) const final; |
84 | 84 |
85 virtual Color platformFocusRingColor() const override; | 85 Color platformFocusRingColor() const override; |
86 | 86 |
87 virtual double caretBlinkInterval() const final; | 87 double caretBlinkInterval() const final; |
88 | 88 |
89 // System fonts. | 89 // System fonts. |
90 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, fl
oat& fontSize, AtomicString& fontFamily) const; | 90 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, fl
oat& fontSize, AtomicString& fontFamily) const; |
91 | 91 |
92 virtual int minimumMenuListSize(const ComputedStyle&) const override; | 92 int minimumMenuListSize(const ComputedStyle&) const override; |
93 | 93 |
94 virtual void adjustButtonStyle(ComputedStyle&, Element*) const override; | 94 void adjustButtonStyle(ComputedStyle&, Element*) const override; |
95 virtual void adjustSearchFieldStyle(ComputedStyle&, Element*) const override
; | 95 void adjustSearchFieldStyle(ComputedStyle&, Element*) const override; |
96 virtual void adjustSearchFieldCancelButtonStyle(ComputedStyle&, Element*) co
nst override; | 96 void adjustSearchFieldCancelButtonStyle(ComputedStyle&, Element*) const over
ride; |
97 virtual void adjustSearchFieldDecorationStyle(ComputedStyle&, Element*) cons
t override; | 97 void adjustSearchFieldDecorationStyle(ComputedStyle&, Element*) const overri
de; |
98 virtual void adjustSearchFieldResultsDecorationStyle(ComputedStyle&, Element
*) const override; | 98 void adjustSearchFieldResultsDecorationStyle(ComputedStyle&, Element*) const
override; |
99 | 99 |
100 // MenuList refers to an unstyled menulist (meaning a menulist without | 100 // MenuList refers to an unstyled menulist (meaning a menulist without |
101 // background-color or border set) and MenuListButton refers to a styled | 101 // background-color or border set) and MenuListButton refers to a styled |
102 // menulist (a menulist with background-color or border set). They have | 102 // menulist (a menulist with background-color or border set). They have |
103 // this distinction to support showing aqua style themes whenever they | 103 // this distinction to support showing aqua style themes whenever they |
104 // possibly can, which is something we don't want to replicate. | 104 // possibly can, which is something we don't want to replicate. |
105 // | 105 // |
106 // In short, we either go down the MenuList code path or the MenuListButton | 106 // In short, we either go down the MenuList code path or the MenuListButton |
107 // codepath. We never go down both. And in both cases, they layout the | 107 // codepath. We never go down both. And in both cases, they layout the |
108 // entire menulist. | 108 // entire menulist. |
109 virtual void adjustMenuListStyle(ComputedStyle&, Element*) const override; | 109 void adjustMenuListStyle(ComputedStyle&, Element*) const override; |
110 virtual void adjustMenuListButtonStyle(ComputedStyle&, Element*) const overr
ide; | 110 void adjustMenuListButtonStyle(ComputedStyle&, Element*) const override; |
111 | 111 |
112 virtual double animationRepeatIntervalForProgressBar() const override; | 112 double animationRepeatIntervalForProgressBar() const override; |
113 virtual double animationDurationForProgressBar() const override; | 113 double animationDurationForProgressBar() const override; |
114 | 114 |
115 // These methods define the padding for the MenuList's inner block. | 115 // These methods define the padding for the MenuList's inner block. |
116 virtual int popupInternalPaddingLeft(const ComputedStyle&) const override; | 116 int popupInternalPaddingLeft(const ComputedStyle&) const override; |
117 virtual int popupInternalPaddingRight(const ComputedStyle&) const override; | 117 int popupInternalPaddingRight(const ComputedStyle&) const override; |
118 virtual int popupInternalPaddingTop(const ComputedStyle&) const override; | 118 int popupInternalPaddingTop(const ComputedStyle&) const override; |
119 virtual int popupInternalPaddingBottom(const ComputedStyle&) const override; | 119 int popupInternalPaddingBottom(const ComputedStyle&) const override; |
120 | 120 |
121 // Provide a way to pass the default font size from the Settings object | 121 // Provide a way to pass the default font size from the Settings object |
122 // to the layout theme. FIXME: http://b/1129186 A cleaner way would be | 122 // to the layout theme. FIXME: http://b/1129186 A cleaner way would be |
123 // to remove the default font size from this object and have callers | 123 // to remove the default font size from this object and have callers |
124 // that need the value to get it directly from the appropriate Settings | 124 // that need the value to get it directly from the appropriate Settings |
125 // object. | 125 // object. |
126 static void setDefaultFontSize(int); | 126 static void setDefaultFontSize(int); |
127 | 127 |
128 static void setSelectionColors(unsigned activeBackgroundColor, unsigned acti
veForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForeground
Color); | 128 static void setSelectionColors(unsigned activeBackgroundColor, unsigned acti
veForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForeground
Color); |
129 | 129 |
130 protected: | 130 protected: |
131 LayoutThemeDefault(); | 131 LayoutThemeDefault(); |
132 virtual ~LayoutThemeDefault(); | 132 ~LayoutThemeDefault() override; |
133 virtual bool shouldUseFallbackTheme(const ComputedStyle&) const override; | 133 bool shouldUseFallbackTheme(const ComputedStyle&) const override; |
134 virtual int menuListArrowPadding() const; | 134 virtual int menuListArrowPadding() const; |
135 | 135 |
136 IntRect determinateProgressValueRectFor(LayoutProgress*, const IntRect&) con
st; | 136 IntRect determinateProgressValueRectFor(LayoutProgress*, const IntRect&) con
st; |
137 IntRect indeterminateProgressValueRectFor(LayoutProgress*, const IntRect&) c
onst; | 137 IntRect indeterminateProgressValueRectFor(LayoutProgress*, const IntRect&) c
onst; |
138 | 138 |
139 private: | 139 private: |
140 virtual bool shouldShowPlaceholderWhenFocused() const override; | 140 bool shouldShowPlaceholderWhenFocused() const override; |
141 | 141 |
142 virtual ThemePainter& painter() override { return m_painter; } | 142 ThemePainter& painter() override { return m_painter; } |
143 | 143 |
144 int menuListInternalPadding(const ComputedStyle&, int paddingType) const; | 144 int menuListInternalPadding(const ComputedStyle&, int paddingType) const; |
145 | 145 |
146 static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black. | 146 static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black. |
147 static double m_caretBlinkInterval; | 147 static double m_caretBlinkInterval; |
148 | 148 |
149 static unsigned m_activeSelectionBackgroundColor; | 149 static unsigned m_activeSelectionBackgroundColor; |
150 static unsigned m_activeSelectionForegroundColor; | 150 static unsigned m_activeSelectionForegroundColor; |
151 static unsigned m_inactiveSelectionBackgroundColor; | 151 static unsigned m_inactiveSelectionBackgroundColor; |
152 static unsigned m_inactiveSelectionForegroundColor; | 152 static unsigned m_inactiveSelectionForegroundColor; |
153 | 153 |
154 ThemePainterDefault m_painter; | 154 ThemePainterDefault m_painter; |
155 }; | 155 }; |
156 | 156 |
157 } // namespace blink | 157 } // namespace blink |
158 | 158 |
159 #endif // LayoutThemeDefault_h | 159 #endif // LayoutThemeDefault_h |
OLD | NEW |