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

Side by Side Diff: Source/core/layout/LayoutTheme.h

Issue 895383002: Let StyleResolver figure out differences between UA style and resolved style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 11 matching lines...) Expand all
22 22
23 #ifndef LayoutTheme_h 23 #ifndef LayoutTheme_h
24 #define LayoutTheme_h 24 #define LayoutTheme_h
25 25
26 #if USE(NEW_THEME) 26 #if USE(NEW_THEME)
27 #include "platform/Theme.h" 27 #include "platform/Theme.h"
28 #else 28 #else
29 #include "platform/ThemeTypes.h" 29 #include "platform/ThemeTypes.h"
30 #endif 30 #endif
31 #include "core/rendering/RenderObject.h" 31 #include "core/rendering/RenderObject.h"
32 #include "core/rendering/style/CachedUAStyle.h"
33 #include "platform/scroll/ScrollTypes.h" 32 #include "platform/scroll/ScrollTypes.h"
34 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
35 #include "wtf/RefCounted.h" 34 #include "wtf/RefCounted.h"
36 #include "wtf/text/WTFString.h" 35 #include "wtf/text/WTFString.h"
37 36
38 namespace blink { 37 namespace blink {
39 38
40 class Element; 39 class Element;
41 class FileList; 40 class FileList;
42 class HTMLInputElement; 41 class HTMLInputElement;
43 class RenderMeter; 42 class RenderMeter;
44 class RenderProgress; 43 class RenderProgress;
44 class UAStyleChange;
45 45
46 46
47 class LayoutTheme : public RefCounted<LayoutTheme> { 47 class LayoutTheme : public RefCounted<LayoutTheme> {
48 protected: 48 protected:
49 LayoutTheme(); 49 LayoutTheme();
50 50
51 public: 51 public:
52 virtual ~LayoutTheme() { } 52 virtual ~LayoutTheme() { }
53 53
54 // This function is to be implemented in your platform-specific theme implem entation to hand back the 54 // This function is to be implemented in your platform-specific theme implem entation to hand back the
55 // appropriate platform theme. 55 // appropriate platform theme.
56 static LayoutTheme& theme(); 56 static LayoutTheme& theme();
57 57
58 static void setSizeIfAuto(RenderStyle*, const IntSize&); 58 static void setSizeIfAuto(RenderStyle*, const IntSize&);
59 59
60 // 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
61 // 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
62 // 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
63 // 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
64 // "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.
65 void adjustStyle(RenderStyle*, Element*, const CachedUAStyle*); 65 void adjustStyle(RenderStyle*, Element*, const UAStyleChange&);
66 66
67 // This method is called to paint the widget as a background of the RenderOb ject. A widget's foreground, e.g., the 67 // This method is called to paint the widget as a background of the RenderOb ject. A widget's foreground, e.g., the
68 // text of a button, is always rendered by the engine itself. The boolean r eturn value indicates 68 // text of a button, is always rendered by the engine itself. The boolean r eturn value indicates
69 // whether the CSS border/background should also be painted. 69 // whether the CSS border/background should also be painted.
70 bool paint(RenderObject*, const PaintInfo&, const IntRect&); 70 bool paint(RenderObject*, const PaintInfo&, const IntRect&);
71 bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&); 71 bool paintBorderOnly(RenderObject*, const PaintInfo&, const IntRect&);
72 bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&); 72 bool paintDecorations(RenderObject*, const PaintInfo&, const IntRect&);
73 73
74 // The remaining methods should be implemented by the platform-specific port ion of the theme, e.g., 74 // The remaining methods should be implemented by the platform-specific port ion of the theme, e.g.,
75 // LayoutThemeMac.cpp for Mac OS X. 75 // LayoutThemeMac.cpp for Mac OS X.
76 76
77 // These methods return the theme's extra style sheets rules, to let each pl atform 77 // These methods return the theme's extra style sheets rules, to let each pl atform
78 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css . 78 // adjust the default CSS rules in html.css, quirks.css or mediaControls.css .
79 virtual String extraDefaultStyleSheet(); 79 virtual String extraDefaultStyleSheet();
80 virtual String extraQuirksStyleSheet() { return String(); } 80 virtual String extraQuirksStyleSheet() { return String(); }
81 virtual String extraMediaControlsStyleSheet() { return String(); } 81 virtual String extraMediaControlsStyleSheet() { return String(); }
82 virtual String extraFullScreenStyleSheet() { return String(); } 82 virtual String extraFullScreenStyleSheet() { return String(); }
83 83
84 // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline 84 // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
85 // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of 85 // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
86 // controls that need to do this. 86 // controls that need to do this.
87 virtual int baselinePosition(const RenderObject*) const; 87 virtual int baselinePosition(const RenderObject*) const;
88 88
89 // A method for asking if a control is a container or not. Leaf controls ha ve to have some special behavior (like 89 // A method for asking if a control is a container or not. Leaf controls ha ve to have some special behavior (like
90 // the baseline position API above). 90 // the baseline position API above).
91 bool isControlContainer(ControlPart) const; 91 bool isControlContainer(ControlPart) const;
92 92
93 // Whether or not the control has been styled enough by the author to disabl e the native appearance. 93 // Whether or not the control has been styled enough by the author to disabl e the native appearance.
94 virtual bool isControlStyled(const RenderStyle*, const CachedUAStyle*) const ; 94 virtual bool isControlStyled(const RenderStyle*, const UAStyleChange&) const ;
95 95
96 // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls issues paint invalidations, 96 // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls issues paint invalidations,
97 // the theme needs to communicate this inflated rect to the engine so that i t can invalidate the whole control. 97 // the theme needs to communicate this inflated rect to the engine so that i t can invalidate the whole control.
98 virtual void adjustPaintInvalidationRect(const RenderObject*, IntRect&); 98 virtual void adjustPaintInvalidationRect(const RenderObject*, IntRect&);
99 99
100 // This method is called whenever a relevant state changes on a particular t hemed object, e.g., the mouse becomes pressed 100 // This method is called whenever a relevant state changes on a particular t hemed object, e.g., the mouse becomes pressed
101 // or a control becomes disabled. 101 // or a control becomes disabled.
102 virtual bool stateChanged(RenderObject*, ControlState) const; 102 virtual bool stateChanged(RenderObject*, ControlState) const;
103 103
104 bool shouldDrawDefaultFocusRing(RenderObject*) const; 104 bool shouldDrawDefaultFocusRing(RenderObject*) const;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55; 307 static const RGBA32 defaultCompositionBackgroundColor = 0xFFFFDD55;
308 308
309 #if USE(NEW_THEME) 309 #if USE(NEW_THEME)
310 Theme* m_platformTheme; // The platform-specific theme. 310 Theme* m_platformTheme; // The platform-specific theme.
311 #endif 311 #endif
312 }; 312 };
313 313
314 } // namespace blink 314 } // namespace blink
315 315
316 #endif // LayoutTheme_h 316 #endif // LayoutTheme_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698