Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / layout / LayoutThemeDefault.h
blobe633f1f509b2d67730caf1897fa6e9c1f195ef1b
1 /*
2 * This file is part of the WebKit project.
4 * Copyright (C) 2006 Apple Computer, Inc.
5 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
6 * Copyright (C) 2007 Holger Hans Peter Freyther
7 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
8 * Copyright (C) 2008, 2009 Google, Inc.
9 * All rights reserved.
10 * Copyright (C) 2009 Kenneth Rohde Christiansen
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details.
22 * You should have received a copy of the GNU Library General Public License
23 * along with this library; see the file COPYING.LIB. If not, write to
24 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 * Boston, MA 02110-1301, USA.
29 #ifndef LayoutThemeDefault_h
30 #define LayoutThemeDefault_h
32 #include "core/CoreExport.h"
33 #include "core/layout/LayoutTheme.h"
34 #include "core/paint/ThemePainterDefault.h"
36 namespace blink {
38 class LayoutProgress;
40 class CORE_EXPORT LayoutThemeDefault : public LayoutTheme {
41 public:
42 String extraDefaultStyleSheet() override;
43 String extraQuirksStyleSheet() override;
45 Color systemColor(CSSValueID) const override;
47 bool supportsFocusRing(const ComputedStyle&) const override;
49 // List Box selection color
50 virtual Color activeListBoxSelectionBackgroundColor() const;
51 virtual Color activeListBoxSelectionForegroundColor() const;
52 virtual Color inactiveListBoxSelectionBackgroundColor() const;
53 virtual Color inactiveListBoxSelectionForegroundColor() const;
55 Color platformActiveSelectionBackgroundColor() const override;
56 Color platformInactiveSelectionBackgroundColor() const override;
57 Color platformActiveSelectionForegroundColor() const override;
58 Color platformInactiveSelectionForegroundColor() const override;
60 IntSize sliderTickSize() const override;
61 int sliderTickOffsetFromTrackCenter() const override;
62 void adjustSliderThumbSize(ComputedStyle&) const override;
64 static void setCaretBlinkInterval(double);
66 void setCheckboxSize(ComputedStyle&) const override;
67 void setRadioSize(ComputedStyle&) const override;
68 void adjustInnerSpinButtonStyle(ComputedStyle&) const override;
70 bool popsMenuBySpaceKey() const final { return true; }
71 bool popsMenuByReturnKey() const final { return true; }
72 bool popsMenuByAltDownUpOrF4Key() const override { return true; }
74 bool shouldOpenPickerWithF4Key() const override;
76 Color platformTapHighlightColor() const override
78 return Color(defaultTapHighlightColor);
81 // A method asking if the theme's controls actually care about redrawing
82 // when hovered.
83 bool supportsHover(const ComputedStyle&) const final;
85 Color platformFocusRingColor() const override;
87 double caretBlinkInterval() const final;
89 // System fonts.
90 virtual void systemFont(CSSValueID systemFontID, FontStyle&, FontWeight&, float& fontSize, AtomicString& fontFamily) const;
92 int minimumMenuListSize(const ComputedStyle&) const override;
94 void adjustButtonStyle(ComputedStyle&) const override;
95 void adjustSearchFieldStyle(ComputedStyle&) const override;
96 void adjustSearchFieldCancelButtonStyle(ComputedStyle&) const override;
97 void adjustSearchFieldDecorationStyle(ComputedStyle&) const override;
98 void adjustSearchFieldResultsDecorationStyle(ComputedStyle&) const override;
100 // MenuList refers to an unstyled menulist (meaning a menulist without
101 // background-color or border set) and MenuListButton refers to a styled
102 // menulist (a menulist with background-color or border set). They have
103 // this distinction to support showing aqua style themes whenever they
104 // possibly can, which is something we don't want to replicate.
106 // In short, we either go down the MenuList code path or the MenuListButton
107 // codepath. We never go down both. And in both cases, they layout the
108 // entire menulist.
109 void adjustMenuListStyle(ComputedStyle&, Element*) const override;
110 void adjustMenuListButtonStyle(ComputedStyle&, Element*) const override;
112 double animationRepeatIntervalForProgressBar() const override;
113 double animationDurationForProgressBar() const override;
115 // These methods define the padding for the MenuList's inner block.
116 int popupInternalPaddingLeft(const ComputedStyle&) const override;
117 int popupInternalPaddingRight(const ComputedStyle&) const override;
118 int popupInternalPaddingTop(const ComputedStyle&) const override;
119 int popupInternalPaddingBottom(const ComputedStyle&) const override;
121 // Provide a way to pass the default font size from the Settings object
122 // to the layout theme. FIXME: http://b/1129186 A cleaner way would be
123 // to remove the default font size from this object and have callers
124 // that need the value to get it directly from the appropriate Settings
125 // object.
126 static void setDefaultFontSize(int);
128 static void setSelectionColors(unsigned activeBackgroundColor, unsigned activeForegroundColor, unsigned inactiveBackgroundColor, unsigned inactiveForegroundColor);
130 protected:
131 LayoutThemeDefault();
132 ~LayoutThemeDefault() override;
133 bool shouldUseFallbackTheme(const ComputedStyle&) const override;
134 virtual int menuListArrowPadding() const;
136 IntRect determinateProgressValueRectFor(LayoutProgress*, const IntRect&) const;
137 IntRect indeterminateProgressValueRectFor(LayoutProgress*, const IntRect&) const;
139 private:
140 ThemePainter& painter() override { return m_painter; }
142 int menuListInternalPadding(const ComputedStyle&, int paddingType) const;
144 static const RGBA32 defaultTapHighlightColor = 0x2e000000; // 18% black.
145 static double m_caretBlinkInterval;
147 static unsigned m_activeSelectionBackgroundColor;
148 static unsigned m_activeSelectionForegroundColor;
149 static unsigned m_inactiveSelectionBackgroundColor;
150 static unsigned m_inactiveSelectionForegroundColor;
152 ThemePainterDefault m_painter;
155 } // namespace blink
157 #endif // LayoutThemeDefault_h