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, 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 15 matching lines...) Expand all Loading... |
26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
27 #include "core/layout/LayoutObject.h" | 27 #include "core/layout/LayoutObject.h" |
28 #include "platform/ThemeTypes.h" | 28 #include "platform/ThemeTypes.h" |
29 #include "platform/scroll/ScrollTypes.h" | 29 #include "platform/scroll/ScrollTypes.h" |
30 #include "wtf/PassRefPtr.h" | 30 #include "wtf/PassRefPtr.h" |
31 #include "wtf/RefCounted.h" | 31 #include "wtf/RefCounted.h" |
32 #include "wtf/text/WTFString.h" | 32 #include "wtf/text/WTFString.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
| 36 class AuthorStyleInfo; |
36 class ComputedStyle; | 37 class ComputedStyle; |
37 class Element; | 38 class Element; |
38 class FileList; | 39 class FileList; |
39 class HTMLInputElement; | 40 class HTMLInputElement; |
40 class LayoutMeter; | 41 class LayoutMeter; |
41 class Theme; | 42 class Theme; |
42 class ThemePainter; | 43 class ThemePainter; |
43 | 44 |
44 class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> { | 45 class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> { |
45 protected: | 46 protected: |
46 LayoutTheme(); | 47 LayoutTheme(); |
47 | 48 |
48 public: | 49 public: |
49 virtual ~LayoutTheme() { } | 50 virtual ~LayoutTheme() { } |
50 | 51 |
51 // This function is to be implemented in your platform-specific theme implem
entation to hand back the | 52 // This function is to be implemented in your platform-specific theme implem
entation to hand back the |
52 // appropriate platform theme. | 53 // appropriate platform theme. |
53 static LayoutTheme& theme(); | 54 static LayoutTheme& theme(); |
54 | 55 |
55 virtual ThemePainter& painter() = 0; | 56 virtual ThemePainter& painter() = 0; |
56 | 57 |
57 static void setSizeIfAuto(ComputedStyle&, const IntSize&); | 58 static void setSizeIfAuto(ComputedStyle&, const IntSize&); |
58 | 59 |
59 // This method is called whenever style has been computed for an element and
the appearance | 60 // This method is called whenever style has been computed for an element and
the appearance |
60 // property has been set to a value other than "none". The theme should map
in all of the appropriate | 61 // property has been set to a value other than "none". The theme should map
in all of the appropriate |
61 // metrics and defaults given the contents of the style. This includes soph
isticated operations like | 62 // metrics and defaults given the contents of the style. This includes soph
isticated operations like |
62 // selection of control size based off the font, the disabling of appearance
when certain other properties like | 63 // selection of control size based off the font, the disabling of appearance
when certain other properties like |
63 // "border" are set, or if the appearance is not supported by the theme. | 64 // "border" are set, or if the appearance is not supported by the theme. |
64 void adjustStyle(ComputedStyle&, Element*); | 65 void adjustStyle(ComputedStyle&, Element*, const AuthorStyleInfo&); |
65 | 66 |
66 // The remaining methods should be implemented by the platform-specific port
ion of the theme, e.g., | 67 // The remaining methods should be implemented by the platform-specific port
ion of the theme, e.g., |
67 // LayoutThemeMac.cpp for Mac OS X. | 68 // LayoutThemeMac.cpp for Mac OS X. |
68 | 69 |
69 // These methods return the theme's extra style sheets rules, to let each pl
atform | 70 // These methods return the theme's extra style sheets rules, to let each pl
atform |
70 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css
. | 71 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css
. |
71 virtual String extraDefaultStyleSheet(); | 72 virtual String extraDefaultStyleSheet(); |
72 virtual String extraQuirksStyleSheet() { return String(); } | 73 virtual String extraQuirksStyleSheet() { return String(); } |
73 virtual String extraMediaControlsStyleSheet() { return String(); } | 74 virtual String extraMediaControlsStyleSheet() { return String(); } |
74 virtual String extraFullScreenStyleSheet() { return String(); } | 75 virtual String extraFullScreenStyleSheet() { return String(); } |
75 | 76 |
76 // A method to obtain the baseline position for a "leaf" control. This will
only be used if a baseline | 77 // A method to obtain the baseline position for a "leaf" control. This will
only be used if a baseline |
77 // position cannot be determined by examining child content. Checkboxes and
radio buttons are examples of | 78 // position cannot be determined by examining child content. Checkboxes and
radio buttons are examples of |
78 // controls that need to do this. | 79 // controls that need to do this. |
79 virtual int baselinePosition(const LayoutObject*) const; | 80 virtual int baselinePosition(const LayoutObject*) const; |
80 | 81 |
81 // A method for asking if a control is a container or not. Leaf controls ha
ve to have some special behavior (like | 82 // A method for asking if a control is a container or not. Leaf controls ha
ve to have some special behavior (like |
82 // the baseline position API above). | 83 // the baseline position API above). |
83 bool isControlContainer(ControlPart) const; | 84 bool isControlContainer(ControlPart) const; |
84 | 85 |
85 // Whether or not the control has been styled enough by the author to disabl
e the native appearance. | 86 // Whether or not the control has been styled enough by the author to disabl
e the native appearance. |
86 virtual bool isControlStyled(const ComputedStyle&) const; | 87 virtual bool isControlStyled(const ComputedStyle&, const AuthorStyleInfo&) c
onst; |
87 | 88 |
88 // Some controls may spill out of their containers (e.g., the check on an OS
X 10.9 checkbox). Add this | 89 // Some controls may spill out of their containers (e.g., the check on an OS
X 10.9 checkbox). Add this |
89 // "visual overflow" to the object's border box rect. | 90 // "visual overflow" to the object's border box rect. |
90 virtual void addVisualOverflow(const LayoutObject&, IntRect& borderBox); | 91 virtual void addVisualOverflow(const LayoutObject&, IntRect& borderBox); |
91 | 92 |
92 // This method is called whenever a control state changes on a particular th
emed object, e.g., the mouse becomes pressed | 93 // This method is called whenever a control state changes on a particular th
emed object, e.g., the mouse becomes pressed |
93 // or a control becomes disabled. The ControlState parameter indicates which
state has changed (from having to not having, | 94 // or a control becomes disabled. The ControlState parameter indicates which
state has changed (from having to not having, |
94 // or vice versa). | 95 // or vice versa). |
95 bool controlStateChanged(LayoutObject&, ControlState) const; | 96 bool controlStateChanged(LayoutObject&, ControlState) const; |
96 | 97 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55; | 249 static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55; |
249 | 250 |
250 #if USE(NEW_THEME) | 251 #if USE(NEW_THEME) |
251 Theme* m_platformTheme; // The platform-specific theme. | 252 Theme* m_platformTheme; // The platform-specific theme. |
252 #endif | 253 #endif |
253 }; | 254 }; |
254 | 255 |
255 } // namespace blink | 256 } // namespace blink |
256 | 257 |
257 #endif // LayoutTheme_h | 258 #endif // LayoutTheme_h |
OLD | NEW |