Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: Source/core/layout/LayoutTheme.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutTheme.h ('k') | Source/core/layout/LayoutThemeAndroid.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 29 matching lines...) Expand all
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/LayoutMeter.h" 46 #include "core/layout/LayoutMeter.h"
47 #include "core/layout/LayoutView.h" 47 #include "core/layout/LayoutView.h"
48 #include "core/layout/PaintInfo.h" 48 #include "core/layout/PaintInfo.h"
49 #include "core/layout/style/AuthorStyleInfo.h" 49 #include "core/layout/style/AuthorStyleInfo.h"
50 #include "core/layout/style/LayoutStyle.h" 50 #include "core/layout/style/ComputedStyle.h"
51 #include "core/page/FocusController.h" 51 #include "core/page/FocusController.h"
52 #include "core/page/Page.h" 52 #include "core/page/Page.h"
53 #include "platform/FileMetadata.h" 53 #include "platform/FileMetadata.h"
54 #include "platform/FloatConversion.h" 54 #include "platform/FloatConversion.h"
55 #include "platform/RuntimeEnabledFeatures.h" 55 #include "platform/RuntimeEnabledFeatures.h"
56 #include "platform/fonts/FontSelector.h" 56 #include "platform/fonts/FontSelector.h"
57 #include "platform/graphics/GraphicsContextStateSaver.h" 57 #include "platform/graphics/GraphicsContextStateSaver.h"
58 #include "platform/text/PlatformLocale.h" 58 #include "platform/text/PlatformLocale.h"
59 #include "platform/text/StringTruncator.h" 59 #include "platform/text/StringTruncator.h"
60 #include "public/platform/Platform.h" 60 #include "public/platform/Platform.h"
(...skipping 20 matching lines...) Expand all
81 } 81 }
82 82
83 LayoutTheme::LayoutTheme() 83 LayoutTheme::LayoutTheme()
84 : m_hasCustomFocusRingColor(false) 84 : m_hasCustomFocusRingColor(false)
85 #if USE(NEW_THEME) 85 #if USE(NEW_THEME)
86 , m_platformTheme(platformTheme()) 86 , m_platformTheme(platformTheme())
87 #endif 87 #endif
88 { 88 {
89 } 89 }
90 90
91 void LayoutTheme::adjustStyle(LayoutStyle& style, Element* e, const AuthorStyleI nfo& authorStyle) 91 void LayoutTheme::adjustStyle(ComputedStyle& style, Element* e, const AuthorStyl eInfo& authorStyle)
92 { 92 {
93 ASSERT(style.hasAppearance()); 93 ASSERT(style.hasAppearance());
94 94
95 // 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)
96 ControlPart part = style.appearance(); 96 ControlPart part = style.appearance();
97 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
98 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOO TER_GROUP 98 || style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_FOO TER_GROUP
99 || 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
100 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION) 100 || style.display() == TABLE_CELL || style.display() == TABLE_CAPTION)
101 style.setDisplay(INLINE_BLOCK); 101 style.setDisplay(INLINE_BLOCK);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 LengthSize minControlSize = m_platformTheme->minimumControlSize(part, st yle.font().fontDescription(), style.effectiveZoom()); 179 LengthSize minControlSize = m_platformTheme->minimumControlSize(part, st yle.font().fontDescription(), style.effectiveZoom());
180 if (minControlSize.width() != style.minWidth()) 180 if (minControlSize.width() != style.minWidth())
181 style.setMinWidth(minControlSize.width()); 181 style.setMinWidth(minControlSize.width());
182 if (minControlSize.height() != style.minHeight()) 182 if (minControlSize.height() != style.minHeight())
183 style.setMinHeight(minControlSize.height()); 183 style.setMinHeight(minControlSize.height());
184 184
185 // Font 185 // Font
186 FontDescription controlFont = m_platformTheme->controlFont(part, style.f ont().fontDescription(), style.effectiveZoom()); 186 FontDescription controlFont = m_platformTheme->controlFont(part, style.f ont().fontDescription(), style.effectiveZoom());
187 if (controlFont != style.font().fontDescription()) { 187 if (controlFont != style.font().fontDescription()) {
188 // Reset our line-height 188 // Reset our line-height
189 style.setLineHeight(LayoutStyle::initialLineHeight()); 189 style.setLineHeight(ComputedStyle::initialLineHeight());
190 190
191 // Now update our font. 191 // Now update our font.
192 if (style.setFontDescription(controlFont)) 192 if (style.setFontDescription(controlFont))
193 style.font().update(nullptr); 193 style.font().update(nullptr);
194 } 194 }
195 } 195 }
196 default: 196 default:
197 break; 197 break;
198 } 198 }
199 #endif 199 #endif
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 #endif 541 #endif
542 } 542 }
543 543
544 bool LayoutTheme::isControlContainer(ControlPart appearance) const 544 bool LayoutTheme::isControlContainer(ControlPart appearance) const
545 { 545 {
546 // 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
547 // more controls. 547 // more controls.
548 return appearance != CheckboxPart && appearance != RadioPart; 548 return appearance != CheckboxPart && appearance != RadioPart;
549 } 549 }
550 550
551 bool LayoutTheme::isControlStyled(const LayoutStyle& style, const AuthorStyleInf o& authorStyle) const 551 bool LayoutTheme::isControlStyled(const ComputedStyle& style, const AuthorStyleI nfo& authorStyle) const
552 { 552 {
553 switch (style.appearance()) { 553 switch (style.appearance()) {
554 case PushButtonPart: 554 case PushButtonPart:
555 case SquareButtonPart: 555 case SquareButtonPart:
556 case ButtonPart: 556 case ButtonPart:
557 case ProgressBarPart: 557 case ProgressBarPart:
558 case MeterPart: 558 case MeterPart:
559 case RelevancyLevelIndicatorPart: 559 case RelevancyLevelIndicatorPart:
560 case ContinuousCapacityLevelIndicatorPart: 560 case ContinuousCapacityLevelIndicatorPart:
561 case DiscreteCapacityLevelIndicatorPart: 561 case DiscreteCapacityLevelIndicatorPart:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return true; 593 return true;
594 if (!renderer->styleRef().hasAppearance() && !node->isLink()) 594 if (!renderer->styleRef().hasAppearance() && !node->isLink())
595 return true; 595 return true;
596 // We can't use LayoutTheme::isFocused because outline:auto might be 596 // We can't use LayoutTheme::isFocused because outline:auto might be
597 // specified to non-:focus rulesets. 597 // specified to non-:focus rulesets.
598 if (node->focused() && !node->shouldHaveFocusAppearance()) 598 if (node->focused() && !node->shouldHaveFocusAppearance())
599 return false; 599 return false;
600 return true; 600 return true;
601 } 601 }
602 602
603 bool LayoutTheme::supportsFocusRing(const LayoutStyle& style) const 603 bool LayoutTheme::supportsFocusRing(const ComputedStyle& style) const
604 { 604 {
605 return (style.hasAppearance() && style.appearance() != TextFieldPart && styl e.appearance() != TextAreaPart && style.appearance() != MenulistButtonPart && st yle.appearance() != ListboxPart); 605 return (style.hasAppearance() && style.appearance() != TextFieldPart && styl e.appearance() != TextAreaPart && style.appearance() != MenulistButtonPart && st yle.appearance() != ListboxPart);
606 } 606 }
607 607
608 bool LayoutTheme::stateChanged(LayoutObject* o, ControlState state) const 608 bool LayoutTheme::stateChanged(LayoutObject* o, ControlState state) const
609 { 609 {
610 // Default implementation assumes the controls don't respond to changes in : hover state 610 // Default implementation assumes the controls don't respond to changes in : hover state
611 if (state == HoverControlState && !supportsHover(o->styleRef())) 611 if (state == HoverControlState && !supportsHover(o->styleRef()))
612 return false; 612 return false;
613 613
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 { 735 {
736 Node* node = o->node(); 736 Node* node = o->node();
737 if (!node || !node->isElementNode() || !toElement(node)->isSpinButtonElement ()) 737 if (!node || !node->isElementNode() || !toElement(node)->isSpinButtonElement ())
738 return false; 738 return false;
739 SpinButtonElement* element = toSpinButtonElement(node); 739 SpinButtonElement* element = toSpinButtonElement(node);
740 return element->upDownState() == SpinButtonElement::Up; 740 return element->upDownState() == SpinButtonElement::Up;
741 } 741 }
742 742
743 #if !USE(NEW_THEME) 743 #if !USE(NEW_THEME)
744 744
745 void LayoutTheme::adjustCheckboxStyle(LayoutStyle& style, Element*) const 745 void LayoutTheme::adjustCheckboxStyle(ComputedStyle& style, Element*) const
746 { 746 {
747 // A summary of the rules for checkbox designed to match WinIE: 747 // A summary of the rules for checkbox designed to match WinIE:
748 // width/height - honored (WinIE actually scales its control for small width s, but lets it overflow for small heights.) 748 // width/height - honored (WinIE actually scales its control for small width s, but lets it overflow for small heights.)
749 // font-size - not honored (control has no text), but we use it to decide wh ich control size to use. 749 // font-size - not honored (control has no text), but we use it to decide wh ich control size to use.
750 setCheckboxSize(style); 750 setCheckboxSize(style);
751 751
752 // padding - not honored by WinIE, needs to be removed. 752 // padding - not honored by WinIE, needs to be removed.
753 style.resetPadding(); 753 style.resetPadding();
754 754
755 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) 755 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
756 // for now, we will not honor it. 756 // for now, we will not honor it.
757 style.resetBorder(); 757 style.resetBorder();
758 } 758 }
759 759
760 void LayoutTheme::adjustRadioStyle(LayoutStyle& style, Element*) const 760 void LayoutTheme::adjustRadioStyle(ComputedStyle& style, Element*) const
761 { 761 {
762 // A summary of the rules for checkbox designed to match WinIE: 762 // A summary of the rules for checkbox designed to match WinIE:
763 // width/height - honored (WinIE actually scales its control for small width s, but lets it overflow for small heights.) 763 // width/height - honored (WinIE actually scales its control for small width s, but lets it overflow for small heights.)
764 // font-size - not honored (control has no text), but we use it to decide wh ich control size to use. 764 // font-size - not honored (control has no text), but we use it to decide wh ich control size to use.
765 setRadioSize(style); 765 setRadioSize(style);
766 766
767 // padding - not honored by WinIE, needs to be removed. 767 // padding - not honored by WinIE, needs to be removed.
768 style.resetPadding(); 768 style.resetPadding();
769 769
770 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme) 770 // border - honored by WinIE, but looks terrible (just paints in the control box and turns off the Windows XP theme)
771 // for now, we will not honor it. 771 // for now, we will not honor it.
772 style.resetBorder(); 772 style.resetBorder();
773 } 773 }
774 774
775 void LayoutTheme::adjustButtonStyle(LayoutStyle& style, Element*) const 775 void LayoutTheme::adjustButtonStyle(ComputedStyle& style, Element*) const
776 { 776 {
777 } 777 }
778 778
779 void LayoutTheme::adjustInnerSpinButtonStyle(LayoutStyle&, Element*) const 779 void LayoutTheme::adjustInnerSpinButtonStyle(ComputedStyle&, Element*) const
780 { 780 {
781 } 781 }
782 #endif 782 #endif
783 783
784 void LayoutTheme::adjustMenuListStyle(LayoutStyle&, Element*) const 784 void LayoutTheme::adjustMenuListStyle(ComputedStyle&, Element*) const
785 { 785 {
786 } 786 }
787 787
788 IntSize LayoutTheme::meterSizeForBounds(const LayoutMeter*, const IntRect& bound s) const 788 IntSize LayoutTheme::meterSizeForBounds(const LayoutMeter*, const IntRect& bound s) const
789 { 789 {
790 return bounds.size(); 790 return bounds.size();
791 } 791 }
792 792
793 bool LayoutTheme::supportsMeter(ControlPart) const 793 bool LayoutTheme::supportsMeter(ControlPart) const
794 { 794 {
(...skipping 23 matching lines...) Expand all
818 double max = input->maximum(); 818 double max = input->maximum();
819 ControlPart part = o->style()->appearance(); 819 ControlPart part = o->style()->appearance();
820 // We don't support ticks on alternate sliders like MediaVolumeSliders. 820 // We don't support ticks on alternate sliders like MediaVolumeSliders.
821 if (part != SliderHorizontalPart && part != SliderVerticalPart) 821 if (part != SliderHorizontalPart && part != SliderVerticalPart)
822 return; 822 return;
823 bool isHorizontal = part == SliderHorizontalPart; 823 bool isHorizontal = part == SliderHorizontalPart;
824 824
825 IntSize thumbSize; 825 IntSize thumbSize;
826 LayoutObject* thumbRenderer = input->closedShadowRoot()->getElementById(Shad owElementNames::sliderThumb())->layoutObject(); 826 LayoutObject* thumbRenderer = input->closedShadowRoot()->getElementById(Shad owElementNames::sliderThumb())->layoutObject();
827 if (thumbRenderer) { 827 if (thumbRenderer) {
828 const LayoutStyle& thumbStyle = thumbRenderer->styleRef(); 828 const ComputedStyle& thumbStyle = thumbRenderer->styleRef();
829 int thumbWidth = thumbStyle.width().intValue(); 829 int thumbWidth = thumbStyle.width().intValue();
830 int thumbHeight = thumbStyle.height().intValue(); 830 int thumbHeight = thumbStyle.height().intValue();
831 thumbSize.setWidth(isHorizontal ? thumbWidth : thumbHeight); 831 thumbSize.setWidth(isHorizontal ? thumbWidth : thumbHeight);
832 thumbSize.setHeight(isHorizontal ? thumbHeight : thumbWidth); 832 thumbSize.setHeight(isHorizontal ? thumbHeight : thumbWidth);
833 } 833 }
834 834
835 IntSize tickSize = sliderTickSize(); 835 IntSize tickSize = sliderTickSize();
836 float zoomFactor = o->style()->effectiveZoom(); 836 float zoomFactor = o->style()->effectiveZoom();
837 FloatRect tickRect; 837 FloatRect tickRect;
838 int tickRegionSideMargin = 0; 838 int tickRegionSideMargin = 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 double LayoutTheme::animationDurationForProgressBar() const 886 double LayoutTheme::animationDurationForProgressBar() const
887 { 887 {
888 return 0; 888 return 0;
889 } 889 }
890 890
891 bool LayoutTheme::shouldHaveSpinButton(HTMLInputElement* inputElement) const 891 bool LayoutTheme::shouldHaveSpinButton(HTMLInputElement* inputElement) const
892 { 892 {
893 return inputElement->isSteppable() && inputElement->type() != InputTypeNames ::range; 893 return inputElement->isSteppable() && inputElement->type() != InputTypeNames ::range;
894 } 894 }
895 895
896 void LayoutTheme::adjustMenuListButtonStyle(LayoutStyle&, Element*) const 896 void LayoutTheme::adjustMenuListButtonStyle(ComputedStyle&, Element*) const
897 { 897 {
898 } 898 }
899 899
900 void LayoutTheme::adjustSliderThumbStyle(LayoutStyle& style, Element* element) c onst 900 void LayoutTheme::adjustSliderThumbStyle(ComputedStyle& style, Element* element) const
901 { 901 {
902 adjustSliderThumbSize(style, element); 902 adjustSliderThumbSize(style, element);
903 } 903 }
904 904
905 void LayoutTheme::adjustSliderThumbSize(LayoutStyle&, Element*) const 905 void LayoutTheme::adjustSliderThumbSize(ComputedStyle&, Element*) const
906 { 906 {
907 } 907 }
908 908
909 void LayoutTheme::adjustSearchFieldStyle(LayoutStyle&, Element*) const 909 void LayoutTheme::adjustSearchFieldStyle(ComputedStyle&, Element*) const
910 { 910 {
911 } 911 }
912 912
913 void LayoutTheme::adjustSearchFieldCancelButtonStyle(LayoutStyle&, Element*) con st 913 void LayoutTheme::adjustSearchFieldCancelButtonStyle(ComputedStyle&, Element*) c onst
914 { 914 {
915 } 915 }
916 916
917 void LayoutTheme::adjustSearchFieldDecorationStyle(LayoutStyle&, Element*) const 917 void LayoutTheme::adjustSearchFieldDecorationStyle(ComputedStyle&, Element*) con st
918 { 918 {
919 } 919 }
920 920
921 void LayoutTheme::adjustSearchFieldResultsDecorationStyle(LayoutStyle&, Element* ) const 921 void LayoutTheme::adjustSearchFieldResultsDecorationStyle(ComputedStyle&, Elemen t*) const
922 { 922 {
923 } 923 }
924 924
925 void LayoutTheme::platformColorsDidChange() 925 void LayoutTheme::platformColorsDidChange()
926 { 926 {
927 Page::platformColorsChanged(); 927 Page::platformColorsChanged();
928 } 928 }
929 929
930 static FontDescription& getCachedFontDescription(CSSValueID systemFontID) 930 static FontDescription& getCachedFontDescription(CSSValueID systemFontID)
931 { 931 {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 bool LayoutTheme::supportsCalendarPicker(const AtomicString& type) const 1118 bool LayoutTheme::supportsCalendarPicker(const AtomicString& type) const
1119 { 1119 {
1120 return type == InputTypeNames::date 1120 return type == InputTypeNames::date
1121 || type == InputTypeNames::datetime 1121 || type == InputTypeNames::datetime
1122 || type == InputTypeNames::datetime_local 1122 || type == InputTypeNames::datetime_local
1123 || type == InputTypeNames::month 1123 || type == InputTypeNames::month
1124 || type == InputTypeNames::week; 1124 || type == InputTypeNames::week;
1125 } 1125 }
1126 #endif 1126 #endif
1127 1127
1128 bool LayoutTheme::shouldUseFallbackTheme(const LayoutStyle&) const 1128 bool LayoutTheme::shouldUseFallbackTheme(const ComputedStyle&) const
1129 { 1129 {
1130 return false; 1130 return false;
1131 } 1131 }
1132 1132
1133 void LayoutTheme::adjustStyleUsingFallbackTheme(LayoutStyle& style, Element* e) 1133 void LayoutTheme::adjustStyleUsingFallbackTheme(ComputedStyle& style, Element* e )
1134 { 1134 {
1135 ControlPart part = style.appearance(); 1135 ControlPart part = style.appearance();
1136 switch (part) { 1136 switch (part) {
1137 case CheckboxPart: 1137 case CheckboxPart:
1138 return adjustCheckboxStyleUsingFallbackTheme(style, e); 1138 return adjustCheckboxStyleUsingFallbackTheme(style, e);
1139 case RadioPart: 1139 case RadioPart:
1140 return adjustRadioStyleUsingFallbackTheme(style, e); 1140 return adjustRadioStyleUsingFallbackTheme(style, e);
1141 default: 1141 default:
1142 break; 1142 break;
1143 } 1143 }
1144 } 1144 }
1145 1145
1146 bool LayoutTheme::paintUsingFallbackTheme(LayoutObject* o, const PaintInfo& i, c onst IntRect& r) 1146 bool LayoutTheme::paintUsingFallbackTheme(LayoutObject* o, const PaintInfo& i, c onst IntRect& r)
1147 { 1147 {
1148 ControlPart part = o->style()->appearance(); 1148 ControlPart part = o->style()->appearance();
1149 switch (part) { 1149 switch (part) {
1150 case CheckboxPart: 1150 case CheckboxPart:
1151 return paintCheckboxUsingFallbackTheme(o, i, r); 1151 return paintCheckboxUsingFallbackTheme(o, i, r);
1152 case RadioPart: 1152 case RadioPart:
1153 return paintRadioUsingFallbackTheme(o, i, r); 1153 return paintRadioUsingFallbackTheme(o, i, r);
1154 default: 1154 default:
1155 break; 1155 break;
1156 } 1156 }
1157 return true; 1157 return true;
1158 } 1158 }
1159 1159
1160 // static 1160 // static
1161 void LayoutTheme::setSizeIfAuto(LayoutStyle& style, const IntSize& size) 1161 void LayoutTheme::setSizeIfAuto(ComputedStyle& style, const IntSize& size)
1162 { 1162 {
1163 if (style.width().isIntrinsicOrAuto()) 1163 if (style.width().isIntrinsicOrAuto())
1164 style.setWidth(Length(size.width(), Fixed)); 1164 style.setWidth(Length(size.width(), Fixed));
1165 if (style.height().isAuto()) 1165 if (style.height().isAuto())
1166 style.setHeight(Length(size.height(), Fixed)); 1166 style.setHeight(Length(size.height(), Fixed));
1167 } 1167 }
1168 1168
1169 bool LayoutTheme::paintCheckboxUsingFallbackTheme(LayoutObject* o, const PaintIn fo& i, const IntRect& r) 1169 bool LayoutTheme::paintCheckboxUsingFallbackTheme(LayoutObject* o, const PaintIn fo& i, const IntRect& r)
1170 { 1170 {
1171 WebFallbackThemeEngine::ExtraParams extraParams; 1171 WebFallbackThemeEngine::ExtraParams extraParams;
1172 WebCanvas* canvas = i.context->canvas(); 1172 WebCanvas* canvas = i.context->canvas();
1173 extraParams.button.checked = isChecked(o); 1173 extraParams.button.checked = isChecked(o);
1174 extraParams.button.indeterminate = isIndeterminate(o); 1174 extraParams.button.indeterminate = isIndeterminate(o);
1175 1175
1176 float zoomLevel = o->style()->effectiveZoom(); 1176 float zoomLevel = o->style()->effectiveZoom();
1177 GraphicsContextStateSaver stateSaver(*i.context); 1177 GraphicsContextStateSaver stateSaver(*i.context);
1178 IntRect unzoomedRect = r; 1178 IntRect unzoomedRect = r;
1179 if (zoomLevel != 1) { 1179 if (zoomLevel != 1) {
1180 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); 1180 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
1181 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1181 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1182 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1182 i.context->translate(unzoomedRect.x(), unzoomedRect.y());
1183 i.context->scale(zoomLevel, zoomLevel); 1183 i.context->scale(zoomLevel, zoomLevel);
1184 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1184 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1185 } 1185 }
1186 1186
1187 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartCheckbox, getWebFallbackThemeState(this, o), WebRect(unzoomedRect), &e xtraParams); 1187 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartCheckbox, getWebFallbackThemeState(this, o), WebRect(unzoomedRect), &e xtraParams);
1188 return false; 1188 return false;
1189 } 1189 }
1190 1190
1191 void LayoutTheme::adjustCheckboxStyleUsingFallbackTheme(LayoutStyle& style, Elem ent*) const 1191 void LayoutTheme::adjustCheckboxStyleUsingFallbackTheme(ComputedStyle& style, El ement*) const
1192 { 1192 {
1193 // If the width and height are both specified, then we have nothing to do. 1193 // If the width and height are both specified, then we have nothing to do.
1194 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) 1194 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
1195 return; 1195 return;
1196 1196
1197 IntSize size = Platform::current()->fallbackThemeEngine()->getSize(WebFallba ckThemeEngine::PartCheckbox); 1197 IntSize size = Platform::current()->fallbackThemeEngine()->getSize(WebFallba ckThemeEngine::PartCheckbox);
1198 float zoomLevel = style.effectiveZoom(); 1198 float zoomLevel = style.effectiveZoom();
1199 size.setWidth(size.width() * zoomLevel); 1199 size.setWidth(size.width() * zoomLevel);
1200 size.setHeight(size.height() * zoomLevel); 1200 size.setHeight(size.height() * zoomLevel);
1201 setSizeIfAuto(style, size); 1201 setSizeIfAuto(style, size);
(...skipping 21 matching lines...) Expand all
1223 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1223 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1224 i.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1224 i.context->translate(unzoomedRect.x(), unzoomedRect.y());
1225 i.context->scale(zoomLevel, zoomLevel); 1225 i.context->scale(zoomLevel, zoomLevel);
1226 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1226 i.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1227 } 1227 }
1228 1228
1229 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartRadio, getWebFallbackThemeState(this, o), WebRect(unzoomedRect), &extr aParams); 1229 Platform::current()->fallbackThemeEngine()->paint(canvas, WebFallbackThemeEn gine::PartRadio, getWebFallbackThemeState(this, o), WebRect(unzoomedRect), &extr aParams);
1230 return false; 1230 return false;
1231 } 1231 }
1232 1232
1233 void LayoutTheme::adjustRadioStyleUsingFallbackTheme(LayoutStyle& style, Element *) const 1233 void LayoutTheme::adjustRadioStyleUsingFallbackTheme(ComputedStyle& style, Eleme nt*) const
1234 { 1234 {
1235 // If the width and height are both specified, then we have nothing to do. 1235 // If the width and height are both specified, then we have nothing to do.
1236 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto()) 1236 if (!style.width().isIntrinsicOrAuto() && !style.height().isAuto())
1237 return; 1237 return;
1238 1238
1239 IntSize size = Platform::current()->fallbackThemeEngine()->getSize(WebFallba ckThemeEngine::PartRadio); 1239 IntSize size = Platform::current()->fallbackThemeEngine()->getSize(WebFallba ckThemeEngine::PartRadio);
1240 float zoomLevel = style.effectiveZoom(); 1240 float zoomLevel = style.effectiveZoom();
1241 size.setWidth(size.width() * zoomLevel); 1241 size.setWidth(size.width() * zoomLevel);
1242 size.setHeight(size.height() * zoomLevel); 1242 size.setHeight(size.height() * zoomLevel);
1243 setSizeIfAuto(style, size); 1243 setSizeIfAuto(style, size);
1244 1244
1245 // padding - not honored by WinIE, needs to be removed. 1245 // padding - not honored by WinIE, needs to be removed.
1246 style.resetPadding(); 1246 style.resetPadding();
1247 1247
1248 // 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)
1249 // for now, we will not honor it. 1249 // for now, we will not honor it.
1250 style.resetBorder(); 1250 style.resetBorder();
1251 } 1251 }
1252 1252
1253 } // namespace blink 1253 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutTheme.h ('k') | Source/core/layout/LayoutThemeAndroid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698