| 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/html/HTMLFormControlElement.h" | 37 #include "core/html/HTMLFormControlElement.h" |
| 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/layout/PaintInfo.h" | 46 #include "core/layout/PaintInfo.h" |
| 47 #include "core/layout/style/AuthorStyleInfo.h" |
| 47 #include "core/layout/style/LayoutStyle.h" | 48 #include "core/layout/style/LayoutStyle.h" |
| 48 #include "core/page/FocusController.h" | 49 #include "core/page/FocusController.h" |
| 49 #include "core/page/Page.h" | 50 #include "core/page/Page.h" |
| 50 #include "core/rendering/RenderMeter.h" | 51 #include "core/rendering/RenderMeter.h" |
| 51 #include "core/rendering/RenderView.h" | 52 #include "core/rendering/RenderView.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" |
| (...skipping 23 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(LayoutStyle& style, Element* e, const CachedUAStyl
e* uaStyle) | 91 void LayoutTheme::adjustStyle(LayoutStyle& style, Element* e, const AuthorStyleI
nfo& authorStyle) |
| 91 { | 92 { |
| 93 ASSERT(style.hasAppearance()); |
| 94 |
| 92 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) | 95 // Force inline and table display styles to be inline-block (except for tabl
e- which is block) |
| 93 ControlPart part = style.appearance(); | 96 ControlPart part = style.appearance(); |
| 94 if (style.display() == INLINE || style.display() == INLINE_TABLE || style.di
splay() == TABLE_ROW_GROUP | 97 if (style.display() == INLINE || style.display() == INLINE_TABLE || style.di
splay() == TABLE_ROW_GROUP |
| 95 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOO
TER_GROUP | 98 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOO
TER_GROUP |
| 96 || style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP
|| style.display() == TABLE_COLUMN | 99 || style.display() == TABLE_ROW || style.display() == TABLE_COLUMN_GROUP
|| style.display() == TABLE_COLUMN |
| 97 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) | 100 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) |
| 98 style.setDisplay(INLINE_BLOCK); | 101 style.setDisplay(INLINE_BLOCK); |
| 99 else if (style.display() == LIST_ITEM || style.display() == TABLE) | 102 else if (style.display() == LIST_ITEM || style.display() == TABLE) |
| 100 style.setDisplay(BLOCK); | 103 style.setDisplay(BLOCK); |
| 101 | 104 |
| 102 if (uaStyle && isControlStyled(style, uaStyle)) { | 105 if (isControlStyled(style, authorStyle)) { |
| 103 if (part == MenulistPart) { | 106 if (part == MenulistPart) { |
| 104 style.setAppearance(MenulistButtonPart); | 107 style.setAppearance(MenulistButtonPart); |
| 105 part = MenulistButtonPart; | 108 part = MenulistButtonPart; |
| 106 } else { | 109 } else { |
| 107 style.setAppearance(NoControlPart); | 110 style.setAppearance(NoControlPart); |
| 108 } | 111 } |
| 109 } | 112 } |
| 110 | 113 |
| 111 if (!style.hasAppearance()) | 114 if (!style.hasAppearance()) |
| 112 return; | 115 return; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 #endif | 541 #endif |
| 539 } | 542 } |
| 540 | 543 |
| 541 bool LayoutTheme::isControlContainer(ControlPart appearance) const | 544 bool LayoutTheme::isControlContainer(ControlPart appearance) const |
| 542 { | 545 { |
| 543 // There are more leaves than this, but we'll patch this function as we add
support for | 546 // There are more leaves than this, but we'll patch this function as we add
support for |
| 544 // more controls. | 547 // more controls. |
| 545 return appearance != CheckboxPart && appearance != RadioPart; | 548 return appearance != CheckboxPart && appearance != RadioPart; |
| 546 } | 549 } |
| 547 | 550 |
| 548 static bool isBackgroundOrBorderStyled(const LayoutStyle& style, const CachedUAS
tyle* uaStyle) | 551 bool LayoutTheme::isControlStyled(const LayoutStyle& style, const AuthorStyleInf
o& authorStyle) const |
| 549 { | 552 { |
| 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->b
ackgroundColor; | |
| 561 } | |
| 562 | |
| 563 bool LayoutTheme::isControlStyled(const LayoutStyle& style, const CachedUAStyle*
uaStyle) const | |
| 564 { | |
| 565 ASSERT(uaStyle); | |
| 566 | |
| 567 switch (style.appearance()) { | 553 switch (style.appearance()) { |
| 568 case PushButtonPart: | 554 case PushButtonPart: |
| 569 case SquareButtonPart: | 555 case SquareButtonPart: |
| 570 case ButtonPart: | 556 case ButtonPart: |
| 571 case ProgressBarPart: | 557 case ProgressBarPart: |
| 572 case MeterPart: | 558 case MeterPart: |
| 573 case RelevancyLevelIndicatorPart: | 559 case RelevancyLevelIndicatorPart: |
| 574 case ContinuousCapacityLevelIndicatorPart: | 560 case ContinuousCapacityLevelIndicatorPart: |
| 575 case DiscreteCapacityLevelIndicatorPart: | 561 case DiscreteCapacityLevelIndicatorPart: |
| 576 case RatingLevelIndicatorPart: | 562 case RatingLevelIndicatorPart: |
| 577 return isBackgroundOrBorderStyled(style, uaStyle); | 563 return authorStyle.specifiesBackground() || authorStyle.specifiesBorder(
); |
| 578 | 564 |
| 579 case MenulistPart: | 565 case MenulistPart: |
| 580 case SearchFieldPart: | 566 case SearchFieldPart: |
| 581 case TextAreaPart: | 567 case TextAreaPart: |
| 582 case TextFieldPart: | 568 case TextFieldPart: |
| 583 return isBackgroundOrBorderStyled(style, uaStyle) || style.boxShadow(); | 569 return authorStyle.specifiesBackground() || authorStyle.specifiesBorder(
) || style.boxShadow(); |
| 584 | 570 |
| 585 case SliderHorizontalPart: | 571 case SliderHorizontalPart: |
| 586 case SliderVerticalPart: | 572 case SliderVerticalPart: |
| 587 return style.boxShadow(); | 573 return style.boxShadow(); |
| 588 | 574 |
| 589 default: | 575 default: |
| 590 return false; | 576 return false; |
| 591 } | 577 } |
| 592 } | 578 } |
| 593 | 579 |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1258 | 1244 |
| 1259 // padding - not honored by WinIE, needs to be removed. | 1245 // padding - not honored by WinIE, needs to be removed. |
| 1260 style.resetPadding(); | 1246 style.resetPadding(); |
| 1261 | 1247 |
| 1262 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1248 // 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. | 1249 // for now, we will not honor it. |
| 1264 style.resetBorder(); | 1250 style.resetBorder(); |
| 1265 } | 1251 } |
| 1266 | 1252 |
| 1267 } // namespace blink | 1253 } // namespace blink |
| OLD | NEW |