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