Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Side by Side Diff: third_party/WebKit/Source/core/paint/ThemePainter.cpp

Issue 2182413005: Merge "Add more UseCounters for -webkit-appearance:button and -webkit-appearance:textfield." to M53. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "core/paint/ThemePainter.h" 22 #include "core/paint/ThemePainter.h"
23 23
24 #include "core/InputTypeNames.h" 24 #include "core/InputTypeNames.h"
25 #include "core/frame/FrameView.h" 25 #include "core/frame/FrameView.h"
26 #include "core/frame/UseCounter.h"
26 #include "core/html/HTMLDataListElement.h" 27 #include "core/html/HTMLDataListElement.h"
27 #include "core/html/HTMLDataListOptionsCollection.h" 28 #include "core/html/HTMLDataListOptionsCollection.h"
28 #include "core/html/HTMLInputElement.h" 29 #include "core/html/HTMLInputElement.h"
29 #include "core/html/HTMLOptionElement.h" 30 #include "core/html/HTMLOptionElement.h"
30 #include "core/html/parser/HTMLParserIdioms.h" 31 #include "core/html/parser/HTMLParserIdioms.h"
31 #include "core/html/shadow/ShadowElementNames.h" 32 #include "core/html/shadow/ShadowElementNames.h"
32 #include "core/layout/LayoutTheme.h" 33 #include "core/layout/LayoutTheme.h"
33 #include "core/paint/MediaControlsPainter.h" 34 #include "core/paint/MediaControlsPainter.h"
34 #include "core/paint/PaintInfo.h" 35 #include "core/paint/PaintInfo.h"
35 #include "core/style/ComputedStyle.h" 36 #include "core/style/ComputedStyle.h"
(...skipping 24 matching lines...) Expand all
60 { 61 {
61 } 62 }
62 63
63 bool ThemePainter::paint(const LayoutObject& o, const PaintInfo& paintInfo, cons t IntRect&r) 64 bool ThemePainter::paint(const LayoutObject& o, const PaintInfo& paintInfo, cons t IntRect&r)
64 { 65 {
65 ControlPart part = o.styleRef().appearance(); 66 ControlPart part = o.styleRef().appearance();
66 67
67 if (LayoutTheme::theme().shouldUseFallbackTheme(o.styleRef())) 68 if (LayoutTheme::theme().shouldUseFallbackTheme(o.styleRef()))
68 return paintUsingFallbackTheme(o, paintInfo, r); 69 return paintUsingFallbackTheme(o, paintInfo, r);
69 70
71 if (part == ButtonPart && o.node()) {
72 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButtonRend ered);
73 if (isHTMLAnchorElement(o.node())) {
74 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButton ForAnchor);
75 } else if (isHTMLButtonElement(o.node())) {
76 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButton ForButton);
77 } else if (isHTMLInputElement(o.node()) && toHTMLInputElement(o.node())- >isTextButton()) {
78 // Text buttons (type=button, reset, submit) has
79 // -webkit-appearance:push-button by default.
80 UseCounter::count(o.node()->document(), UseCounter::CSSValueAppearan ceButtonForOtherButtons);
81 }
82 }
83
70 if (m_platformTheme) { 84 if (m_platformTheme) {
71 switch (part) { 85 switch (part) {
72 case CheckboxPart: 86 case CheckboxPart:
73 case RadioPart: 87 case RadioPart:
74 case PushButtonPart: 88 case PushButtonPart:
75 case SquareButtonPart: 89 case SquareButtonPart:
76 case ButtonPart: 90 case ButtonPart:
77 case InnerSpinButtonPart: 91 case InnerSpinButtonPart:
78 m_platformTheme->paint(part, LayoutTheme::controlStatesForLayoutObje ct(o), const_cast<GraphicsContext&>(paintInfo.context), r, o.styleRef().effectiv eZoom(), o.view()->frameView()); 92 m_platformTheme->paint(part, LayoutTheme::controlStatesForLayoutObje ct(o), const_cast<GraphicsContext&>(paintInfo.context), r, o.styleRef().effectiv eZoom(), o.view()->frameView());
79 return false; 93 return false;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 169 }
156 170
157 return true; // We don't support the appearance, so let the normal backgroun d/border paint. 171 return true; // We don't support the appearance, so let the normal backgroun d/border paint.
158 } 172 }
159 173
160 bool ThemePainter::paintBorderOnly(const LayoutObject& o, const PaintInfo& paint Info, const IntRect&r) 174 bool ThemePainter::paintBorderOnly(const LayoutObject& o, const PaintInfo& paint Info, const IntRect&r)
161 { 175 {
162 // Call the appropriate paint method based off the appearance value. 176 // Call the appropriate paint method based off the appearance value.
163 switch (o.styleRef().appearance()) { 177 switch (o.styleRef().appearance()) {
164 case TextFieldPart: 178 case TextFieldPart:
179 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceTextFieldR endered);
180 if (isHTMLInputElement(o.node())) {
181 HTMLInputElement* input = toHTMLInputElement(o.node());
182 if (input->type() == InputTypeNames::search)
183 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceTe xtFieldForSearch);
184 else if (input->isTextField())
185 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceTe xtFieldForTextField);
186 }
165 return paintTextField(o, paintInfo, r); 187 return paintTextField(o, paintInfo, r);
166 case TextAreaPart: 188 case TextAreaPart:
167 return paintTextArea(o, paintInfo, r); 189 return paintTextArea(o, paintInfo, r);
168 case MenulistButtonPart: 190 case MenulistButtonPart:
169 case SearchFieldPart: 191 case SearchFieldPart:
170 case ListboxPart: 192 case ListboxPart:
171 return true; 193 return true;
172 case CheckboxPart: 194 case CheckboxPart:
173 case RadioPart: 195 case RadioPart:
174 case PushButtonPart: 196 case PushButtonPart:
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 i.context.translate(unzoomedRect.x(), unzoomedRect.y()); 370 i.context.translate(unzoomedRect.x(), unzoomedRect.y());
349 i.context.scale(zoomLevel, zoomLevel); 371 i.context.scale(zoomLevel, zoomLevel);
350 i.context.translate(-unzoomedRect.x(), -unzoomedRect.y()); 372 i.context.translate(-unzoomedRect.x(), -unzoomedRect.y());
351 } 373 }
352 374
353 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartRadio, getWebFallbackThemeState(o), WebRect(unzoomedRect), &extraParam s); 375 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartRadio, getWebFallbackThemeState(o), WebRect(unzoomedRect), &extraParam s);
354 return false; 376 return false;
355 } 377 }
356 378
357 } // namespace blink 379 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698