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