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

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

Issue 2309593002: Factor code from ThemeMac into ThemeMacPainter. (Closed)
Patch Set: none Created 4 years, 3 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 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if (!LayoutTheme::isEnabled(o)) 49 if (!LayoutTheme::isEnabled(o))
50 return WebFallbackThemeEngine::StateDisabled; 50 return WebFallbackThemeEngine::StateDisabled;
51 if (LayoutTheme::isPressed(o)) 51 if (LayoutTheme::isPressed(o))
52 return WebFallbackThemeEngine::StatePressed; 52 return WebFallbackThemeEngine::StatePressed;
53 if (LayoutTheme::isHovered(o)) 53 if (LayoutTheme::isHovered(o))
54 return WebFallbackThemeEngine::StateHover; 54 return WebFallbackThemeEngine::StateHover;
55 55
56 return WebFallbackThemeEngine::StateNormal; 56 return WebFallbackThemeEngine::StateNormal;
57 } 57 }
58 58
59 ThemePainter::ThemePainter(Theme* platformTheme) 59 ThemePainter::ThemePainter()
60 : m_platformTheme(platformTheme)
61 { 60 {
62 } 61 }
63 62
64 bool ThemePainter::paint(const LayoutObject& o, const PaintInfo& paintInfo, cons t IntRect&r) 63 bool ThemePainter::paint(const LayoutObject& o, const PaintInfo& paintInfo, cons t IntRect&r)
65 { 64 {
66 ControlPart part = o.styleRef().appearance(); 65 ControlPart part = o.styleRef().appearance();
67 66
68 if (LayoutTheme::theme().shouldUseFallbackTheme(o.styleRef())) 67 if (LayoutTheme::theme().shouldUseFallbackTheme(o.styleRef()))
69 return paintUsingFallbackTheme(o, paintInfo, r); 68 return paintUsingFallbackTheme(o, paintInfo, r);
70 69
71 if (part == ButtonPart && o.node()) { 70 if (part == ButtonPart && o.node()) {
72 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButtonRend ered); 71 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButtonRend ered);
73 if (isHTMLAnchorElement(o.node())) { 72 if (isHTMLAnchorElement(o.node())) {
74 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButton ForAnchor); 73 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButton ForAnchor);
75 } else if (isHTMLButtonElement(o.node())) { 74 } else if (isHTMLButtonElement(o.node())) {
76 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButton ForButton); 75 UseCounter::count(o.document(), UseCounter::CSSValueAppearanceButton ForButton);
77 } else if (isHTMLInputElement(o.node()) && toHTMLInputElement(o.node())- >isTextButton()) { 76 } else if (isHTMLInputElement(o.node()) && toHTMLInputElement(o.node())- >isTextButton()) {
78 // Text buttons (type=button, reset, submit) has 77 // Text buttons (type=button, reset, submit) has
79 // -webkit-appearance:push-button by default. 78 // -webkit-appearance:push-button by default.
80 UseCounter::count(o.node()->document(), UseCounter::CSSValueAppearan ceButtonForOtherButtons); 79 UseCounter::count(o.node()->document(), UseCounter::CSSValueAppearan ceButtonForOtherButtons);
81 } 80 }
82 } 81 }
83 82
84 if (m_platformTheme) {
85 switch (part) {
86 case CheckboxPart:
87 case RadioPart:
88 case PushButtonPart:
89 case SquareButtonPart:
90 case ButtonPart:
91 case InnerSpinButtonPart:
92 m_platformTheme->paint(part, LayoutTheme::controlStatesForLayoutObje ct(o), const_cast<GraphicsContext&>(paintInfo.context), r, o.styleRef().effectiv eZoom(), o.view()->frameView());
93 return false;
94 default:
95 break;
96 }
97 }
98
99 // Call the appropriate paint method based off the appearance value. 83 // Call the appropriate paint method based off the appearance value.
100 switch (part) { 84 switch (part) {
101 case CheckboxPart: 85 case CheckboxPart:
102 return paintCheckbox(o, paintInfo, r); 86 return paintCheckbox(o, paintInfo, r);
103 case RadioPart: 87 case RadioPart:
104 return paintRadio(o, paintInfo, r); 88 return paintRadio(o, paintInfo, r);
105 case PushButtonPart: 89 case PushButtonPart:
106 case SquareButtonPart: 90 case SquareButtonPart:
107 case ButtonPart: 91 case ButtonPart:
108 return paintButton(o, paintInfo, r); 92 return paintButton(o, paintInfo, r);
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 i.context.translate(unzoomedRect.x(), unzoomedRect.y()); 354 i.context.translate(unzoomedRect.x(), unzoomedRect.y());
371 i.context.scale(zoomLevel, zoomLevel); 355 i.context.scale(zoomLevel, zoomLevel);
372 i.context.translate(-unzoomedRect.x(), -unzoomedRect.y()); 356 i.context.translate(-unzoomedRect.x(), -unzoomedRect.y());
373 } 357 }
374 358
375 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartRadio, getWebFallbackThemeState(o), WebRect(unzoomedRect), &extraParam s); 359 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartRadio, getWebFallbackThemeState(o), WebRect(unzoomedRect), &extraParam s);
376 return false; 360 return false;
377 } 361 }
378 362
379 } // namespace blink 363 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ThemePainter.h ('k') | third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698