| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 #endif | 376 #endif |
| 380 } | 377 } |
| 381 | 378 |
| 382 bool LayoutTheme::isControlContainer(ControlPart appearance) const | 379 bool LayoutTheme::isControlContainer(ControlPart appearance) const |
| 383 { | 380 { |
| 384 // There are more leaves than this, but we'll patch this function as we add
support for | 381 // There are more leaves than this, but we'll patch this function as we add
support for |
| 385 // more controls. | 382 // more controls. |
| 386 return appearance != CheckboxPart && appearance != RadioPart; | 383 return appearance != CheckboxPart && appearance != RadioPart; |
| 387 } | 384 } |
| 388 | 385 |
| 389 bool LayoutTheme::isControlStyled(const ComputedStyle& style, const AuthorStyleI
nfo& authorStyle) const | 386 bool LayoutTheme::isControlStyled(const ComputedStyle& style) const |
| 390 { | 387 { |
| 391 switch (style.appearance()) { | 388 switch (style.appearance()) { |
| 392 case PushButtonPart: | 389 case PushButtonPart: |
| 393 case SquareButtonPart: | 390 case SquareButtonPart: |
| 394 case ButtonPart: | 391 case ButtonPart: |
| 395 case ProgressBarPart: | 392 case ProgressBarPart: |
| 396 case MeterPart: | 393 case MeterPart: |
| 397 case RelevancyLevelIndicatorPart: | 394 case RelevancyLevelIndicatorPart: |
| 398 case ContinuousCapacityLevelIndicatorPart: | 395 case ContinuousCapacityLevelIndicatorPart: |
| 399 case DiscreteCapacityLevelIndicatorPart: | 396 case DiscreteCapacityLevelIndicatorPart: |
| 400 case RatingLevelIndicatorPart: | 397 case RatingLevelIndicatorPart: |
| 401 return authorStyle.specifiesBackground() || authorStyle.specifiesBorder(
); | 398 return style.hasAuthorBackground() || style.hasAuthorBorder(); |
| 402 | 399 |
| 403 case MenulistPart: | 400 case MenulistPart: |
| 404 case SearchFieldPart: | 401 case SearchFieldPart: |
| 405 case TextAreaPart: | 402 case TextAreaPart: |
| 406 case TextFieldPart: | 403 case TextFieldPart: |
| 407 return authorStyle.specifiesBackground() || authorStyle.specifiesBorder(
) || style.boxShadow(); | 404 return style.hasAuthorBackground() || style.hasAuthorBorder() || style.b
oxShadow(); |
| 408 | 405 |
| 409 case SliderHorizontalPart: | 406 case SliderHorizontalPart: |
| 410 case SliderVerticalPart: | 407 case SliderVerticalPart: |
| 411 return style.boxShadow(); | 408 return style.boxShadow(); |
| 412 | 409 |
| 413 default: | 410 default: |
| 414 return false; | 411 return false; |
| 415 } | 412 } |
| 416 } | 413 } |
| 417 | 414 |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 | 938 |
| 942 // padding - not honored by WinIE, needs to be removed. | 939 // padding - not honored by WinIE, needs to be removed. |
| 943 style.resetPadding(); | 940 style.resetPadding(); |
| 944 | 941 |
| 945 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 942 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
| 946 // for now, we will not honor it. | 943 // for now, we will not honor it. |
| 947 style.resetBorder(); | 944 style.resetBorder(); |
| 948 } | 945 } |
| 949 | 946 |
| 950 } // namespace blink | 947 } // namespace blink |
| OLD | NEW |