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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 RenderTheme::RenderTheme() | 81 RenderTheme::RenderTheme() |
82 : m_hasCustomFocusRingColor(false) | 82 : m_hasCustomFocusRingColor(false) |
83 #if USE(NEW_THEME) | 83 #if USE(NEW_THEME) |
84 , m_platformTheme(platformTheme()) | 84 , m_platformTheme(platformTheme()) |
85 #endif | 85 #endif |
86 { | 86 { |
87 } | 87 } |
88 | 88 |
89 void RenderTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyl
e& uaStyle) | 89 void RenderTheme::adjustStyle(RenderStyle* style, Element* e, const CachedUAStyl
e* uaStyle) |
90 { | 90 { |
91 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) | 91 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) |
92 ControlPart part = style->appearance(); | 92 ControlPart part = style->appearance(); |
93 if (style->display() == INLINE || style->display() == INLINE_TABLE || style-
>display() == TABLE_ROW_GROUP | 93 if (style->display() == INLINE || style->display() == INLINE_TABLE || style-
>display() == TABLE_ROW_GROUP |
94 || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_F
OOTER_GROUP | 94 || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_F
OOTER_GROUP |
95 || style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GRO
UP || style->display() == TABLE_COLUMN | 95 || style->display() == TABLE_ROW || style->display() == TABLE_COLUMN_GRO
UP || style->display() == TABLE_COLUMN |
96 || style->display() == TABLE_CELL || style->display() == TABLE_CAPTION) | 96 || style->display() == TABLE_CELL || style->display() == TABLE_CAPTION) |
97 style->setDisplay(INLINE_BLOCK); | 97 style->setDisplay(INLINE_BLOCK); |
98 else if (style->display() == LIST_ITEM || style->display() == TABLE) | 98 else if (style->display() == LIST_ITEM || style->display() == TABLE) |
99 style->setDisplay(BLOCK); | 99 style->setDisplay(BLOCK); |
100 | 100 |
101 if (uaStyle.hasAppearance && isControlStyled(style, uaStyle)) { | 101 if (uaStyle && uaStyle->hasAppearance && isControlStyled(style, uaStyle)) { |
102 if (part == MenulistPart) { | 102 if (part == MenulistPart) { |
103 style->setAppearance(MenulistButtonPart); | 103 style->setAppearance(MenulistButtonPart); |
104 part = MenulistButtonPart; | 104 part = MenulistButtonPart; |
105 } else | 105 } else |
106 style->setAppearance(NoControlPart); | 106 style->setAppearance(NoControlPart); |
107 } | 107 } |
108 | 108 |
109 if (!style->hasAppearance()) | 109 if (!style->hasAppearance()) |
110 return; | 110 return; |
111 | 111 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 backgroundCopy.setRepeatX(NoRepeatFill); | 561 backgroundCopy.setRepeatX(NoRepeatFill); |
562 backgroundCopy.setRepeatY(NoRepeatFill); | 562 backgroundCopy.setRepeatY(NoRepeatFill); |
563 backgroundLayersCopy.setRepeatX(NoRepeatFill); | 563 backgroundLayersCopy.setRepeatX(NoRepeatFill); |
564 backgroundLayersCopy.setRepeatY(NoRepeatFill); | 564 backgroundLayersCopy.setRepeatY(NoRepeatFill); |
565 // Test the style to see if the UA border and background match. | 565 // Test the style to see if the UA border and background match. |
566 return style.border() != uaStyle.border | 566 return style.border() != uaStyle.border |
567 || backgroundLayersCopy != backgroundCopy | 567 || backgroundLayersCopy != backgroundCopy |
568 || style.visitedDependentColor(CSSPropertyBackgroundColor) != uaStyle.ba
ckgroundColor; | 568 || style.visitedDependentColor(CSSPropertyBackgroundColor) != uaStyle.ba
ckgroundColor; |
569 } | 569 } |
570 | 570 |
571 bool RenderTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle&
uaStyle) const | 571 bool RenderTheme::isControlStyled(const RenderStyle* style, const CachedUAStyle*
uaStyle) const |
572 { | 572 { |
| 573 ASSERT(uaStyle); |
| 574 |
573 switch (style->appearance()) { | 575 switch (style->appearance()) { |
574 case PushButtonPart: | 576 case PushButtonPart: |
575 case SquareButtonPart: | 577 case SquareButtonPart: |
576 case ButtonPart: | 578 case ButtonPart: |
577 case ProgressBarPart: | 579 case ProgressBarPart: |
578 case MeterPart: | 580 case MeterPart: |
579 case RelevancyLevelIndicatorPart: | 581 case RelevancyLevelIndicatorPart: |
580 case ContinuousCapacityLevelIndicatorPart: | 582 case ContinuousCapacityLevelIndicatorPart: |
581 case DiscreteCapacityLevelIndicatorPart: | 583 case DiscreteCapacityLevelIndicatorPart: |
582 case RatingLevelIndicatorPart: | 584 case RatingLevelIndicatorPart: |
583 return isBackgroundOrBorderStyled(*style, uaStyle); | 585 return isBackgroundOrBorderStyled(*style, *uaStyle); |
584 | 586 |
585 case ListboxPart: | 587 case ListboxPart: |
586 case MenulistPart: | 588 case MenulistPart: |
587 case SearchFieldPart: | 589 case SearchFieldPart: |
588 case TextAreaPart: | 590 case TextAreaPart: |
589 case TextFieldPart: | 591 case TextFieldPart: |
590 return isBackgroundOrBorderStyled(*style, uaStyle) || style->boxShadow()
; | 592 return isBackgroundOrBorderStyled(*style, *uaStyle) || style->boxShadow(
); |
591 | 593 |
592 case SliderHorizontalPart: | 594 case SliderHorizontalPart: |
593 case SliderVerticalPart: | 595 case SliderVerticalPart: |
594 return style->boxShadow(); | 596 return style->boxShadow(); |
595 | 597 |
596 default: | 598 default: |
597 return false; | 599 return false; |
598 } | 600 } |
599 } | 601 } |
600 | 602 |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 | 1218 |
1217 // padding - not honored by WinIE, needs to be removed. | 1219 // padding - not honored by WinIE, needs to be removed. |
1218 style->resetPadding(); | 1220 style->resetPadding(); |
1219 | 1221 |
1220 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1222 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
1221 // for now, we will not honor it. | 1223 // for now, we will not honor it. |
1222 style->resetBorder(); | 1224 style->resetBorder(); |
1223 } | 1225 } |
1224 | 1226 |
1225 } // namespace WebCore | 1227 } // namespace WebCore |
OLD | NEW |