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