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

Side by Side Diff: Source/core/rendering/RenderThemeChromiumMac.mm

Issue 536973002: Revert 180822 "Specify clip rects when drawing Mac native widgets" (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2145/
Patch Set: Created 6 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google, Inc. 3 * Copyright (C) 2008, 2009 Google, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 extern "C" { 144 extern "C" {
145 void _NSDrawCarbonThemeBezel(NSRect frame, BOOL enabled, BOOL flipped); 145 void _NSDrawCarbonThemeBezel(NSRect frame, BOOL enabled, BOOL flipped);
146 // Request for public API: rdar://13787640 146 // Request for public API: rdar://13787640
147 void _NSDrawCarbonThemeListBox(NSRect frame, BOOL enabled, BOOL flipped, BOOL al ways_yes); 147 void _NSDrawCarbonThemeListBox(NSRect frame, BOOL enabled, BOOL flipped, BOOL al ways_yes);
148 } 148 }
149 149
150 namespace blink { 150 namespace blink {
151 151
152 using namespace HTMLNames; 152 using namespace HTMLNames;
153 153
154 enum {
155 topMargin,
156 rightMargin,
157 bottomMargin,
158 leftMargin
159 };
160
161 enum {
162 topPadding,
163 rightPadding,
164 bottomPadding,
165 leftPadding
166 };
167
154 RenderThemeChromiumMac::RenderThemeChromiumMac() 168 RenderThemeChromiumMac::RenderThemeChromiumMac()
155 : m_notificationObserver(AdoptNS, [[WebCoreRenderThemeNotificationObserver a lloc] initWithTheme:this]) 169 : m_notificationObserver(AdoptNS, [[WebCoreRenderThemeNotificationObserver a lloc] initWithTheme:this])
156 { 170 {
157 [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get () 171 [[NSNotificationCenter defaultCenter] addObserver:m_notificationObserver.get ()
158 selector:@selector(syste mColorsDidChange:) 172 selector:@selector(syste mColorsDidChange:)
159 name:NSSystemColorsD idChangeNotification 173 name:NSSystemColorsD idChangeNotification
160 object:nil]; 174 object:nil];
161 } 175 }
162 176
163 RenderThemeChromiumMac::~RenderThemeChromiumMac() 177 RenderThemeChromiumMac::~RenderThemeChromiumMac()
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 } 547 }
534 #endif 548 #endif
535 549
536 float zoomLevel = o->style()->effectiveZoom(); 550 float zoomLevel = o->style()->effectiveZoom();
537 551
538 if (part == MenulistPart) { 552 if (part == MenulistPart) {
539 setPopupButtonCellState(o, r); 553 setPopupButtonCellState(o, r);
540 IntSize size = popupButtonSizes()[[popupButton() controlSize]]; 554 IntSize size = popupButtonSizes()[[popupButton() controlSize]];
541 size.setHeight(size.height() * zoomLevel); 555 size.setHeight(size.height() * zoomLevel);
542 size.setWidth(r.width()); 556 size.setWidth(r.width());
543 r = ThemeMac::inflateRect(r, size, popupButtonMargins(), zoomLevel); 557 r = inflateRect(r, size, popupButtonMargins(), zoomLevel);
544 } else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalP art) { 558 } else if (part == SliderThumbHorizontalPart || part == SliderThumbVerticalP art) {
545 r.setHeight(r.height() + sliderThumbShadowBlur); 559 r.setHeight(r.height() + sliderThumbShadowBlur);
546 } 560 }
547 } 561 }
548 562
563 IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& siz e, const int* margins, float zoomLevel) const
564 {
565 // Only do the inflation if the available width/height are too small. Other wise try to
566 // fit the glow/check space into the available box's width/height.
567 int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel);
568 int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLev el + margins[bottomMargin] * zoomLevel);
569 IntRect result(r);
570 if (widthDelta < 0) {
571 result.setX(result.x() - margins[leftMargin] * zoomLevel);
572 result.setWidth(result.width() - widthDelta);
573 }
574 if (heightDelta < 0) {
575 result.setY(result.y() - margins[topMargin] * zoomLevel);
576 result.setHeight(result.height() - heightDelta);
577 }
578 return result;
579 }
580
549 FloatRect RenderThemeChromiumMac::convertToPaintingRect(const RenderObject* inpu tRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const I ntRect& r) const 581 FloatRect RenderThemeChromiumMac::convertToPaintingRect(const RenderObject* inpu tRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const I ntRect& r) const
550 { 582 {
551 FloatRect partRect(inputRect); 583 FloatRect partRect(inputRect);
552 584
553 // Compute an offset between the part renderer and the input renderer 585 // Compute an offset between the part renderer and the input renderer
554 FloatSize offsetFromInputRenderer; 586 FloatSize offsetFromInputRenderer;
555 const RenderObject* renderer = partRenderer; 587 const RenderObject* renderer = partRenderer;
556 while (renderer && renderer != inputRenderer) { 588 while (renderer && renderer != inputRenderer) {
557 RenderObject* containingRenderer = renderer->container(); 589 RenderObject* containingRenderer = renderer->container();
558 offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer( containingRenderer, LayoutPoint())); 590 offsetFromInputRenderer -= roundedIntSize(renderer->offsetFromContainer( containingRenderer, LayoutPoint()));
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 fontSize /= zoomLevel; 732 fontSize /= zoomLevel;
701 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) 733 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize])
702 return NSRegularControlSize; 734 return NSRegularControlSize;
703 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) 735 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize])
704 return NSSmallControlSize; 736 return NSSmallControlSize;
705 return NSMiniControlSize; 737 return NSMiniControlSize;
706 } 738 }
707 739
708 bool RenderThemeChromiumMac::paintTextField(RenderObject* o, const PaintInfo& pa intInfo, const IntRect& r) 740 bool RenderThemeChromiumMac::paintTextField(RenderObject* o, const PaintInfo& pa intInfo, const IntRect& r)
709 { 741 {
710 LocalCurrentGraphicsContext localContext(paintInfo.context, r); 742 LocalCurrentGraphicsContext localContext(paintInfo.context);
711 743
712 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 744 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070
713 bool useNSTextFieldCell = o->style()->hasAppearance() 745 bool useNSTextFieldCell = o->style()->hasAppearance()
714 && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Colo r::white 746 && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Colo r::white
715 && !o->style()->hasBackgroundImage(); 747 && !o->style()->hasBackgroundImage();
716 748
717 // We do not use NSTextFieldCell to draw styled text fields on Lion and Snow Leopard because 749 // We do not use NSTextFieldCell to draw styled text fields on Lion and Snow Leopard because
718 // there are a number of bugs on those platforms that require NSTextFieldCel l to be in charge 750 // there are a number of bugs on those platforms that require NSTextFieldCel l to be in charge
719 // of painting its own background. We need WebCore to paint styled backgroun ds, so we'll use 751 // of painting its own background. We need WebCore to paint styled backgroun ds, so we'll use
720 // this AppKit SPI function instead. 752 // this AppKit SPI function instead.
(...skipping 11 matching lines...) Expand all
732 [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)]; 764 [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)];
733 765
734 [textField setControlView:nil]; 766 [textField setControlView:nil];
735 767
736 return false; 768 return false;
737 } 769 }
738 770
739 bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const PaintIn fo& paintInfo, const IntRect& r) 771 bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const PaintIn fo& paintInfo, const IntRect& r)
740 { 772 {
741 // This draws the caps lock indicator as it was done by WKDrawCapsLockIndica tor. 773 // This draws the caps lock indicator as it was done by WKDrawCapsLockIndica tor.
742 LocalCurrentGraphicsContext localContext(paintInfo.context, r); 774 LocalCurrentGraphicsContext localContext(paintInfo.context);
743 CGContextRef c = localContext.cgContext(); 775 CGContextRef c = localContext.cgContext();
744 CGMutablePathRef shape = CGPathCreateMutable(); 776 CGMutablePathRef shape = CGPathCreateMutable();
745 777
746 // To draw the caps lock indicator, draw the shape into a small 778 // To draw the caps lock indicator, draw the shape into a small
747 // square that is then scaled to the size of r. 779 // square that is then scaled to the size of r.
748 const CGFloat kSquareSize = 17; 780 const CGFloat kSquareSize = 17;
749 781
750 // Create a rounted square shape. 782 // Create a rounted square shape.
751 CGPathMoveToPoint(shape, NULL, 16.5, 4.5); 783 CGPathMoveToPoint(shape, NULL, 16.5, 4.5);
752 CGPathAddArc(shape, NULL, 12.5, 12.5, 4, 0, M_PI_2, false); 784 CGPathAddArc(shape, NULL, 12.5, 12.5, 4, 0, M_PI_2, false);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 CGContextBeginPath(c); 822 CGContextBeginPath(c);
791 CGContextAddPath(c, paintPath); 823 CGContextAddPath(c, paintPath);
792 CGContextFillPath(c); 824 CGContextFillPath(c);
793 CGPathRelease(paintPath); 825 CGPathRelease(paintPath);
794 826
795 return false; 827 return false;
796 } 828 }
797 829
798 bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const PaintInfo& pai ntInfo, const IntRect& r) 830 bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const PaintInfo& pai ntInfo, const IntRect& r)
799 { 831 {
800 LocalCurrentGraphicsContext localContext(paintInfo.context, r); 832 LocalCurrentGraphicsContext localContext(paintInfo.context);
801 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES ); 833 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES );
802 return false; 834 return false;
803 } 835 }
804 836
805 const int* RenderThemeChromiumMac::popupButtonMargins() const 837 const int* RenderThemeChromiumMac::popupButtonMargins() const
806 { 838 {
807 static const int margins[3][4] = 839 static const int margins[3][4] =
808 { 840 {
809 { 0, 3, 1, 3 }, 841 { 0, 3, 1, 3 },
810 { 0, 3, 2, 3 }, 842 { 0, 3, 2, 3 },
(...skipping 14 matching lines...) Expand all
825 { 857 {
826 { 2, 26, 3, 8 }, 858 { 2, 26, 3, 8 },
827 { 2, 23, 3, 8 }, 859 { 2, 23, 3, 8 },
828 { 2, 22, 3, 10 } 860 { 2, 22, 3, 10 }
829 }; 861 };
830 return padding[size]; 862 return padding[size];
831 } 863 }
832 864
833 bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const PaintInfo& pai ntInfo, const IntRect& r) 865 bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const PaintInfo& pai ntInfo, const IntRect& r)
834 { 866 {
867 LocalCurrentGraphicsContext localContext(paintInfo.context);
835 setPopupButtonCellState(o, r); 868 setPopupButtonCellState(o, r);
836 869
837 NSPopUpButtonCell* popupButton = this->popupButton(); 870 NSPopUpButtonCell* popupButton = this->popupButton();
838 871
839 float zoomLevel = o->style()->effectiveZoom(); 872 float zoomLevel = o->style()->effectiveZoom();
840 IntSize size = popupButtonSizes()[[popupButton controlSize]]; 873 IntSize size = popupButtonSizes()[[popupButton controlSize]];
841 size.setHeight(size.height() * zoomLevel); 874 size.setHeight(size.height() * zoomLevel);
842 size.setWidth(r.width()); 875 size.setWidth(r.width());
843 876
844 // Now inflate it to account for the shadow. 877 // Now inflate it to account for the shadow.
845 IntRect inflatedRect = r; 878 IntRect inflatedRect = r;
846 if (r.width() >= minimumMenuListSize(o->style())) 879 if (r.width() >= minimumMenuListSize(o->style()))
847 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, popupButtonMarg ins(), zoomLevel); 880 inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoo mLevel);
848 881
849 LocalCurrentGraphicsContext localContext(paintInfo.context, ThemeMac::inflat eRectForFocusRing(inflatedRect));
850 GraphicsContextStateSaver stateSaver(*paintInfo.context); 882 GraphicsContextStateSaver stateSaver(*paintInfo.context);
851 883
852 // On Leopard, the cell will draw outside of the given rect, so we have to c lip to the rect 884 // On Leopard, the cell will draw outside of the given rect, so we have to c lip to the rect
853 paintInfo.context->clip(inflatedRect); 885 paintInfo.context->clip(inflatedRect);
854 886
855 if (zoomLevel != 1.0f) { 887 if (zoomLevel != 1.0f) {
856 inflatedRect.setWidth(inflatedRect.width() / zoomLevel); 888 inflatedRect.setWidth(inflatedRect.width() / zoomLevel);
857 inflatedRect.setHeight(inflatedRect.height() / zoomLevel); 889 inflatedRect.setHeight(inflatedRect.height() / zoomLevel);
858 paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); 890 paintInfo.context->translate(inflatedRect.x(), inflatedRect.y());
859 paintInfo.context->scale(zoomLevel, zoomLevel); 891 paintInfo.context->scale(zoomLevel, zoomLevel);
(...skipping 21 matching lines...) Expand all
881 NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size()) ]; 913 NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size()) ];
882 return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.wid th(), 914 return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.wid th(),
883 bounds.height() < cellSize.height ? cellSize.height : bounds. height()); 915 bounds.height() < cellSize.height ? cellSize.height : bounds. height());
884 } 916 }
885 917
886 bool RenderThemeChromiumMac::paintMeter(RenderObject* renderObject, const PaintI nfo& paintInfo, const IntRect& rect) 918 bool RenderThemeChromiumMac::paintMeter(RenderObject* renderObject, const PaintI nfo& paintInfo, const IntRect& rect)
887 { 919 {
888 if (!renderObject->isMeter()) 920 if (!renderObject->isMeter())
889 return true; 921 return true;
890 922
891 LocalCurrentGraphicsContext localContext(paintInfo.context, rect); 923 LocalCurrentGraphicsContext localContext(paintInfo.context);
892 924
893 NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(renderObject)); 925 NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(renderObject));
894 GraphicsContextStateSaver stateSaver(*paintInfo.context); 926 GraphicsContextStateSaver stateSaver(*paintInfo.context);
895 927
896 [cell drawWithFrame:rect inView:documentViewFor(renderObject)]; 928 [cell drawWithFrame:rect inView:documentViewFor(renderObject)];
897 [cell setControlView:nil]; 929 [cell setControlView:nil];
898 return false; 930 return false;
899 } 931 }
900 932
901 bool RenderThemeChromiumMac::supportsMeter(ControlPart part) const 933 bool RenderThemeChromiumMac::supportsMeter(ControlPart part) const
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 1042
1011 float zoomLevel = renderObject->style()->effectiveZoom(); 1043 float zoomLevel = renderObject->style()->effectiveZoom();
1012 int controlSize = controlSizeForFont(renderObject->style()); 1044 int controlSize = controlSizeForFont(renderObject->style());
1013 IntSize size = progressBarSizes()[controlSize]; 1045 IntSize size = progressBarSizes()[controlSize];
1014 size.setHeight(size.height() * zoomLevel); 1046 size.setHeight(size.height() * zoomLevel);
1015 size.setWidth(rect.width()); 1047 size.setWidth(rect.width());
1016 1048
1017 // Now inflate it to account for the shadow. 1049 // Now inflate it to account for the shadow.
1018 IntRect inflatedRect = rect; 1050 IntRect inflatedRect = rect;
1019 if (rect.height() <= minimumProgressBarHeight(renderObject->style())) 1051 if (rect.height() <= minimumProgressBarHeight(renderObject->style()))
1020 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, progressBarMarg ins(controlSize), zoomLevel); 1052 inflatedRect = inflateRect(inflatedRect, size, progressBarMargins(contro lSize), zoomLevel);
1021 1053
1022 RenderProgress* renderProgress = toRenderProgress(renderObject); 1054 RenderProgress* renderProgress = toRenderProgress(renderObject);
1023 HIThemeTrackDrawInfo trackInfo; 1055 HIThemeTrackDrawInfo trackInfo;
1024 trackInfo.version = 0; 1056 trackInfo.version = 0;
1025 if (controlSize == NSRegularControlSize) 1057 if (controlSize == NSRegularControlSize)
1026 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina teBar : kThemeLargeProgressBar; 1058 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina teBar : kThemeLargeProgressBar;
1027 else 1059 else
1028 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin ateBar : kThemeMediumProgressBar; 1060 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin ateBar : kThemeMediumProgressBar;
1029 1061
1030 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); 1062 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size());
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 // These functions are called with MenuListPart or MenulistButtonPart appearance by RenderMenuList, or with TextFieldPart appearance by AutofillPopupMenuClient. 1178 // These functions are called with MenuListPart or MenulistButtonPart appearance by RenderMenuList, or with TextFieldPart appearance by AutofillPopupMenuClient.
1147 // We assume only AutofillPopupMenuClient gives TexfieldPart appearance here. 1179 // We assume only AutofillPopupMenuClient gives TexfieldPart appearance here.
1148 // We want to change only Autofill padding. 1180 // We want to change only Autofill padding.
1149 // In the future, we have to separate Autofill popup window logic from WebKit to Chromium. 1181 // In the future, we have to separate Autofill popup window logic from WebKit to Chromium.
1150 int RenderThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const 1182 int RenderThemeChromiumMac::popupInternalPaddingLeft(RenderStyle* style) const
1151 { 1183 {
1152 if (style->appearance() == TextFieldPart) 1184 if (style->appearance() == TextFieldPart)
1153 return autofillPopupHorizontalPadding; 1185 return autofillPopupHorizontalPadding;
1154 1186
1155 if (style->appearance() == MenulistPart) 1187 if (style->appearance() == MenulistPart)
1156 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::LeftMargi n] * style->effectiveZoom(); 1188 return popupButtonPadding(controlSizeForFont(style))[leftPadding] * styl e->effectiveZoom();
1157 if (style->appearance() == MenulistButtonPart) 1189 if (style->appearance() == MenulistButtonPart)
1158 return styledPopupPaddingLeft * style->effectiveZoom(); 1190 return styledPopupPaddingLeft * style->effectiveZoom();
1159 return 0; 1191 return 0;
1160 } 1192 }
1161 1193
1162 int RenderThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const 1194 int RenderThemeChromiumMac::popupInternalPaddingRight(RenderStyle* style) const
1163 { 1195 {
1164 if (style->appearance() == TextFieldPart) 1196 if (style->appearance() == TextFieldPart)
1165 return autofillPopupHorizontalPadding; 1197 return autofillPopupHorizontalPadding;
1166 1198
1167 if (style->appearance() == MenulistPart) 1199 if (style->appearance() == MenulistPart)
1168 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::RightMarg in] * style->effectiveZoom(); 1200 return popupButtonPadding(controlSizeForFont(style))[rightPadding] * sty le->effectiveZoom();
1169 if (style->appearance() == MenulistButtonPart) { 1201 if (style->appearance() == MenulistButtonPart) {
1170 float fontScale = style->fontSize() / baseFontSize; 1202 float fontScale = style->fontSize() / baseFontSize;
1171 float arrowWidth = baseArrowWidth * fontScale; 1203 float arrowWidth = baseArrowWidth * fontScale;
1172 return static_cast<int>(ceilf(arrowWidth + (arrowPaddingLeft + arrowPadd ingRight + paddingBeforeSeparator) * style->effectiveZoom())); 1204 return static_cast<int>(ceilf(arrowWidth + (arrowPaddingLeft + arrowPadd ingRight + paddingBeforeSeparator) * style->effectiveZoom()));
1173 } 1205 }
1174 return 0; 1206 return 0;
1175 } 1207 }
1176 1208
1177 int RenderThemeChromiumMac::popupInternalPaddingTop(RenderStyle* style) const 1209 int RenderThemeChromiumMac::popupInternalPaddingTop(RenderStyle* style) const
1178 { 1210 {
1179 if (style->appearance() == MenulistPart) 1211 if (style->appearance() == MenulistPart)
1180 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::TopMargin ] * style->effectiveZoom(); 1212 return popupButtonPadding(controlSizeForFont(style))[topPadding] * style ->effectiveZoom();
1181 if (style->appearance() == MenulistButtonPart) 1213 if (style->appearance() == MenulistButtonPart)
1182 return styledPopupPaddingTop * style->effectiveZoom(); 1214 return styledPopupPaddingTop * style->effectiveZoom();
1183 return 0; 1215 return 0;
1184 } 1216 }
1185 1217
1186 int RenderThemeChromiumMac::popupInternalPaddingBottom(RenderStyle* style) const 1218 int RenderThemeChromiumMac::popupInternalPaddingBottom(RenderStyle* style) const
1187 { 1219 {
1188 if (style->appearance() == MenulistPart) 1220 if (style->appearance() == MenulistPart)
1189 return popupButtonPadding(controlSizeForFont(style))[ThemeMac::BottomMar gin] * style->effectiveZoom(); 1221 return popupButtonPadding(controlSizeForFont(style))[bottomPadding] * st yle->effectiveZoom();
1190 if (style->appearance() == MenulistButtonPart) 1222 if (style->appearance() == MenulistButtonPart)
1191 return styledPopupPaddingBottom * style->effectiveZoom(); 1223 return styledPopupPaddingBottom * style->effectiveZoom();
1192 return 0; 1224 return 0;
1193 } 1225 }
1194 1226
1195 void RenderThemeChromiumMac::adjustMenuListButtonStyle(RenderStyle* style, Eleme nt*) const 1227 void RenderThemeChromiumMac::adjustMenuListButtonStyle(RenderStyle* style, Eleme nt*) const
1196 { 1228 {
1197 float fontScale = style->fontSize() / baseFontSize; 1229 float fontScale = style->fontSize() / baseFontSize;
1198 1230
1199 style->resetPadding(); 1231 style->resetPadding();
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 Path borderPath; 1418 Path borderPath;
1387 borderPath.addEllipse(borderBounds); 1419 borderPath.addEllipse(borderBounds);
1388 paintInfo.context->drawFocusRing(borderPath, 5, -2, focusRingColor()); 1420 paintInfo.context->drawFocusRing(borderPath, 5, -2, focusRingColor());
1389 } 1421 }
1390 1422
1391 return false; 1423 return false;
1392 } 1424 }
1393 1425
1394 bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) 1426 bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r)
1395 { 1427 {
1396 LocalCurrentGraphicsContext localContext(paintInfo.context, r); 1428 LocalCurrentGraphicsContext localContext(paintInfo.context);
1397 1429
1398 NSSearchFieldCell* search = this->search(); 1430 NSSearchFieldCell* search = this->search();
1399 setSearchCellState(o, r); 1431 setSearchCellState(o, r);
1400 [search setControlSize:searchFieldControlSizeForFont(o->style())]; 1432 [search setControlSize:searchFieldControlSizeForFont(o->style())];
1401 1433
1402 GraphicsContextStateSaver stateSaver(*paintInfo.context); 1434 GraphicsContextStateSaver stateSaver(*paintInfo.context);
1403 1435
1404 float zoomLevel = o->style()->effectiveZoom(); 1436 float zoomLevel = o->style()->effectiveZoom();
1405 1437
1406 IntRect unzoomedRect = r; 1438 IntRect unzoomedRect = r;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1605 float zoomLevel = o->style()->effectiveZoom(); 1637 float zoomLevel = o->style()->effectiveZoom();
1606 FloatRect unzoomedRect(r); 1638 FloatRect unzoomedRect(r);
1607 if (zoomLevel != 1) { 1639 if (zoomLevel != 1) {
1608 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); 1640 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel);
1609 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); 1641 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel);
1610 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); 1642 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y());
1611 paintInfo.context->scale(zoomLevel, zoomLevel); 1643 paintInfo.context->scale(zoomLevel, zoomLevel);
1612 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); 1644 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y());
1613 } 1645 }
1614 1646
1615 LocalCurrentGraphicsContext localContext(paintInfo.context, r); 1647 LocalCurrentGraphicsContext localContext(paintInfo.context);
1616 1648
1617 NSSearchFieldCell* search = this->search(); 1649 NSSearchFieldCell* search = this->search();
1618 setSearchCellState(input->renderer(), r); 1650 setSearchCellState(input->renderer(), r);
1619 [search setControlSize:searchFieldControlSizeForFont(o->style())]; 1651 [search setControlSize:searchFieldControlSizeForFont(o->style())];
1620 if ([search searchMenuTemplate] != nil) 1652 if ([search searchMenuTemplate] != nil)
1621 [search setSearchMenuTemplate:nil]; 1653 [search setSearchMenuTemplate:nil];
1622 1654
1623 updateActiveState([search searchButtonCell], o); 1655 updateActiveState([search searchButtonCell], o);
1624 1656
1625 [[search searchButtonCell] drawWithFrame:unzoomedRect inView:documentViewFor (o)]; 1657 [[search searchButtonCell] drawWithFrame:unzoomedRect inView:documentViewFor (o)];
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 1887
1856 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const 1888 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const
1857 { 1889 {
1858 ControlPart part = style->appearance(); 1890 ControlPart part = style->appearance();
1859 if (part == CheckboxPart || part == RadioPart) 1891 if (part == CheckboxPart || part == RadioPart)
1860 return style->effectiveZoom() != 1; 1892 return style->effectiveZoom() != 1;
1861 return false; 1893 return false;
1862 } 1894 }
1863 1895
1864 } // namespace blink 1896 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderThemeChromiumMac.h ('k') | Source/platform/mac/LocalCurrentGraphicsContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698