OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. | 2 * Copyright (C) 2007 Apple Inc. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2008 Collabora Ltd. | 4 * Copyright (C) 2008 Collabora Ltd. |
5 * Copyright (C) 2008, 2009 Google Inc. | 5 * Copyright (C) 2008, 2009 Google Inc. |
6 * Copyright (C) 2009 Kenneth Rohde Christiansen | 6 * Copyright (C) 2009 Kenneth Rohde Christiansen |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "core/rendering/RenderThemeChromiumDefault.h" | 26 #include "core/rendering/RenderThemeChromiumDefault.h" |
27 | 27 |
28 #include "CSSValueKeywords.h" | 28 #include "CSSValueKeywords.h" |
29 #include "RuntimeEnabledFeatures.h" | |
29 #include "UserAgentStyleSheets.h" | 30 #include "UserAgentStyleSheets.h" |
30 #include "core/platform/ScrollbarTheme.h" | 31 #include "core/platform/ScrollbarTheme.h" |
31 #include "core/platform/graphics/Color.h" | 32 #include "core/platform/graphics/Color.h" |
32 #include "core/platform/graphics/GraphicsContext.h" | 33 #include "core/platform/graphics/GraphicsContext.h" |
33 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 34 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
34 #include "core/rendering/PaintInfo.h" | 35 #include "core/rendering/PaintInfo.h" |
35 #include "core/rendering/RenderObject.h" | 36 #include "core/rendering/RenderObject.h" |
36 #include "core/rendering/RenderProgress.h" | 37 #include "core/rendering/RenderProgress.h" |
37 #include "core/rendering/RenderSlider.h" | 38 #include "core/rendering/RenderSlider.h" |
38 #include <public/default/WebThemeEngine.h> | 39 #include <public/default/WebThemeEngine.h> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 | 97 |
97 if (cssValueId == CSSValueButtonface) | 98 if (cssValueId == CSSValueButtonface) |
98 return defaultButtonGrayColor; | 99 return defaultButtonGrayColor; |
99 if (cssValueId == CSSValueMenu) | 100 if (cssValueId == CSSValueMenu) |
100 return defaultMenuColor; | 101 return defaultMenuColor; |
101 return RenderTheme::systemColor(cssValueId); | 102 return RenderTheme::systemColor(cssValueId); |
102 } | 103 } |
103 | 104 |
104 String RenderThemeChromiumDefault::extraDefaultStyleSheet() | 105 String RenderThemeChromiumDefault::extraDefaultStyleSheet() |
105 { | 106 { |
107 static String datalistCss = (RuntimeEnabledFeatures::datalistEnabled()) ? | |
tkent
2013/05/20 21:32:11
RenderThemeChromiumDefault is used only in Chromiu
| |
108 "datalist {display: none ;}" : ""; | |
106 #if !OS(WINDOWS) | 109 #if !OS(WINDOWS) |
107 return RenderThemeChromiumSkia::extraDefaultStyleSheet() + | 110 return RenderThemeChromiumSkia::extraDefaultStyleSheet() + |
108 String(themeChromiumLinuxUserAgentStyleSheet, sizeof(themeChromiumLin uxUserAgentStyleSheet)); | 111 String(themeChromiumLinuxUserAgentStyleSheet, sizeof(themeChromiumLinuxU serAgentStyleSheet)) + |
112 datalistCss; | |
109 #else | 113 #else |
110 return RenderThemeChromiumSkia::extraDefaultStyleSheet(); | 114 return RenderThemeChromiumSkia::extraDefaultStyleSheet() + |
115 datalistCss; | |
111 #endif | 116 #endif |
112 } | 117 } |
113 | 118 |
114 bool RenderThemeChromiumDefault::controlSupportsTints(const RenderObject* o) con st | 119 bool RenderThemeChromiumDefault::controlSupportsTints(const RenderObject* o) con st |
115 { | 120 { |
116 return isEnabled(o); | 121 return isEnabled(o); |
117 } | 122 } |
118 | 123 |
119 Color RenderThemeChromiumDefault::activeListBoxSelectionBackgroundColor() const | 124 Color RenderThemeChromiumDefault::activeListBoxSelectionBackgroundColor() const |
120 { | 125 { |
(...skipping 28 matching lines...) Expand all Loading... | |
149 Color RenderThemeChromiumDefault::platformActiveSelectionForegroundColor() const | 154 Color RenderThemeChromiumDefault::platformActiveSelectionForegroundColor() const |
150 { | 155 { |
151 return m_activeSelectionForegroundColor; | 156 return m_activeSelectionForegroundColor; |
152 } | 157 } |
153 | 158 |
154 Color RenderThemeChromiumDefault::platformInactiveSelectionForegroundColor() con st | 159 Color RenderThemeChromiumDefault::platformInactiveSelectionForegroundColor() con st |
155 { | 160 { |
156 return m_inactiveSelectionForegroundColor; | 161 return m_inactiveSelectionForegroundColor; |
157 } | 162 } |
158 | 163 |
159 #if ENABLE(DATALIST_ELEMENT) | |
160 IntSize RenderThemeChromiumDefault::sliderTickSize() const | 164 IntSize RenderThemeChromiumDefault::sliderTickSize() const |
161 { | 165 { |
162 return IntSize(1, 6); | 166 return IntSize(1, 6); |
163 } | 167 } |
164 | 168 |
165 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const | 169 int RenderThemeChromiumDefault::sliderTickOffsetFromTrackCenter() const |
166 { | 170 { |
167 return -16; | 171 return -16; |
168 } | 172 } |
169 #endif | |
170 | 173 |
171 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Eleme nt* element) const | 174 void RenderThemeChromiumDefault::adjustSliderThumbSize(RenderStyle* style, Eleme nt* element) const |
172 { | 175 { |
173 IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::W ebThemeEngine::PartSliderThumb); | 176 IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::W ebThemeEngine::PartSliderThumb); |
174 float zoomLevel = style->effectiveZoom(); | 177 float zoomLevel = style->effectiveZoom(); |
175 if (style->appearance() == SliderThumbHorizontalPart) { | 178 if (style->appearance() == SliderThumbHorizontalPart) { |
176 style->setWidth(Length(size.width() * zoomLevel, Fixed)); | 179 style->setWidth(Length(size.width() * zoomLevel, Fixed)); |
177 style->setHeight(Length(size.height() * zoomLevel, Fixed)); | 180 style->setHeight(Length(size.height() * zoomLevel, Fixed)); |
178 } else if (style->appearance() == SliderThumbVerticalPart) { | 181 } else if (style->appearance() == SliderThumbVerticalPart) { |
179 style->setWidth(Length(size.height() * zoomLevel, Fixed)); | 182 style->setWidth(Length(size.height() * zoomLevel, Fixed)); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
330 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartMenuList, getWebThemeState(this, o), WebKit::WebRect(rect), &extraPara ms); | 333 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartMenuList, getWebThemeState(this, o), WebKit::WebRect(rect), &extraPara ms); |
331 return false; | 334 return false; |
332 } | 335 } |
333 | 336 |
334 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn fo& i, const IntRect& rect) | 337 bool RenderThemeChromiumDefault::paintSliderTrack(RenderObject* o, const PaintIn fo& i, const IntRect& rect) |
335 { | 338 { |
336 WebKit::WebThemeEngine::ExtraParams extraParams; | 339 WebKit::WebThemeEngine::ExtraParams extraParams; |
337 WebKit::WebCanvas* canvas = i.context->canvas(); | 340 WebKit::WebCanvas* canvas = i.context->canvas(); |
338 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart ; | 341 extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart ; |
339 | 342 |
340 #if ENABLE(DATALIST_ELEMENT) | |
341 paintSliderTicks(o, i, rect); | 343 paintSliderTicks(o, i, rect); |
342 #endif | |
343 | 344 |
344 float zoomLevel = o->style()->effectiveZoom(); | 345 float zoomLevel = o->style()->effectiveZoom(); |
345 GraphicsContextStateSaver stateSaver(*i.context); | 346 GraphicsContextStateSaver stateSaver(*i.context); |
346 IntRect unzoomedRect = rect; | 347 IntRect unzoomedRect = rect; |
347 if (zoomLevel != 1) { | 348 if (zoomLevel != 1) { |
348 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 349 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
349 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 350 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
350 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 351 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); |
351 i.context->scale(FloatSize(zoomLevel, zoomLevel)); | 352 i.context->scale(FloatSize(zoomLevel, zoomLevel)); |
352 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 353 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraP arams); | 419 WebKit::Platform::current()->themeEngine()->paint(canvas, WebKit::WebThemeEn gine::PartProgressBar, getWebThemeState(this, o), WebKit::WebRect(rect), &extraP arams); |
419 return false; | 420 return false; |
420 } | 421 } |
421 | 422 |
422 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const | 423 bool RenderThemeChromiumDefault::shouldOpenPickerWithF4Key() const |
423 { | 424 { |
424 return true; | 425 return true; |
425 } | 426 } |
426 | 427 |
427 } // namespace WebCore | 428 } // namespace WebCore |
OLD | NEW |