OLD | NEW |
1 /* | 1 /* |
2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2005 Apple Computer, Inc. | 4 * Copyright (C) 2005 Apple Computer, Inc. |
5 * Copyright (C) 2008, 2009 Google, Inc. | 5 * Copyright (C) 2008, 2009 Google, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 20 matching lines...) Expand all Loading... |
31 OBJC_CLASS LayoutThemeNotificationObserver; | 31 OBJC_CLASS LayoutThemeNotificationObserver; |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class LayoutThemeMac final : public LayoutTheme { | 35 class LayoutThemeMac final : public LayoutTheme { |
36 public: | 36 public: |
37 static PassRefPtr<LayoutTheme> create(); | 37 static PassRefPtr<LayoutTheme> create(); |
38 | 38 |
39 virtual void adjustPaintInvalidationRect(const LayoutObject*, IntRect&) over
ride; | 39 virtual void adjustPaintInvalidationRect(const LayoutObject*, IntRect&) over
ride; |
40 | 40 |
41 virtual bool isControlStyled(const LayoutStyle&, const AuthorStyleInfo&) con
st override; | 41 virtual bool isControlStyled(const ComputedStyle&, const AuthorStyleInfo&) c
onst override; |
42 | 42 |
43 virtual Color platformActiveSelectionBackgroundColor() const override; | 43 virtual Color platformActiveSelectionBackgroundColor() const override; |
44 virtual Color platformInactiveSelectionBackgroundColor() const override; | 44 virtual Color platformInactiveSelectionBackgroundColor() const override; |
45 virtual Color platformActiveSelectionForegroundColor() const override; | 45 virtual Color platformActiveSelectionForegroundColor() const override; |
46 virtual Color platformActiveListBoxSelectionBackgroundColor() const override
; | 46 virtual Color platformActiveListBoxSelectionBackgroundColor() const override
; |
47 virtual Color platformActiveListBoxSelectionForegroundColor() const override
; | 47 virtual Color platformActiveListBoxSelectionForegroundColor() const override
; |
48 virtual Color platformInactiveListBoxSelectionBackgroundColor() const overri
de; | 48 virtual Color platformInactiveListBoxSelectionBackgroundColor() const overri
de; |
49 virtual Color platformInactiveListBoxSelectionForegroundColor() const overri
de; | 49 virtual Color platformInactiveListBoxSelectionForegroundColor() const overri
de; |
50 virtual Color platformFocusRingColor() const override; | 50 virtual Color platformFocusRingColor() const override; |
51 | 51 |
52 virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart part) o
verride { return part == ListboxPart ? SmallScrollbar : RegularScrollbar; } | 52 virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart part) o
verride { return part == ListboxPart ? SmallScrollbar : RegularScrollbar; } |
53 | 53 |
54 virtual void platformColorsDidChange() override; | 54 virtual void platformColorsDidChange() override; |
55 | 55 |
56 // System fonts. | 56 // System fonts. |
57 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, fl
oat& fontSize, AtomicString& fontFamily) const override; | 57 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, fl
oat& fontSize, AtomicString& fontFamily) const override; |
58 | 58 |
59 virtual int minimumMenuListSize(const LayoutStyle&) const override; | 59 virtual int minimumMenuListSize(const ComputedStyle&) const override; |
60 | 60 |
61 virtual void adjustSliderThumbSize(LayoutStyle&, Element*) const override; | 61 virtual void adjustSliderThumbSize(ComputedStyle&, Element*) const override; |
62 | 62 |
63 virtual IntSize sliderTickSize() const override; | 63 virtual IntSize sliderTickSize() const override; |
64 virtual int sliderTickOffsetFromTrackCenter() const override; | 64 virtual int sliderTickOffsetFromTrackCenter() const override; |
65 | 65 |
66 virtual int popupInternalPaddingLeft(const LayoutStyle&) const override; | 66 virtual int popupInternalPaddingLeft(const ComputedStyle&) const override; |
67 virtual int popupInternalPaddingRight(const LayoutStyle&) const override; | 67 virtual int popupInternalPaddingRight(const ComputedStyle&) const override; |
68 virtual int popupInternalPaddingTop(const LayoutStyle&) const override; | 68 virtual int popupInternalPaddingTop(const ComputedStyle&) const override; |
69 virtual int popupInternalPaddingBottom(const LayoutStyle&) const override; | 69 virtual int popupInternalPaddingBottom(const ComputedStyle&) const override; |
70 | 70 |
71 virtual bool paintCapsLockIndicator(LayoutObject*, const PaintInfo&, const I
ntRect&) override; | 71 virtual bool paintCapsLockIndicator(LayoutObject*, const PaintInfo&, const I
ntRect&) override; |
72 | 72 |
73 virtual bool popsMenuByArrowKeys() const override { return true; } | 73 virtual bool popsMenuByArrowKeys() const override { return true; } |
74 virtual bool popsMenuBySpaceKey() const override final { return true; } | 74 virtual bool popsMenuBySpaceKey() const override final { return true; } |
75 | 75 |
76 virtual IntSize meterSizeForBounds(const LayoutMeter*, const IntRect&) const
override; | 76 virtual IntSize meterSizeForBounds(const LayoutMeter*, const IntRect&) const
override; |
77 virtual bool paintMeter(LayoutObject*, const PaintInfo&, const IntRect&) ove
rride; | 77 virtual bool paintMeter(LayoutObject*, const PaintInfo&, const IntRect&) ove
rride; |
78 virtual bool supportsMeter(ControlPart) const override; | 78 virtual bool supportsMeter(ControlPart) const override; |
79 | 79 |
(...skipping 10 matching lines...) Expand all Loading... |
90 | 90 |
91 protected: | 91 protected: |
92 LayoutThemeMac(); | 92 LayoutThemeMac(); |
93 virtual ~LayoutThemeMac(); | 93 virtual ~LayoutThemeMac(); |
94 | 94 |
95 virtual bool paintTextField(LayoutObject*, const PaintInfo&, const IntRect&)
override; | 95 virtual bool paintTextField(LayoutObject*, const PaintInfo&, const IntRect&)
override; |
96 | 96 |
97 virtual bool paintTextArea(LayoutObject*, const PaintInfo&, const IntRect&)
override; | 97 virtual bool paintTextArea(LayoutObject*, const PaintInfo&, const IntRect&)
override; |
98 | 98 |
99 virtual bool paintMenuList(LayoutObject*, const PaintInfo&, const IntRect&)
override; | 99 virtual bool paintMenuList(LayoutObject*, const PaintInfo&, const IntRect&)
override; |
100 virtual void adjustMenuListStyle(LayoutStyle&, Element*) const override; | 100 virtual void adjustMenuListStyle(ComputedStyle&, Element*) const override; |
101 | 101 |
102 virtual bool paintMenuListButton(LayoutObject*, const PaintInfo&, const IntR
ect&) override; | 102 virtual bool paintMenuListButton(LayoutObject*, const PaintInfo&, const IntR
ect&) override; |
103 virtual void adjustMenuListButtonStyle(LayoutStyle&, Element*) const overrid
e; | 103 virtual void adjustMenuListButtonStyle(ComputedStyle&, Element*) const overr
ide; |
104 | 104 |
105 virtual bool paintProgressBar(LayoutObject*, const PaintInfo&, const IntRect
&) override; | 105 virtual bool paintProgressBar(LayoutObject*, const PaintInfo&, const IntRect
&) override; |
106 | 106 |
107 virtual bool paintSliderTrack(LayoutObject*, const PaintInfo&, const IntRect
&) override; | 107 virtual bool paintSliderTrack(LayoutObject*, const PaintInfo&, const IntRect
&) override; |
108 | 108 |
109 virtual bool paintSliderThumb(LayoutObject*, const PaintInfo&, const IntRect
&) override; | 109 virtual bool paintSliderThumb(LayoutObject*, const PaintInfo&, const IntRect
&) override; |
110 | 110 |
111 virtual bool paintSearchField(LayoutObject*, const PaintInfo&, const IntRect
&) override; | 111 virtual bool paintSearchField(LayoutObject*, const PaintInfo&, const IntRect
&) override; |
112 virtual void adjustSearchFieldStyle(LayoutStyle&, Element*) const override; | 112 virtual void adjustSearchFieldStyle(ComputedStyle&, Element*) const override
; |
113 | 113 |
114 virtual void adjustSearchFieldCancelButtonStyle(LayoutStyle&, Element*) cons
t override; | 114 virtual void adjustSearchFieldCancelButtonStyle(ComputedStyle&, Element*) co
nst override; |
115 virtual bool paintSearchFieldCancelButton(LayoutObject*, const PaintInfo&, c
onst IntRect&) override; | 115 virtual bool paintSearchFieldCancelButton(LayoutObject*, const PaintInfo&, c
onst IntRect&) override; |
116 | 116 |
117 virtual void adjustSearchFieldDecorationStyle(LayoutStyle&, Element*) const
override; | 117 virtual void adjustSearchFieldDecorationStyle(ComputedStyle&, Element*) cons
t override; |
118 virtual bool paintSearchFieldDecoration(LayoutObject*, const PaintInfo&, con
st IntRect&) override; | 118 virtual bool paintSearchFieldDecoration(LayoutObject*, const PaintInfo&, con
st IntRect&) override; |
119 | 119 |
120 virtual void adjustSearchFieldResultsDecorationStyle(LayoutStyle&, Element*)
const override; | 120 virtual void adjustSearchFieldResultsDecorationStyle(ComputedStyle&, Element
*) const override; |
121 virtual bool paintSearchFieldResultsDecoration(LayoutObject*, const PaintInf
o&, const IntRect&) override; | 121 virtual bool paintSearchFieldResultsDecoration(LayoutObject*, const PaintInf
o&, const IntRect&) override; |
122 | 122 |
123 private: | 123 private: |
124 virtual String fileListNameForWidth(Locale&, const FileList*, const Font&, i
nt width) const override; | 124 virtual String fileListNameForWidth(Locale&, const FileList*, const Font&, i
nt width) const override; |
125 | 125 |
126 FloatRect convertToPaintingRect(const LayoutObject* inputRenderer, const Lay
outObject* partRenderer, const FloatRect& inputRect, const IntRect&) const; | 126 FloatRect convertToPaintingRect(const LayoutObject* inputRenderer, const Lay
outObject* partRenderer, const FloatRect& inputRect, const IntRect&) const; |
127 | 127 |
128 // Get the control size based off the font. Used by some of the controls (li
ke buttons). | 128 // Get the control size based off the font. Used by some of the controls (li
ke buttons). |
129 NSControlSize controlSizeForFont(const LayoutStyle&) const; | 129 NSControlSize controlSizeForFont(const ComputedStyle&) const; |
130 NSControlSize controlSizeForSystemFont(const LayoutStyle&) const; | 130 NSControlSize controlSizeForSystemFont(const ComputedStyle&) const; |
131 void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, f
loat zoomLevel = 1.0f); | 131 void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, f
loat zoomLevel = 1.0f); |
132 void setSizeFromFont(LayoutStyle&, const IntSize* sizes) const; | 132 void setSizeFromFont(ComputedStyle&, const IntSize* sizes) const; |
133 IntSize sizeForFont(const LayoutStyle&, const IntSize* sizes) const; | 133 IntSize sizeForFont(const ComputedStyle&, const IntSize* sizes) const; |
134 IntSize sizeForSystemFont(const LayoutStyle&, const IntSize* sizes) const; | 134 IntSize sizeForSystemFont(const ComputedStyle&, const IntSize* sizes) const; |
135 void setFontFromControlSize(LayoutStyle&, NSControlSize) const; | 135 void setFontFromControlSize(ComputedStyle&, NSControlSize) const; |
136 | 136 |
137 void updateCheckedState(NSCell*, const LayoutObject*); | 137 void updateCheckedState(NSCell*, const LayoutObject*); |
138 void updateEnabledState(NSCell*, const LayoutObject*); | 138 void updateEnabledState(NSCell*, const LayoutObject*); |
139 void updateFocusedState(NSCell*, const LayoutObject*); | 139 void updateFocusedState(NSCell*, const LayoutObject*); |
140 void updatePressedState(NSCell*, const LayoutObject*); | 140 void updatePressedState(NSCell*, const LayoutObject*); |
141 | 141 |
142 // Helpers for adjusting appearance and for painting | 142 // Helpers for adjusting appearance and for painting |
143 | 143 |
144 void setPopupButtonCellState(const LayoutObject*, const IntRect&); | 144 void setPopupButtonCellState(const LayoutObject*, const IntRect&); |
145 const IntSize* popupButtonSizes() const; | 145 const IntSize* popupButtonSizes() const; |
146 const int* popupButtonMargins() const; | 146 const int* popupButtonMargins() const; |
147 const int* popupButtonPadding(NSControlSize) const; | 147 const int* popupButtonPadding(NSControlSize) const; |
148 const IntSize* menuListSizes() const; | 148 const IntSize* menuListSizes() const; |
149 | 149 |
150 const IntSize* searchFieldSizes() const; | 150 const IntSize* searchFieldSizes() const; |
151 const IntSize* cancelButtonSizes() const; | 151 const IntSize* cancelButtonSizes() const; |
152 const IntSize* resultsButtonSizes() const; | 152 const IntSize* resultsButtonSizes() const; |
153 void setSearchCellState(LayoutObject*, const IntRect&); | 153 void setSearchCellState(LayoutObject*, const IntRect&); |
154 void setSearchFieldSize(LayoutStyle&) const; | 154 void setSearchFieldSize(ComputedStyle&) const; |
155 | 155 |
156 NSPopUpButtonCell* popupButton() const; | 156 NSPopUpButtonCell* popupButton() const; |
157 NSSearchFieldCell* search() const; | 157 NSSearchFieldCell* search() const; |
158 NSTextFieldCell* textField() const; | 158 NSTextFieldCell* textField() const; |
159 | 159 |
160 NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const; | 160 NSLevelIndicatorStyle levelIndicatorStyleFor(ControlPart) const; |
161 NSLevelIndicatorCell* levelIndicatorFor(const LayoutMeter*) const; | 161 NSLevelIndicatorCell* levelIndicatorFor(const LayoutMeter*) const; |
162 | 162 |
163 int minimumProgressBarHeight(const LayoutStyle&) const; | 163 int minimumProgressBarHeight(const ComputedStyle&) const; |
164 const IntSize* progressBarSizes() const; | 164 const IntSize* progressBarSizes() const; |
165 const int* progressBarMargins(NSControlSize) const; | 165 const int* progressBarMargins(NSControlSize) const; |
166 | 166 |
167 protected: | 167 protected: |
168 virtual void adjustMediaSliderThumbSize(LayoutStyle&) const; | 168 virtual void adjustMediaSliderThumbSize(ComputedStyle&) const; |
169 virtual bool paintMediaPlayButton(LayoutObject*, const PaintInfo&, const Int
Rect&) override; | 169 virtual bool paintMediaPlayButton(LayoutObject*, const PaintInfo&, const Int
Rect&) override; |
170 virtual bool paintMediaOverlayPlayButton(LayoutObject*, const PaintInfo&, co
nst IntRect&) override; | 170 virtual bool paintMediaOverlayPlayButton(LayoutObject*, const PaintInfo&, co
nst IntRect&) override; |
171 virtual bool paintMediaMuteButton(LayoutObject*, const PaintInfo&, const Int
Rect&) override; | 171 virtual bool paintMediaMuteButton(LayoutObject*, const PaintInfo&, const Int
Rect&) override; |
172 virtual bool paintMediaSliderTrack(LayoutObject*, const PaintInfo&, const In
tRect&) override; | 172 virtual bool paintMediaSliderTrack(LayoutObject*, const PaintInfo&, const In
tRect&) override; |
173 virtual String extraFullScreenStyleSheet() override; | 173 virtual String extraFullScreenStyleSheet() override; |
174 | 174 |
175 virtual bool paintMediaSliderThumb(LayoutObject*, const PaintInfo&, const In
tRect&) override; | 175 virtual bool paintMediaSliderThumb(LayoutObject*, const PaintInfo&, const In
tRect&) override; |
176 virtual bool paintMediaVolumeSliderContainer(LayoutObject*, const PaintInfo&
, const IntRect&) override; | 176 virtual bool paintMediaVolumeSliderContainer(LayoutObject*, const PaintInfo&
, const IntRect&) override; |
177 virtual bool paintMediaVolumeSliderTrack(LayoutObject*, const PaintInfo&, co
nst IntRect&) override; | 177 virtual bool paintMediaVolumeSliderTrack(LayoutObject*, const PaintInfo&, co
nst IntRect&) override; |
178 virtual bool paintMediaVolumeSliderThumb(LayoutObject*, const PaintInfo&, co
nst IntRect&) override; | 178 virtual bool paintMediaVolumeSliderThumb(LayoutObject*, const PaintInfo&, co
nst IntRect&) override; |
179 virtual String formatMediaControlsTime(float time) const override; | 179 virtual String formatMediaControlsTime(float time) const override; |
180 virtual String formatMediaControlsCurrentTime(float currentTime, float durat
ion) const override; | 180 virtual String formatMediaControlsCurrentTime(float currentTime, float durat
ion) const override; |
181 virtual bool paintMediaFullscreenButton(LayoutObject*, const PaintInfo&, con
st IntRect&) override; | 181 virtual bool paintMediaFullscreenButton(LayoutObject*, const PaintInfo&, con
st IntRect&) override; |
182 virtual bool paintMediaToggleClosedCaptionsButton(LayoutObject*, const Paint
Info&, const IntRect&) override; | 182 virtual bool paintMediaToggleClosedCaptionsButton(LayoutObject*, const Paint
Info&, const IntRect&) override; |
183 | 183 |
184 // Controls color values returned from platformFocusRingColor(). systemColor
() will be used when false. | 184 // Controls color values returned from platformFocusRingColor(). systemColor
() will be used when false. |
185 bool usesTestModeFocusRingColor() const; | 185 bool usesTestModeFocusRingColor() const; |
186 // A view associated to the contained document. Subclasses may not have such
a view and return a fake. | 186 // A view associated to the contained document. Subclasses may not have such
a view and return a fake. |
187 NSView* documentViewFor(LayoutObject*) const; | 187 NSView* documentViewFor(LayoutObject*) const; |
188 | 188 |
189 virtual bool shouldUseFallbackTheme(const LayoutStyle&) const override; | 189 virtual bool shouldUseFallbackTheme(const ComputedStyle&) const override; |
190 | 190 |
191 private: | 191 private: |
192 virtual void updateActiveState(NSCell*, const LayoutObject*); | 192 virtual void updateActiveState(NSCell*, const LayoutObject*); |
193 virtual String extraDefaultStyleSheet() override; | 193 virtual String extraDefaultStyleSheet() override; |
194 virtual bool shouldShowPlaceholderWhenFocused() const override; | 194 virtual bool shouldShowPlaceholderWhenFocused() const override; |
195 | 195 |
196 mutable RetainPtr<NSPopUpButtonCell> m_popupButton; | 196 mutable RetainPtr<NSPopUpButtonCell> m_popupButton; |
197 mutable RetainPtr<NSSearchFieldCell> m_search; | 197 mutable RetainPtr<NSSearchFieldCell> m_search; |
198 mutable RetainPtr<NSMenu> m_searchMenuTemplate; | 198 mutable RetainPtr<NSMenu> m_searchMenuTemplate; |
199 mutable RetainPtr<NSLevelIndicatorCell> m_levelIndicator; | 199 mutable RetainPtr<NSLevelIndicatorCell> m_levelIndicator; |
200 mutable RetainPtr<NSTextFieldCell> m_textField; | 200 mutable RetainPtr<NSTextFieldCell> m_textField; |
201 | 201 |
202 mutable HashMap<int, RGBA32> m_systemColorCache; | 202 mutable HashMap<int, RGBA32> m_systemColorCache; |
203 | 203 |
204 RetainPtr<LayoutThemeNotificationObserver> m_notificationObserver; | 204 RetainPtr<LayoutThemeNotificationObserver> m_notificationObserver; |
205 }; | 205 }; |
206 | 206 |
207 } // namespace blink | 207 } // namespace blink |
208 | 208 |
209 #endif // LayoutThemeMac_h | 209 #endif // LayoutThemeMac_h |
OLD | NEW |