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 27 matching lines...) Expand all Loading... |
38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
39 #include "core/html/HTMLMeterElement.h" | 39 #include "core/html/HTMLMeterElement.h" |
40 #include "core/html/HTMLOptionElement.h" | 40 #include "core/html/HTMLOptionElement.h" |
41 #include "core/html/parser/HTMLParserIdioms.h" | 41 #include "core/html/parser/HTMLParserIdioms.h" |
42 #include "core/html/shadow/MediaControlElements.h" | 42 #include "core/html/shadow/MediaControlElements.h" |
43 #include "core/html/shadow/ShadowElementNames.h" | 43 #include "core/html/shadow/ShadowElementNames.h" |
44 #include "core/html/shadow/SpinButtonElement.h" | 44 #include "core/html/shadow/SpinButtonElement.h" |
45 #include "core/html/shadow/TextControlInnerElements.h" | 45 #include "core/html/shadow/TextControlInnerElements.h" |
46 #include "core/page/FocusController.h" | 46 #include "core/page/FocusController.h" |
47 #include "core/page/Page.h" | 47 #include "core/page/Page.h" |
| 48 #include "core/style/AuthorStyleInfo.h" |
48 #include "core/style/ComputedStyle.h" | 49 #include "core/style/ComputedStyle.h" |
49 #include "platform/FileMetadata.h" | 50 #include "platform/FileMetadata.h" |
50 #include "platform/FloatConversion.h" | 51 #include "platform/FloatConversion.h" |
51 #include "platform/RuntimeEnabledFeatures.h" | 52 #include "platform/RuntimeEnabledFeatures.h" |
52 #include "platform/fonts/FontSelector.h" | 53 #include "platform/fonts/FontSelector.h" |
53 #include "platform/text/PlatformLocale.h" | 54 #include "platform/text/PlatformLocale.h" |
54 #include "platform/text/StringTruncator.h" | 55 #include "platform/text/StringTruncator.h" |
55 #include "public/platform/Platform.h" | 56 #include "public/platform/Platform.h" |
56 #include "public/platform/WebFallbackThemeEngine.h" | 57 #include "public/platform/WebFallbackThemeEngine.h" |
57 #include "public/platform/WebRect.h" | 58 #include "public/platform/WebRect.h" |
(...skipping 10 matching lines...) Expand all Loading... |
68 using namespace HTMLNames; | 69 using namespace HTMLNames; |
69 | 70 |
70 LayoutTheme::LayoutTheme() | 71 LayoutTheme::LayoutTheme() |
71 : m_hasCustomFocusRingColor(false) | 72 : m_hasCustomFocusRingColor(false) |
72 #if USE(NEW_THEME) | 73 #if USE(NEW_THEME) |
73 , m_platformTheme(platformTheme()) | 74 , m_platformTheme(platformTheme()) |
74 #endif | 75 #endif |
75 { | 76 { |
76 } | 77 } |
77 | 78 |
78 void LayoutTheme::adjustStyle(ComputedStyle& style, Element* e) | 79 void LayoutTheme::adjustStyle(ComputedStyle& style, Element* e, const AuthorStyl
eInfo& authorStyle) |
79 { | 80 { |
80 ASSERT(style.hasAppearance()); | 81 ASSERT(style.hasAppearance()); |
81 | 82 |
82 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) | 83 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) |
83 ControlPart part = style.appearance(); | 84 ControlPart part = style.appearance(); |
84 if (style.display() == INLINE || style.display() == INLINE_TABLE || style.di
splay() == TABLE_ROW_GROUP | 85 if (style.display() == INLINE || style.display() == INLINE_TABLE || style.di
splay() == TABLE_ROW_GROUP |
85 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOO
TER_GROUP | 86 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOO
TER_GROUP |
86 || style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP
|| style.display() == TABLE_COLUMN | 87 || style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP
|| style.display() == TABLE_COLUMN |
87 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) | 88 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) |
88 style.setDisplay(INLINE_BLOCK); | 89 style.setDisplay(INLINE_BLOCK); |
89 else if (style.display() == LIST_ITEM || style.display() == TABLE) | 90 else if (style.display() == LIST_ITEM || style.display() == TABLE) |
90 style.setDisplay(BLOCK); | 91 style.setDisplay(BLOCK); |
91 | 92 |
92 if (isControlStyled(style)) { | 93 if (isControlStyled(style, authorStyle)) { |
93 if (part == MenulistPart) { | 94 if (part == MenulistPart) { |
94 style.setAppearance(MenulistButtonPart); | 95 style.setAppearance(MenulistButtonPart); |
95 part = MenulistButtonPart; | 96 part = MenulistButtonPart; |
96 } else { | 97 } else { |
97 style.setAppearance(NoControlPart); | 98 style.setAppearance(NoControlPart); |
98 return; | |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
| 102 if (!style.hasAppearance()) |
| 103 return; |
| 104 |
102 if (shouldUseFallbackTheme(style)) { | 105 if (shouldUseFallbackTheme(style)) { |
103 adjustStyleUsingFallbackTheme(style); | 106 adjustStyleUsingFallbackTheme(style); |
104 return; | 107 return; |
105 } | 108 } |
106 | 109 |
107 #if USE(NEW_THEME) | 110 #if USE(NEW_THEME) |
108 switch (part) { | 111 switch (part) { |
109 case CheckboxPart: | 112 case CheckboxPart: |
110 case InnerSpinButtonPart: | 113 case InnerSpinButtonPart: |
111 case RadioPart: | 114 case RadioPart: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 #endif | 361 #endif |
359 } | 362 } |
360 | 363 |
361 bool LayoutTheme::isControlContainer(ControlPart appearance) const | 364 bool LayoutTheme::isControlContainer(ControlPart appearance) const |
362 { | 365 { |
363 // There are more leaves than this, but we'll patch this function as we add
support for | 366 // There are more leaves than this, but we'll patch this function as we add
support for |
364 // more controls. | 367 // more controls. |
365 return appearance != CheckboxPart && appearance != RadioPart; | 368 return appearance != CheckboxPart && appearance != RadioPart; |
366 } | 369 } |
367 | 370 |
368 bool LayoutTheme::isControlStyled(const ComputedStyle& style) const | 371 bool LayoutTheme::isControlStyled(const ComputedStyle& style, const AuthorStyleI
nfo& authorStyle) const |
369 { | 372 { |
370 switch (style.appearance()) { | 373 switch (style.appearance()) { |
371 case PushButtonPart: | 374 case PushButtonPart: |
372 case SquareButtonPart: | 375 case SquareButtonPart: |
373 case ButtonPart: | 376 case ButtonPart: |
374 case ProgressBarPart: | 377 case ProgressBarPart: |
375 case MeterPart: | 378 case MeterPart: |
376 case RelevancyLevelIndicatorPart: | 379 case RelevancyLevelIndicatorPart: |
377 case ContinuousCapacityLevelIndicatorPart: | 380 case ContinuousCapacityLevelIndicatorPart: |
378 case DiscreteCapacityLevelIndicatorPart: | 381 case DiscreteCapacityLevelIndicatorPart: |
379 case RatingLevelIndicatorPart: | 382 case RatingLevelIndicatorPart: |
380 return style.hasAuthorBackground() || style.hasAuthorBorder(); | 383 return authorStyle.specifiesBackground() || authorStyle.specifiesBorder(
); |
381 | 384 |
382 case MenulistPart: | 385 case MenulistPart: |
383 case SearchFieldPart: | 386 case SearchFieldPart: |
384 case TextAreaPart: | 387 case TextAreaPart: |
385 case TextFieldPart: | 388 case TextFieldPart: |
386 return style.hasAuthorBackground() || style.hasAuthorBorder() || style.b
oxShadow(); | 389 return authorStyle.specifiesBackground() || authorStyle.specifiesBorder(
) || style.boxShadow(); |
387 | 390 |
388 case SliderHorizontalPart: | 391 case SliderHorizontalPart: |
389 case SliderVerticalPart: | 392 case SliderVerticalPart: |
390 return style.boxShadow(); | 393 return style.boxShadow(); |
391 | 394 |
392 default: | 395 default: |
393 return false; | 396 return false; |
394 } | 397 } |
395 } | 398 } |
396 | 399 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 923 |
921 // padding - not honored by WinIE, needs to be removed. | 924 // padding - not honored by WinIE, needs to be removed. |
922 style.resetPadding(); | 925 style.resetPadding(); |
923 | 926 |
924 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 927 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
925 // for now, we will not honor it. | 928 // for now, we will not honor it. |
926 style.resetBorder(); | 929 style.resetBorder(); |
927 } | 930 } |
928 | 931 |
929 } // namespace blink | 932 } // namespace blink |
OLD | NEW |