| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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/rendering/PaintInfo.h" | 48 #include "core/rendering/PaintInfo.h" |
| 49 #include "core/rendering/RenderMeter.h" | 49 #include "core/rendering/RenderMeter.h" |
| 50 #include "core/rendering/RenderView.h" | 50 #include "core/rendering/RenderView.h" |
| 51 #include "core/rendering/style/RenderStyle.h" | 51 #include "core/rendering/style/RenderStyle.h" |
| 52 #include "core/rendering/style/UAStyleChange.h" |
| 52 #include "platform/FileMetadata.h" | 53 #include "platform/FileMetadata.h" |
| 53 #include "platform/FloatConversion.h" | 54 #include "platform/FloatConversion.h" |
| 54 #include "platform/RuntimeEnabledFeatures.h" | 55 #include "platform/RuntimeEnabledFeatures.h" |
| 55 #include "platform/fonts/FontSelector.h" | 56 #include "platform/fonts/FontSelector.h" |
| 56 #include "platform/graphics/GraphicsContextStateSaver.h" | 57 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 57 #include "platform/text/PlatformLocale.h" | 58 #include "platform/text/PlatformLocale.h" |
| 58 #include "platform/text/StringTruncator.h" | 59 #include "platform/text/StringTruncator.h" |
| 59 #include "public/platform/Platform.h" | 60 #include "public/platform/Platform.h" |
| 60 #include "public/platform/WebFallbackThemeEngine.h" | 61 #include "public/platform/WebFallbackThemeEngine.h" |
| 61 #include "public/platform/WebRect.h" | 62 #include "public/platform/WebRect.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 80 } | 81 } |
| 81 | 82 |
| 82 LayoutTheme::LayoutTheme() | 83 LayoutTheme::LayoutTheme() |
| 83 : m_hasCustomFocusRingColor(false) | 84 : m_hasCustomFocusRingColor(false) |
| 84 #if USE(NEW_THEME) | 85 #if USE(NEW_THEME) |
| 85 , m_platformTheme(platformTheme()) | 86 , m_platformTheme(platformTheme()) |
| 86 #endif | 87 #endif |
| 87 { | 88 { |
| 88 } | 89 } |
| 89 | 90 |
| 90 void LayoutTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyl
e* uaStyle) | 91 void LayoutTheme::adjustStyle(RenderStyle* style, Element* e, const UAStyleChang
e& uaStyle) |
| 91 { | 92 { |
| 92 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) | 93 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) |
| 93 ControlPart part = style->appearance(); | 94 ControlPart part = style->appearance(); |
| 94 if (style->display() == INLINE || style->display() == INLINE_TABLE || style-
>display() == TABLE_ROW_GROUP | 95 if (style->display() == INLINE || style->display() == INLINE_TABLE || style-
>display() == TABLE_ROW_GROUP |
| 95 || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_F
OOTER_GROUP | 96 || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_F
OOTER_GROUP |
| 96 || style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GRO
UP || style->display() == TABLE_COLUMN | 97 || style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GRO
UP || style->display() == TABLE_COLUMN |
| 97 || style->display() == TABLE_CELL || style->display() == TABLE_CAPTION) | 98 || style->display() == TABLE_CELL || style->display() == TABLE_CAPTION) |
| 98 style->setDisplay(INLINE_BLOCK); | 99 style->setDisplay(INLINE_BLOCK); |
| 99 else if (style->display() == LIST_ITEM || style->display() == TABLE) | 100 else if (style->display() == LIST_ITEM || style->display() == TABLE) |
| 100 style->setDisplay(BLOCK); | 101 style->setDisplay(BLOCK); |
| 101 | 102 |
| 102 if (uaStyle && isControlStyled(style, uaStyle)) { | 103 if (uaStyle.hasAppearance && isControlStyled(style, uaStyle)) { |
| 103 if (part == MenulistPart) { | 104 if (part == MenulistPart) { |
| 104 style->setAppearance(MenulistButtonPart); | 105 style->setAppearance(MenulistButtonPart); |
| 105 part = MenulistButtonPart; | 106 part = MenulistButtonPart; |
| 106 } else { | 107 } else { |
| 107 style->setAppearance(NoControlPart); | 108 style->setAppearance(NoControlPart); |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 | 111 |
| 111 if (!style->hasAppearance()) | 112 if (!style->hasAppearance()) |
| 112 return; | 113 return; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 #endif | 539 #endif |
| 539 } | 540 } |
| 540 | 541 |
| 541 bool LayoutTheme::isControlContainer(ControlPart appearance) const | 542 bool LayoutTheme::isControlContainer(ControlPart appearance) const |
| 542 { | 543 { |
| 543 // There are more leaves than this, but we'll patch this function as we add
support for | 544 // There are more leaves than this, but we'll patch this function as we add
support for |
| 544 // more controls. | 545 // more controls. |
| 545 return appearance != CheckboxPart && appearance != RadioPart; | 546 return appearance != CheckboxPart && appearance != RadioPart; |
| 546 } | 547 } |
| 547 | 548 |
| 548 static bool isBackgroundOrBorderStyled(const RenderStyle& style, const CachedUAS
tyle& uaStyle) | 549 bool LayoutTheme::isControlStyled(const RenderStyle* style, const UAStyleChange&
uaStyle) const |
| 549 { | 550 { |
| 550 // Code below excludes the background-repeat from comparison by resetting it | |
| 551 FillLayer backgroundCopy = uaStyle.backgroundLayers; | |
| 552 FillLayer backgroundLayersCopy = style.backgroundLayers(); | |
| 553 backgroundCopy.setRepeatX(NoRepeatFill); | |
| 554 backgroundCopy.setRepeatY(NoRepeatFill); | |
| 555 backgroundLayersCopy.setRepeatX(NoRepeatFill); | |
| 556 backgroundLayersCopy.setRepeatY(NoRepeatFill); | |
| 557 // Test the style to see if the UA border and background match. | |
| 558 return style.border() != uaStyle.border | |
| 559 || backgroundLayersCopy != backgroundCopy | |
| 560 || style.visitedDependentColor(CSSPropertyBackgroundColor) != uaStyle.ba
ckgroundColor; | |
| 561 } | |
| 562 | |
| 563 bool LayoutTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle*
uaStyle) const | |
| 564 { | |
| 565 ASSERT(uaStyle); | |
| 566 | |
| 567 switch (style->appearance()) { | 551 switch (style->appearance()) { |
| 568 case PushButtonPart: | 552 case PushButtonPart: |
| 569 case SquareButtonPart: | 553 case SquareButtonPart: |
| 570 case ButtonPart: | 554 case ButtonPart: |
| 571 case ProgressBarPart: | 555 case ProgressBarPart: |
| 572 case MeterPart: | 556 case MeterPart: |
| 573 case RelevancyLevelIndicatorPart: | 557 case RelevancyLevelIndicatorPart: |
| 574 case ContinuousCapacityLevelIndicatorPart: | 558 case ContinuousCapacityLevelIndicatorPart: |
| 575 case DiscreteCapacityLevelIndicatorPart: | 559 case DiscreteCapacityLevelIndicatorPart: |
| 576 case RatingLevelIndicatorPart: | 560 case RatingLevelIndicatorPart: |
| 577 return isBackgroundOrBorderStyled(*style, *uaStyle); | 561 return uaStyle.backgroundChanged || uaStyle.borderChanged; |
| 578 | 562 |
| 579 case MenulistPart: | 563 case MenulistPart: |
| 580 case SearchFieldPart: | 564 case SearchFieldPart: |
| 581 case TextAreaPart: | 565 case TextAreaPart: |
| 582 case TextFieldPart: | 566 case TextFieldPart: |
| 583 return isBackgroundOrBorderStyled(*style, *uaStyle) || style->boxShadow(
); | 567 return uaStyle.backgroundChanged || uaStyle.borderChanged || style->boxS
hadow(); |
| 584 | 568 |
| 585 case SliderHorizontalPart: | 569 case SliderHorizontalPart: |
| 586 case SliderVerticalPart: | 570 case SliderVerticalPart: |
| 587 return style->boxShadow(); | 571 return style->boxShadow(); |
| 588 | 572 |
| 589 default: | 573 default: |
| 590 return false; | 574 return false; |
| 591 } | 575 } |
| 592 } | 576 } |
| 593 | 577 |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 | 1242 |
| 1259 // padding - not honored by WinIE, needs to be removed. | 1243 // padding - not honored by WinIE, needs to be removed. |
| 1260 style->resetPadding(); | 1244 style->resetPadding(); |
| 1261 | 1245 |
| 1262 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1246 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
| 1263 // for now, we will not honor it. | 1247 // for now, we will not honor it. |
| 1264 style->resetBorder(); | 1248 style->resetBorder(); |
| 1265 } | 1249 } |
| 1266 | 1250 |
| 1267 } // namespace blink | 1251 } // namespace blink |
| OLD | NEW |