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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 float zoomLevel = style->effectiveZoom(); | 743 float zoomLevel = style->effectiveZoom(); |
744 if (zoomLevel != 1) | 744 if (zoomLevel != 1) |
745 fontSize /= zoomLevel; | 745 fontSize /= zoomLevel; |
746 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) | 746 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) |
747 return NSRegularControlSize; | 747 return NSRegularControlSize; |
748 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) | 748 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) |
749 return NSSmallControlSize; | 749 return NSSmallControlSize; |
750 return NSMiniControlSize; | 750 return NSMiniControlSize; |
751 } | 751 } |
752 | 752 |
753 bool RenderThemeChromiumMac::paintTextField(RenderObject* o, const PaintInfo& pa
intInfo, const IntRect& r) | 753 bool RenderThemeChromiumMac::paintTextField(RenderObject* o, PaintInfo& paintInf
o, const IntRect& r) |
754 { | 754 { |
755 LocalCurrentGraphicsContext localContext(paintInfo.context); | 755 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
756 | 756 |
757 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 | 757 #if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 |
758 bool useNSTextFieldCell = o->style()->hasAppearance() | 758 bool useNSTextFieldCell = o->style()->hasAppearance() |
759 && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Colo
r::white | 759 && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Colo
r::white |
760 && !o->style()->hasBackgroundImage(); | 760 && !o->style()->hasBackgroundImage(); |
761 | 761 |
762 // We do not use NSTextFieldCell to draw styled text fields on Lion and Snow
Leopard because | 762 // We do not use NSTextFieldCell to draw styled text fields on Lion and Snow
Leopard because |
763 // there are a number of bugs on those platforms that require NSTextFieldCel
l to be in charge | 763 // there are a number of bugs on those platforms that require NSTextFieldCel
l to be in charge |
764 // of painting its own background. We need WebCore to paint styled backgroun
ds, so we'll use | 764 // of painting its own background. We need WebCore to paint styled backgroun
ds, so we'll use |
765 // this AppKit SPI function instead. | 765 // this AppKit SPI function instead. |
766 if (!useNSTextFieldCell) { | 766 if (!useNSTextFieldCell) { |
767 _NSDrawCarbonThemeBezel(r, isEnabled(o) && !isReadOnlyControl(o), YES); | 767 _NSDrawCarbonThemeBezel(r, isEnabled(o) && !isReadOnlyControl(o), YES); |
768 return false; | 768 return false; |
769 } | 769 } |
770 #endif | 770 #endif |
771 | 771 |
772 NSTextFieldCell *textField = this->textField(); | 772 NSTextFieldCell *textField = this->textField(); |
773 | 773 |
774 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 774 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
775 | 775 |
776 [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))]; | 776 [textField setEnabled:(isEnabled(o) && !isReadOnlyControl(o))]; |
777 [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)]; | 777 [textField drawWithFrame:NSRect(r) inView:documentViewFor(o)]; |
778 | 778 |
779 [textField setControlView:nil]; | 779 [textField setControlView:nil]; |
780 | 780 |
781 return false; | 781 return false; |
782 } | 782 } |
783 | 783 |
784 void RenderThemeChromiumMac::adjustTextFieldStyle(RenderStyle*, Element*) const | 784 void RenderThemeChromiumMac::adjustTextFieldStyle(RenderStyle*, Element*) const |
785 { | 785 { |
786 } | 786 } |
787 | 787 |
788 bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const PaintIn
fo& paintInfo, const IntRect& r) | 788 bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, PaintInfo& pa
intInfo, const IntRect& r) |
789 { | 789 { |
790 if (paintInfo.context->paintingDisabled()) | 790 if (paintInfo.getContext()->paintingDisabled()) |
791 return true; | 791 return true; |
792 | 792 |
793 // This draws the caps lock indicator as it was done by WKDrawCapsLockIndica
tor. | 793 // This draws the caps lock indicator as it was done by WKDrawCapsLockIndica
tor. |
794 LocalCurrentGraphicsContext localContext(paintInfo.context); | 794 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
795 CGContextRef c = localContext.cgContext(); | 795 CGContextRef c = localContext.cgContext(); |
796 CGMutablePathRef shape = CGPathCreateMutable(); | 796 CGMutablePathRef shape = CGPathCreateMutable(); |
797 | 797 |
798 // To draw the caps lock indicator, draw the shape into a small | 798 // To draw the caps lock indicator, draw the shape into a small |
799 // square that is then scaled to the size of r. | 799 // square that is then scaled to the size of r. |
800 const CGFloat kSquareSize = 17; | 800 const CGFloat kSquareSize = 17; |
801 | 801 |
802 // Create a rounted square shape. | 802 // Create a rounted square shape. |
803 CGPathMoveToPoint(shape, NULL, 16.5, 4.5); | 803 CGPathMoveToPoint(shape, NULL, 16.5, 4.5); |
804 CGPathAddArc(shape, NULL, 12.5, 12.5, 4, 0, M_PI_2, false); | 804 CGPathAddArc(shape, NULL, 12.5, 12.5, 4, 0, M_PI_2, false); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 | 840 |
841 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); | 841 CGContextSetRGBFillColor(c, 0, 0, 0, 0.4); |
842 CGContextBeginPath(c); | 842 CGContextBeginPath(c); |
843 CGContextAddPath(c, paintPath); | 843 CGContextAddPath(c, paintPath); |
844 CGContextFillPath(c); | 844 CGContextFillPath(c); |
845 CGPathRelease(paintPath); | 845 CGPathRelease(paintPath); |
846 | 846 |
847 return false; | 847 return false; |
848 } | 848 } |
849 | 849 |
850 bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, const PaintInfo& pai
ntInfo, const IntRect& r) | 850 bool RenderThemeChromiumMac::paintTextArea(RenderObject* o, PaintInfo& paintInfo
, const IntRect& r) |
851 { | 851 { |
852 LocalCurrentGraphicsContext localContext(paintInfo.context); | 852 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
853 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES
); | 853 _NSDrawCarbonThemeListBox(r, isEnabled(o) && !isReadOnlyControl(o), YES, YES
); |
854 return false; | 854 return false; |
855 } | 855 } |
856 | 856 |
857 void RenderThemeChromiumMac::adjustTextAreaStyle(RenderStyle*, Element*) const | 857 void RenderThemeChromiumMac::adjustTextAreaStyle(RenderStyle*, Element*) const |
858 { | 858 { |
859 } | 859 } |
860 | 860 |
861 const int* RenderThemeChromiumMac::popupButtonMargins() const | 861 const int* RenderThemeChromiumMac::popupButtonMargins() const |
862 { | 862 { |
(...skipping 16 matching lines...) Expand all Loading... |
879 { | 879 { |
880 static const int padding[3][4] = | 880 static const int padding[3][4] = |
881 { | 881 { |
882 { 2, 26, 3, 8 }, | 882 { 2, 26, 3, 8 }, |
883 { 2, 23, 3, 8 }, | 883 { 2, 23, 3, 8 }, |
884 { 2, 22, 3, 10 } | 884 { 2, 22, 3, 10 } |
885 }; | 885 }; |
886 return padding[size]; | 886 return padding[size]; |
887 } | 887 } |
888 | 888 |
889 bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const PaintInfo& pai
ntInfo, const IntRect& r) | 889 bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, PaintInfo& paintInfo
, const IntRect& r) |
890 { | 890 { |
891 LocalCurrentGraphicsContext localContext(paintInfo.context); | 891 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
892 setPopupButtonCellState(o, r); | 892 setPopupButtonCellState(o, r); |
893 | 893 |
894 NSPopUpButtonCell* popupButton = this->popupButton(); | 894 NSPopUpButtonCell* popupButton = this->popupButton(); |
895 | 895 |
896 float zoomLevel = o->style()->effectiveZoom(); | 896 float zoomLevel = o->style()->effectiveZoom(); |
897 IntSize size = popupButtonSizes()[[popupButton controlSize]]; | 897 IntSize size = popupButtonSizes()[[popupButton controlSize]]; |
898 size.setHeight(size.height() * zoomLevel); | 898 size.setHeight(size.height() * zoomLevel); |
899 size.setWidth(r.width()); | 899 size.setWidth(r.width()); |
900 | 900 |
901 // Now inflate it to account for the shadow. | 901 // Now inflate it to account for the shadow. |
902 IntRect inflatedRect = r; | 902 IntRect inflatedRect = r; |
903 if (r.width() >= minimumMenuListSize(o->style())) | 903 if (r.width() >= minimumMenuListSize(o->style())) |
904 inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoo
mLevel); | 904 inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoo
mLevel); |
905 | 905 |
906 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 906 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
907 | 907 |
908 // On Leopard, the cell will draw outside of the given rect, so we have to c
lip to the rect | 908 // On Leopard, the cell will draw outside of the given rect, so we have to c
lip to the rect |
909 paintInfo.context->clip(inflatedRect); | 909 paintInfo.getContext()->clip(inflatedRect); |
910 | 910 |
911 if (zoomLevel != 1.0f) { | 911 if (zoomLevel != 1.0f) { |
912 inflatedRect.setWidth(inflatedRect.width() / zoomLevel); | 912 inflatedRect.setWidth(inflatedRect.width() / zoomLevel); |
913 inflatedRect.setHeight(inflatedRect.height() / zoomLevel); | 913 inflatedRect.setHeight(inflatedRect.height() / zoomLevel); |
914 paintInfo.context->translate(inflatedRect.x(), inflatedRect.y()); | 914 paintInfo.getContext()->translate(inflatedRect.x(), inflatedRect.y()); |
915 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); | 915 paintInfo.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
916 paintInfo.context->translate(-inflatedRect.x(), -inflatedRect.y()); | 916 paintInfo.getContext()->translate(-inflatedRect.x(), -inflatedRect.y()); |
917 } | 917 } |
918 | 918 |
919 NSView *view = documentViewFor(o); | 919 NSView *view = documentViewFor(o); |
920 [popupButton drawWithFrame:inflatedRect inView:view]; | 920 [popupButton drawWithFrame:inflatedRect inView:view]; |
921 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING | 921 #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING |
922 if (isFocused(o) && o->style()->outlineStyleIsAuto()) | 922 if (isFocused(o) && o->style()->outlineStyleIsAuto()) |
923 [popupButton _web_drawFocusRingWithFrame:inflatedRect inView:view]; | 923 [popupButton _web_drawFocusRingWithFrame:inflatedRect inView:view]; |
924 #endif | 924 #endif |
925 [popupButton setControlView:nil]; | 925 [popupButton setControlView:nil]; |
926 | 926 |
927 return false; | 927 return false; |
928 } | 928 } |
929 | 929 |
930 IntSize RenderThemeChromiumMac::meterSizeForBounds(const RenderMeter* renderMete
r, const IntRect& bounds) const | 930 IntSize RenderThemeChromiumMac::meterSizeForBounds(const RenderMeter* renderMete
r, const IntRect& bounds) const |
931 { | 931 { |
932 if (NoControlPart == renderMeter->style()->appearance()) | 932 if (NoControlPart == renderMeter->style()->appearance()) |
933 return bounds.size(); | 933 return bounds.size(); |
934 | 934 |
935 NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); | 935 NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); |
936 // Makes enough room for cell's intrinsic size. | 936 // Makes enough room for cell's intrinsic size. |
937 NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())
]; | 937 NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())
]; |
938 return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.wid
th(), | 938 return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.wid
th(), |
939 bounds.height() < cellSize.height ? cellSize.height : bounds.
height()); | 939 bounds.height() < cellSize.height ? cellSize.height : bounds.
height()); |
940 } | 940 } |
941 | 941 |
942 bool RenderThemeChromiumMac::paintMeter(RenderObject* renderObject, const PaintI
nfo& paintInfo, const IntRect& rect) | 942 bool RenderThemeChromiumMac::paintMeter(RenderObject* renderObject, PaintInfo& p
aintInfo, const IntRect& rect) |
943 { | 943 { |
944 if (!renderObject->isMeter()) | 944 if (!renderObject->isMeter()) |
945 return true; | 945 return true; |
946 | 946 |
947 LocalCurrentGraphicsContext localContext(paintInfo.context); | 947 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
948 | 948 |
949 NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(renderObject)); | 949 NSLevelIndicatorCell* cell = levelIndicatorFor(toRenderMeter(renderObject)); |
950 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 950 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
951 | 951 |
952 [cell drawWithFrame:rect inView:documentViewFor(renderObject)]; | 952 [cell drawWithFrame:rect inView:documentViewFor(renderObject)]; |
953 [cell setControlView:nil]; | 953 [cell setControlView:nil]; |
954 return false; | 954 return false; |
955 } | 955 } |
956 | 956 |
957 bool RenderThemeChromiumMac::supportsMeter(ControlPart part) const | 957 bool RenderThemeChromiumMac::supportsMeter(ControlPart part) const |
958 { | 958 { |
959 switch (part) { | 959 switch (part) { |
960 case RelevancyLevelIndicatorPart: | 960 case RelevancyLevelIndicatorPart: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 | 1056 |
1057 double RenderThemeChromiumMac::animationDurationForProgressBar(RenderProgress*)
const | 1057 double RenderThemeChromiumMac::animationDurationForProgressBar(RenderProgress*)
const |
1058 { | 1058 { |
1059 return progressAnimationNumFrames * progressAnimationFrameRate; | 1059 return progressAnimationNumFrames * progressAnimationFrameRate; |
1060 } | 1060 } |
1061 | 1061 |
1062 void RenderThemeChromiumMac::adjustProgressBarStyle(RenderStyle*, Element*) cons
t | 1062 void RenderThemeChromiumMac::adjustProgressBarStyle(RenderStyle*, Element*) cons
t |
1063 { | 1063 { |
1064 } | 1064 } |
1065 | 1065 |
1066 bool RenderThemeChromiumMac::paintProgressBar(RenderObject* renderObject, const
PaintInfo& paintInfo, const IntRect& rect) | 1066 bool RenderThemeChromiumMac::paintProgressBar(RenderObject* renderObject, PaintI
nfo& paintInfo, const IntRect& rect) |
1067 { | 1067 { |
1068 if (!renderObject->isProgress()) | 1068 if (!renderObject->isProgress()) |
1069 return true; | 1069 return true; |
1070 | 1070 |
1071 float zoomLevel = renderObject->style()->effectiveZoom(); | 1071 float zoomLevel = renderObject->style()->effectiveZoom(); |
1072 int controlSize = controlSizeForFont(renderObject->style()); | 1072 int controlSize = controlSizeForFont(renderObject->style()); |
1073 IntSize size = progressBarSizes()[controlSize]; | 1073 IntSize size = progressBarSizes()[controlSize]; |
1074 size.setHeight(size.height() * zoomLevel); | 1074 size.setHeight(size.height() * zoomLevel); |
1075 size.setWidth(rect.width()); | 1075 size.setWidth(rect.width()); |
1076 | 1076 |
(...skipping 21 matching lines...) Expand all Loading... |
1098 trackInfo.filler1 = 0; | 1098 trackInfo.filler1 = 0; |
1099 | 1099 |
1100 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size(), 1
); | 1100 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size(), 1
); |
1101 if (!imageBuffer) | 1101 if (!imageBuffer) |
1102 return true; | 1102 return true; |
1103 | 1103 |
1104 ContextContainer cgContextContainer(imageBuffer->context()); | 1104 ContextContainer cgContextContainer(imageBuffer->context()); |
1105 CGContextRef cgContext = cgContextContainer.context(); | 1105 CGContextRef cgContext = cgContextContainer.context(); |
1106 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); | 1106 HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal); |
1107 | 1107 |
1108 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1108 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1109 | 1109 |
1110 if (!renderProgress->style()->isLeftToRightDirection()) { | 1110 if (!renderProgress->style()->isLeftToRightDirection()) { |
1111 paintInfo.context->translate(2 * inflatedRect.x() + inflatedRect.width()
, 0); | 1111 paintInfo.getContext()->translate(2 * inflatedRect.x() + inflatedRect.wi
dth(), 0); |
1112 paintInfo.context->scale(FloatSize(-1, 1)); | 1112 paintInfo.getContext()->scale(FloatSize(-1, 1)); |
1113 } | 1113 } |
1114 | 1114 |
1115 paintInfo.context->drawImageBuffer(imageBuffer.get(), inflatedRect.location(
)); | 1115 paintInfo.getContext()->drawImageBuffer(imageBuffer.get(), inflatedRect.loca
tion()); |
1116 return false; | 1116 return false; |
1117 } | 1117 } |
1118 | 1118 |
1119 const float baseFontSize = 11.0f; | 1119 const float baseFontSize = 11.0f; |
1120 const float baseArrowHeight = 4.0f; | 1120 const float baseArrowHeight = 4.0f; |
1121 const float baseArrowWidth = 5.0f; | 1121 const float baseArrowWidth = 5.0f; |
1122 const float baseSpaceBetweenArrows = 2.0f; | 1122 const float baseSpaceBetweenArrows = 2.0f; |
1123 const int arrowPaddingLeft = 6; | 1123 const int arrowPaddingLeft = 6; |
1124 const int arrowPaddingRight = 6; | 1124 const int arrowPaddingRight = 6; |
1125 const int paddingBeforeSeparator = 4; | 1125 const int paddingBeforeSeparator = 4; |
(...skipping 25 matching lines...) Expand all Loading... |
1151 static void MainGradientInterpolate(void*, const CGFloat* inData, CGFloat* outDa
ta) | 1151 static void MainGradientInterpolate(void*, const CGFloat* inData, CGFloat* outDa
ta) |
1152 { | 1152 { |
1153 static float dark[4] = { 0.0f, 0.0f, 0.0f, 0.15f }; | 1153 static float dark[4] = { 0.0f, 0.0f, 0.0f, 0.15f }; |
1154 static float light[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; | 1154 static float light[4] = { 0.0f, 0.0f, 0.0f, 0.0f }; |
1155 float a = inData[0]; | 1155 float a = inData[0]; |
1156 int i = 0; | 1156 int i = 0; |
1157 for (i = 0; i < 4; i++) | 1157 for (i = 0; i < 4; i++) |
1158 outData[i] = (1.0f - a) * dark[i] + a * light[i]; | 1158 outData[i] = (1.0f - a) * dark[i] + a * light[i]; |
1159 } | 1159 } |
1160 | 1160 |
1161 void RenderThemeChromiumMac::paintMenuListButtonGradients(RenderObject* o, const
PaintInfo& paintInfo, const IntRect& r) | 1161 void RenderThemeChromiumMac::paintMenuListButtonGradients(RenderObject* o, Paint
Info& paintInfo, const IntRect& r) |
1162 { | 1162 { |
1163 if (r.isEmpty()) | 1163 if (r.isEmpty()) |
1164 return; | 1164 return; |
1165 | 1165 |
1166 ContextContainer cgContextContainer(paintInfo.context); | 1166 ContextContainer cgContextContainer(paintInfo.getContext()); |
1167 CGContextRef context = cgContextContainer.context(); | 1167 CGContextRef context = cgContextContainer.context(); |
1168 | 1168 |
1169 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1169 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1170 | 1170 |
1171 RoundedRect border = o->style()->getRoundedBorderFor(r, o->view()); | 1171 RoundedRect border = o->style()->getRoundedBorderFor(r, o->view()); |
1172 int radius = border.radii().topLeft().width(); | 1172 int radius = border.radii().topLeft().width(); |
1173 | 1173 |
1174 CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); | 1174 CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); |
1175 | 1175 |
1176 FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f); | 1176 FloatRect topGradient(r.x(), r.y(), r.width(), r.height() / 2.0f); |
1177 struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL
}; | 1177 struct CGFunctionCallbacks topCallbacks = { 0, TopGradientInterpolate, NULL
}; |
1178 RetainPtr<CGFunctionRef> topFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL
, 4, NULL, &topCallbacks)); | 1178 RetainPtr<CGFunctionRef> topFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL
, 4, NULL, &topCallbacks)); |
1179 RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace, CGP
ointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGrad
ient.maxY()), topFunction.get(), false, false)); | 1179 RetainPtr<CGShadingRef> topShading(AdoptCF, CGShadingCreateAxial(cspace, CGP
ointMake(topGradient.x(), topGradient.y()), CGPointMake(topGradient.x(), topGrad
ient.maxY()), topFunction.get(), false, false)); |
1180 | 1180 |
1181 FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width(
) - 2.0f * radius, r.height() / 2.0f); | 1181 FloatRect bottomGradient(r.x() + radius, r.y() + r.height() / 2.0f, r.width(
) - 2.0f * radius, r.height() / 2.0f); |
1182 struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate,
NULL }; | 1182 struct CGFunctionCallbacks bottomCallbacks = { 0, BottomGradientInterpolate,
NULL }; |
1183 RetainPtr<CGFunctionRef> bottomFunction(AdoptCF, CGFunctionCreate(NULL, 1, N
ULL, 4, NULL, &bottomCallbacks)); | 1183 RetainPtr<CGFunctionRef> bottomFunction(AdoptCF, CGFunctionCreate(NULL, 1, N
ULL, 4, NULL, &bottomCallbacks)); |
1184 RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace,
CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient
.x(), bottomGradient.maxY()), bottomFunction.get(), false, false)); | 1184 RetainPtr<CGShadingRef> bottomShading(AdoptCF, CGShadingCreateAxial(cspace,
CGPointMake(bottomGradient.x(), bottomGradient.y()), CGPointMake(bottomGradient
.x(), bottomGradient.maxY()), bottomFunction.get(), false, false)); |
1185 | 1185 |
1186 struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NUL
L }; | 1186 struct CGFunctionCallbacks mainCallbacks = { 0, MainGradientInterpolate, NUL
L }; |
1187 RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NUL
L, 4, NULL, &mainCallbacks)); | 1187 RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NUL
L, 4, NULL, &mainCallbacks)); |
1188 RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace, CG
PointMake(r.x(), r.y()), CGPointMake(r.x(), r.maxY()), mainFunction.get(), fals
e, false)); | 1188 RetainPtr<CGShadingRef> mainShading(AdoptCF, CGShadingCreateAxial(cspace, CG
PointMake(r.x(), r.y()), CGPointMake(r.x(), r.maxY()), mainFunction.get(), fals
e, false)); |
1189 | 1189 |
1190 RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace, CG
PointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get()
, false, false)); | 1190 RetainPtr<CGShadingRef> leftShading(AdoptCF, CGShadingCreateAxial(cspace, CG
PointMake(r.x(), r.y()), CGPointMake(r.x() + radius, r.y()), mainFunction.get()
, false, false)); |
1191 | 1191 |
1192 RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, C
GPointMake(r.maxX(), r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunctio
n.get(), false, false)); | 1192 RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, C
GPointMake(r.maxX(), r.y()), CGPointMake(r.maxX() - radius, r.y()), mainFunctio
n.get(), false, false)); |
1193 | 1193 |
1194 { | 1194 { |
1195 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1195 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1196 CGContextClipToRect(context, r); | 1196 CGContextClipToRect(context, r); |
1197 paintInfo.context->clipRoundedRect(border); | 1197 paintInfo.getContext()->clipRoundedRect(border); |
1198 context = cgContextContainer.context(); | 1198 context = cgContextContainer.context(); |
1199 CGContextDrawShading(context, mainShading.get()); | 1199 CGContextDrawShading(context, mainShading.get()); |
1200 } | 1200 } |
1201 | 1201 |
1202 { | 1202 { |
1203 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1203 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1204 CGContextClipToRect(context, topGradient); | 1204 CGContextClipToRect(context, topGradient); |
1205 paintInfo.context->clipRoundedRect(RoundedRect(enclosingIntRect(topGradi
ent), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize())
); | 1205 paintInfo.getContext()->clipRoundedRect(RoundedRect(enclosingIntRect(top
Gradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSi
ze())); |
1206 context = cgContextContainer.context(); | 1206 context = cgContextContainer.context(); |
1207 CGContextDrawShading(context, topShading.get()); | 1207 CGContextDrawShading(context, topShading.get()); |
1208 } | 1208 } |
1209 | 1209 |
1210 if (!bottomGradient.isEmpty()) { | 1210 if (!bottomGradient.isEmpty()) { |
1211 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1211 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1212 CGContextClipToRect(context, bottomGradient); | 1212 CGContextClipToRect(context, bottomGradient); |
1213 paintInfo.context->clipRoundedRect(RoundedRect(enclosingIntRect(bottomGr
adient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().botto
mRight())); | 1213 paintInfo.getContext()->clipRoundedRect(RoundedRect(enclosingIntRect(bot
tomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().
bottomRight())); |
1214 context = cgContextContainer.context(); | 1214 context = cgContextContainer.context(); |
1215 CGContextDrawShading(context, bottomShading.get()); | 1215 CGContextDrawShading(context, bottomShading.get()); |
1216 } | 1216 } |
1217 | 1217 |
1218 { | 1218 { |
1219 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1219 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1220 CGContextClipToRect(context, r); | 1220 CGContextClipToRect(context, r); |
1221 paintInfo.context->clipRoundedRect(border); | 1221 paintInfo.getContext()->clipRoundedRect(border); |
1222 context = cgContextContainer.context(); | 1222 context = cgContextContainer.context(); |
1223 CGContextDrawShading(context, leftShading.get()); | 1223 CGContextDrawShading(context, leftShading.get()); |
1224 CGContextDrawShading(context, rightShading.get()); | 1224 CGContextDrawShading(context, rightShading.get()); |
1225 } | 1225 } |
1226 } | 1226 } |
1227 | 1227 |
1228 bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const PaintInf
o& paintInfo, const IntRect& r) | 1228 bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, PaintInfo& pai
ntInfo, const IntRect& r) |
1229 { | 1229 { |
1230 IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), | 1230 IntRect bounds = IntRect(r.x() + o->style()->borderLeftWidth(), |
1231 r.y() + o->style()->borderTopWidth(), | 1231 r.y() + o->style()->borderTopWidth(), |
1232 r.width() - o->style()->borderLeftWidth() - o->styl
e()->borderRightWidth(), | 1232 r.width() - o->style()->borderLeftWidth() - o->styl
e()->borderRightWidth(), |
1233 r.height() - o->style()->borderTopWidth() - o->styl
e()->borderBottomWidth()); | 1233 r.height() - o->style()->borderTopWidth() - o->styl
e()->borderBottomWidth()); |
1234 // Draw the gradients to give the styled popup menu a button appearance | 1234 // Draw the gradients to give the styled popup menu a button appearance |
1235 paintMenuListButtonGradients(o, paintInfo, bounds); | 1235 paintMenuListButtonGradients(o, paintInfo, bounds); |
1236 | 1236 |
1237 // Since we actually know the size of the control here, we restrict the font
scale to make sure the arrows will fit vertically in the bounds | 1237 // Since we actually know the size of the control here, we restrict the font
scale to make sure the arrows will fit vertically in the bounds |
1238 float fontScale = min(o->style()->fontSize() / baseFontSize, bounds.height()
/ (baseArrowHeight * 2 + baseSpaceBetweenArrows)); | 1238 float fontScale = min(o->style()->fontSize() / baseFontSize, bounds.height()
/ (baseArrowHeight * 2 + baseSpaceBetweenArrows)); |
1239 float centerY = bounds.y() + bounds.height() / 2.0f; | 1239 float centerY = bounds.y() + bounds.height() / 2.0f; |
1240 float arrowHeight = baseArrowHeight * fontScale; | 1240 float arrowHeight = baseArrowHeight * fontScale; |
1241 float arrowWidth = baseArrowWidth * fontScale; | 1241 float arrowWidth = baseArrowWidth * fontScale; |
1242 float leftEdge = bounds.maxX() - arrowPaddingRight * o->style()->effectiveZo
om() - arrowWidth; | 1242 float leftEdge = bounds.maxX() - arrowPaddingRight * o->style()->effectiveZo
om() - arrowWidth; |
1243 float spaceBetweenArrows = baseSpaceBetweenArrows * fontScale; | 1243 float spaceBetweenArrows = baseSpaceBetweenArrows * fontScale; |
1244 | 1244 |
1245 if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZo
om()) | 1245 if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZo
om()) |
1246 return false; | 1246 return false; |
1247 | 1247 |
1248 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1248 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1249 | 1249 |
1250 paintInfo.context->setFillColor(o->resolveColor(CSSPropertyColor)); | 1250 paintInfo.getContext()->setFillColor(o->resolveColor(CSSPropertyColor)); |
1251 paintInfo.context->setStrokeStyle(NoStroke); | 1251 paintInfo.getContext()->setStrokeStyle(NoStroke); |
1252 | 1252 |
1253 FloatPoint arrow1[3]; | 1253 FloatPoint arrow1[3]; |
1254 arrow1[0] = FloatPoint(leftEdge, centerY - spaceBetweenArrows / 2.0f); | 1254 arrow1[0] = FloatPoint(leftEdge, centerY - spaceBetweenArrows / 2.0f); |
1255 arrow1[1] = FloatPoint(leftEdge + arrowWidth, centerY - spaceBetweenArrows /
2.0f); | 1255 arrow1[1] = FloatPoint(leftEdge + arrowWidth, centerY - spaceBetweenArrows /
2.0f); |
1256 arrow1[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY - spaceBetweenA
rrows / 2.0f - arrowHeight); | 1256 arrow1[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY - spaceBetweenA
rrows / 2.0f - arrowHeight); |
1257 | 1257 |
1258 // Draw the top arrow | 1258 // Draw the top arrow |
1259 paintInfo.context->drawConvexPolygon(3, arrow1, true); | 1259 paintInfo.getContext()->drawConvexPolygon(3, arrow1, true); |
1260 | 1260 |
1261 FloatPoint arrow2[3]; | 1261 FloatPoint arrow2[3]; |
1262 arrow2[0] = FloatPoint(leftEdge, centerY + spaceBetweenArrows / 2.0f); | 1262 arrow2[0] = FloatPoint(leftEdge, centerY + spaceBetweenArrows / 2.0f); |
1263 arrow2[1] = FloatPoint(leftEdge + arrowWidth, centerY + spaceBetweenArrows /
2.0f); | 1263 arrow2[1] = FloatPoint(leftEdge + arrowWidth, centerY + spaceBetweenArrows /
2.0f); |
1264 arrow2[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY + spaceBetweenA
rrows / 2.0f + arrowHeight); | 1264 arrow2[2] = FloatPoint(leftEdge + arrowWidth / 2.0f, centerY + spaceBetweenA
rrows / 2.0f + arrowHeight); |
1265 | 1265 |
1266 // Draw the bottom arrow | 1266 // Draw the bottom arrow |
1267 paintInfo.context->drawConvexPolygon(3, arrow2, true); | 1267 paintInfo.getContext()->drawConvexPolygon(3, arrow2, true); |
1268 | 1268 |
1269 Color leftSeparatorColor(0, 0, 0, 40); | 1269 Color leftSeparatorColor(0, 0, 0, 40); |
1270 Color rightSeparatorColor(255, 255, 255, 40); | 1270 Color rightSeparatorColor(255, 255, 255, 40); |
1271 | 1271 |
1272 // FIXME: Should the separator thickness and space be scaled up by fontScale
? | 1272 // FIXME: Should the separator thickness and space be scaled up by fontScale
? |
1273 int separatorSpace = 2; // Deliberately ignores zoom since it looks nicer if
it stays thin. | 1273 int separatorSpace = 2; // Deliberately ignores zoom since it looks nicer if
it stays thin. |
1274 int leftEdgeOfSeparator = static_cast<int>(leftEdge - arrowPaddingLeft * o->
style()->effectiveZoom()); // FIXME: Round? | 1274 int leftEdgeOfSeparator = static_cast<int>(leftEdge - arrowPaddingLeft * o->
style()->effectiveZoom()); // FIXME: Round? |
1275 | 1275 |
1276 // Draw the separator to the left of the arrows | 1276 // Draw the separator to the left of the arrows |
1277 paintInfo.context->setStrokeThickness(1.0f); // Deliberately ignores zoom si
nce it looks nicer if it stays thin. | 1277 paintInfo.getContext()->setStrokeThickness(1.0f); // Deliberately ignores zo
om since it looks nicer if it stays thin. |
1278 paintInfo.context->setStrokeStyle(SolidStroke); | 1278 paintInfo.getContext()->setStrokeStyle(SolidStroke); |
1279 paintInfo.context->setStrokeColor(leftSeparatorColor); | 1279 paintInfo.getContext()->setStrokeColor(leftSeparatorColor); |
1280 paintInfo.context->drawLine(IntPoint(leftEdgeOfSeparator, bounds.y()), | 1280 paintInfo.getContext()->drawLine(IntPoint(leftEdgeOfSeparator, bounds.y()), |
1281 IntPoint(leftEdgeOfSeparator, bounds.maxY())); | 1281 IntPoint(leftEdgeOfSeparator, bounds.maxY())); |
1282 | 1282 |
1283 paintInfo.context->setStrokeColor(rightSeparatorColor); | 1283 paintInfo.getContext()->setStrokeColor(rightSeparatorColor); |
1284 paintInfo.context->drawLine(IntPoint(leftEdgeOfSeparator + separatorSpace, b
ounds.y()), | 1284 paintInfo.getContext()->drawLine(IntPoint(leftEdgeOfSeparator + separatorSpa
ce, bounds.y()), |
1285 IntPoint(leftEdgeOfSeparator + separatorSpace, b
ounds.maxY())); | 1285 IntPoint(leftEdgeOfSeparator + separatorSpace, b
ounds.maxY())); |
1286 return false; | 1286 return false; |
1287 } | 1287 } |
1288 | 1288 |
1289 static const IntSize* menuListButtonSizes() | 1289 static const IntSize* menuListButtonSizes() |
1290 { | 1290 { |
1291 static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0,
15) }; | 1291 static const IntSize sizes[3] = { IntSize(0, 21), IntSize(0, 18), IntSize(0,
15) }; |
1292 return sizes; | 1292 return sizes; |
1293 } | 1293 } |
1294 | 1294 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 } | 1406 } |
1407 | 1407 |
1408 int RenderThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const | 1408 int RenderThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const |
1409 { | 1409 { |
1410 return sizeForSystemFont(style, menuListSizes()).width(); | 1410 return sizeForSystemFont(style, menuListSizes()).width(); |
1411 } | 1411 } |
1412 | 1412 |
1413 const int sliderTrackWidth = 5; | 1413 const int sliderTrackWidth = 5; |
1414 const int sliderTrackBorderWidth = 1; | 1414 const int sliderTrackBorderWidth = 1; |
1415 | 1415 |
1416 bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1416 bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, PaintInfo& paintI
nfo, const IntRect& r) |
1417 { | 1417 { |
1418 paintSliderTicks(o, paintInfo, r); | 1418 paintSliderTicks(o, paintInfo, r); |
1419 | 1419 |
1420 float zoomLevel = o->style()->effectiveZoom(); | 1420 float zoomLevel = o->style()->effectiveZoom(); |
1421 FloatRect unzoomedRect = r; | 1421 FloatRect unzoomedRect = r; |
1422 | 1422 |
1423 if (o->style()->appearance() == SliderHorizontalPart || o->style()->appeara
nce() == MediaSliderPart) { | 1423 if (o->style()->appearance() == SliderHorizontalPart || o->style()->appeara
nce() == MediaSliderPart) { |
1424 unzoomedRect.setY(ceilf(unzoomedRect.y() + unzoomedRect.height() / 2 - z
oomLevel * sliderTrackWidth / 2)); | 1424 unzoomedRect.setY(ceilf(unzoomedRect.y() + unzoomedRect.height() / 2 - z
oomLevel * sliderTrackWidth / 2)); |
1425 unzoomedRect.setHeight(zoomLevel * sliderTrackWidth); | 1425 unzoomedRect.setHeight(zoomLevel * sliderTrackWidth); |
1426 } else if (o->style()->appearance() == SliderVerticalPart) { | 1426 } else if (o->style()->appearance() == SliderVerticalPart) { |
1427 unzoomedRect.setX(ceilf(unzoomedRect.x() + unzoomedRect.width() / 2 - zo
omLevel * sliderTrackWidth / 2)); | 1427 unzoomedRect.setX(ceilf(unzoomedRect.x() + unzoomedRect.width() / 2 - zo
omLevel * sliderTrackWidth / 2)); |
1428 unzoomedRect.setWidth(zoomLevel * sliderTrackWidth); | 1428 unzoomedRect.setWidth(zoomLevel * sliderTrackWidth); |
1429 } | 1429 } |
1430 | 1430 |
1431 if (zoomLevel != 1) { | 1431 if (zoomLevel != 1) { |
1432 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 1432 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
1433 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 1433 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
1434 } | 1434 } |
1435 | 1435 |
1436 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1436 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1437 if (zoomLevel != 1) { | 1437 if (zoomLevel != 1) { |
1438 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1438 paintInfo.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
1439 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1439 paintInfo.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
1440 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1440 paintInfo.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
1441 } | 1441 } |
1442 | 1442 |
1443 Color fillColor(205, 205, 205); | 1443 Color fillColor(205, 205, 205); |
1444 Color borderGradientTopColor(109, 109, 109); | 1444 Color borderGradientTopColor(109, 109, 109); |
1445 Color borderGradientBottomColor(181, 181, 181); | 1445 Color borderGradientBottomColor(181, 181, 181); |
1446 Color shadowColor(0, 0, 0, 118); | 1446 Color shadowColor(0, 0, 0, 118); |
1447 | 1447 |
1448 if (!isEnabled(o)) { | 1448 if (!isEnabled(o)) { |
1449 Color tintColor(255, 255, 255, 128); | 1449 Color tintColor(255, 255, 255, 128); |
1450 fillColor = fillColor.blend(tintColor); | 1450 fillColor = fillColor.blend(tintColor); |
1451 borderGradientTopColor = borderGradientTopColor.blend(tintColor); | 1451 borderGradientTopColor = borderGradientTopColor.blend(tintColor); |
1452 borderGradientBottomColor = borderGradientBottomColor.blend(tintColor); | 1452 borderGradientBottomColor = borderGradientBottomColor.blend(tintColor); |
1453 shadowColor = shadowColor.blend(tintColor); | 1453 shadowColor = shadowColor.blend(tintColor); |
1454 } | 1454 } |
1455 | 1455 |
1456 Color tintColor; | 1456 Color tintColor; |
1457 if (!isEnabled(o)) | 1457 if (!isEnabled(o)) |
1458 tintColor = Color(255, 255, 255, 128); | 1458 tintColor = Color(255, 255, 255, 128); |
1459 | 1459 |
1460 bool isVerticalSlider = o->style()->appearance() == SliderVerticalPart; | 1460 bool isVerticalSlider = o->style()->appearance() == SliderVerticalPart; |
1461 | 1461 |
1462 int fillRadiusSize = (sliderTrackWidth - sliderTrackBorderWidth) / 2; | 1462 int fillRadiusSize = (sliderTrackWidth - sliderTrackBorderWidth) / 2; |
1463 IntSize fillRadius(fillRadiusSize, fillRadiusSize); | 1463 IntSize fillRadius(fillRadiusSize, fillRadiusSize); |
1464 IntRect fillBounds = enclosedIntRect(unzoomedRect); | 1464 IntRect fillBounds = enclosedIntRect(unzoomedRect); |
1465 RoundedRect fillRect(fillBounds, fillRadius, fillRadius, fillRadius, fillRad
ius); | 1465 RoundedRect fillRect(fillBounds, fillRadius, fillRadius, fillRadius, fillRad
ius); |
1466 paintInfo.context->fillRoundedRect(fillRect, fillColor); | 1466 paintInfo.getContext()->fillRoundedRect(fillRect, fillColor); |
1467 | 1467 |
1468 IntSize shadowOffset(isVerticalSlider ? 1 : 0, | 1468 IntSize shadowOffset(isVerticalSlider ? 1 : 0, |
1469 isVerticalSlider ? 0 : 1); | 1469 isVerticalSlider ? 0 : 1); |
1470 int shadowBlur = 3; | 1470 int shadowBlur = 3; |
1471 int shadowSpread = 0; | 1471 int shadowSpread = 0; |
1472 paintInfo.context->save(); | 1472 paintInfo.getContext()->save(); |
1473 paintInfo.context->drawInnerShadow(fillRect, shadowColor, shadowOffset, shad
owBlur, shadowSpread); | 1473 paintInfo.getContext()->drawInnerShadow(fillRect, shadowColor, shadowOffset,
shadowBlur, shadowSpread); |
1474 paintInfo.context->restore(); | 1474 paintInfo.getContext()->restore(); |
1475 | 1475 |
1476 RefPtr<Gradient> borderGradient = Gradient::create(fillBounds.minXMinYCorner
(), | 1476 RefPtr<Gradient> borderGradient = Gradient::create(fillBounds.minXMinYCorner
(), |
1477 isVerticalSlider ? fillBounds.maxXMinYCorner() : fillBounds.minXMaxYCorn
er()); | 1477 isVerticalSlider ? fillBounds.maxXMinYCorner() : fillBounds.minXMaxYCorn
er()); |
1478 borderGradient->addColorStop(0.0, borderGradientTopColor); | 1478 borderGradient->addColorStop(0.0, borderGradientTopColor); |
1479 borderGradient->addColorStop(1.0, borderGradientBottomColor); | 1479 borderGradient->addColorStop(1.0, borderGradientBottomColor); |
1480 Path borderPath; | 1480 Path borderPath; |
1481 FloatRect borderRect(unzoomedRect); | 1481 FloatRect borderRect(unzoomedRect); |
1482 borderRect.inflate(-sliderTrackBorderWidth / 2.0); | 1482 borderRect.inflate(-sliderTrackBorderWidth / 2.0); |
1483 float borderRadiusSize = (isVerticalSlider ? borderRect.width() : borderRect
.height()) / 2; | 1483 float borderRadiusSize = (isVerticalSlider ? borderRect.width() : borderRect
.height()) / 2; |
1484 FloatSize borderRadius(borderRadiusSize, borderRadiusSize); | 1484 FloatSize borderRadius(borderRadiusSize, borderRadiusSize); |
1485 borderPath.addRoundedRect(borderRect, borderRadius, borderRadius, borderRadi
us, borderRadius); | 1485 borderPath.addRoundedRect(borderRect, borderRadius, borderRadius, borderRadi
us, borderRadius); |
1486 paintInfo.context->setStrokeGradient(borderGradient); | 1486 paintInfo.getContext()->setStrokeGradient(borderGradient); |
1487 paintInfo.context->setStrokeThickness(sliderTrackBorderWidth); | 1487 paintInfo.getContext()->setStrokeThickness(sliderTrackBorderWidth); |
1488 paintInfo.context->strokePath(borderPath); | 1488 paintInfo.getContext()->strokePath(borderPath); |
1489 return false; | 1489 return false; |
1490 } | 1490 } |
1491 | 1491 |
1492 const int sliderThumbWidth = 15; | 1492 const int sliderThumbWidth = 15; |
1493 const int sliderThumbHeight = 15; | 1493 const int sliderThumbHeight = 15; |
1494 const int sliderThumbBorderWidth = 1; | 1494 const int sliderThumbBorderWidth = 1; |
1495 | 1495 |
1496 bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1496 bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, PaintInfo& paintI
nfo, const IntRect& r) |
1497 { | 1497 { |
1498 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1498 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1499 float zoomLevel = o->style()->effectiveZoom(); | 1499 float zoomLevel = o->style()->effectiveZoom(); |
1500 | 1500 |
1501 FloatRect unzoomedRect(r.x(), r.y(), sliderThumbWidth, sliderThumbHeight); | 1501 FloatRect unzoomedRect(r.x(), r.y(), sliderThumbWidth, sliderThumbHeight); |
1502 if (zoomLevel != 1.0f) { | 1502 if (zoomLevel != 1.0f) { |
1503 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1503 paintInfo.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
1504 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1504 paintInfo.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
1505 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1505 paintInfo.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
1506 } | 1506 } |
1507 | 1507 |
1508 Color fillGradientTopColor(250, 250, 250); | 1508 Color fillGradientTopColor(250, 250, 250); |
1509 Color fillGradientUpperMiddleColor(244, 244, 244); | 1509 Color fillGradientUpperMiddleColor(244, 244, 244); |
1510 Color fillGradientLowerMiddleColor(236, 236, 236); | 1510 Color fillGradientLowerMiddleColor(236, 236, 236); |
1511 Color fillGradientBottomColor(238, 238, 238); | 1511 Color fillGradientBottomColor(238, 238, 238); |
1512 Color borderGradientTopColor(151, 151, 151); | 1512 Color borderGradientTopColor(151, 151, 151); |
1513 Color borderGradientBottomColor(128, 128, 128); | 1513 Color borderGradientBottomColor(128, 128, 128); |
1514 Color shadowColor(0, 0, 0, 36); | 1514 Color shadowColor(0, 0, 0, 36); |
1515 | 1515 |
(...skipping 16 matching lines...) Expand all Loading... |
1532 borderGradientBottomColor = borderGradientBottomColor.blend(tintColor); | 1532 borderGradientBottomColor = borderGradientBottomColor.blend(tintColor); |
1533 shadowColor = shadowColor.blend(tintColor); | 1533 shadowColor = shadowColor.blend(tintColor); |
1534 } | 1534 } |
1535 | 1535 |
1536 FloatRect borderBounds = unzoomedRect; | 1536 FloatRect borderBounds = unzoomedRect; |
1537 borderBounds.inflate(sliderThumbBorderWidth / 2.0); | 1537 borderBounds.inflate(sliderThumbBorderWidth / 2.0); |
1538 | 1538 |
1539 FloatRect shadowBounds = unzoomedRect; | 1539 FloatRect shadowBounds = unzoomedRect; |
1540 borderBounds.inflate(-sliderThumbBorderWidth); | 1540 borderBounds.inflate(-sliderThumbBorderWidth); |
1541 FloatSize shadowOffset(0, 1); | 1541 FloatSize shadowOffset(0, 1); |
1542 paintInfo.context->setShadow(shadowOffset, sliderThumbShadowBlur, shadowColo
r); | 1542 paintInfo.getContext()->setShadow(shadowOffset, sliderThumbShadowBlur, shado
wColor); |
1543 paintInfo.context->setFillColor(Color::black); | 1543 paintInfo.getContext()->setFillColor(Color::black); |
1544 paintInfo.context->fillEllipse(borderBounds); | 1544 paintInfo.getContext()->fillEllipse(borderBounds); |
1545 paintInfo.context->clearShadow(); | 1545 paintInfo.getContext()->clearShadow(); |
1546 | 1546 |
1547 IntRect fillBounds = enclosedIntRect(unzoomedRect); | 1547 IntRect fillBounds = enclosedIntRect(unzoomedRect); |
1548 RefPtr<Gradient> fillGradient = Gradient::create(fillBounds.minXMinYCorner()
, fillBounds.minXMaxYCorner()); | 1548 RefPtr<Gradient> fillGradient = Gradient::create(fillBounds.minXMinYCorner()
, fillBounds.minXMaxYCorner()); |
1549 fillGradient->addColorStop(0.0, fillGradientTopColor); | 1549 fillGradient->addColorStop(0.0, fillGradientTopColor); |
1550 fillGradient->addColorStop(0.52, fillGradientUpperMiddleColor); | 1550 fillGradient->addColorStop(0.52, fillGradientUpperMiddleColor); |
1551 fillGradient->addColorStop(0.52, fillGradientLowerMiddleColor); | 1551 fillGradient->addColorStop(0.52, fillGradientLowerMiddleColor); |
1552 fillGradient->addColorStop(1.0, fillGradientBottomColor); | 1552 fillGradient->addColorStop(1.0, fillGradientBottomColor); |
1553 paintInfo.context->setFillGradient(fillGradient); | 1553 paintInfo.getContext()->setFillGradient(fillGradient); |
1554 paintInfo.context->fillEllipse(borderBounds); | 1554 paintInfo.getContext()->fillEllipse(borderBounds); |
1555 | 1555 |
1556 RefPtr<Gradient> borderGradient = Gradient::create(fillBounds.minXMinYCorner
(), fillBounds.minXMaxYCorner()); | 1556 RefPtr<Gradient> borderGradient = Gradient::create(fillBounds.minXMinYCorner
(), fillBounds.minXMaxYCorner()); |
1557 borderGradient->addColorStop(0.0, borderGradientTopColor); | 1557 borderGradient->addColorStop(0.0, borderGradientTopColor); |
1558 borderGradient->addColorStop(1.0, borderGradientBottomColor); | 1558 borderGradient->addColorStop(1.0, borderGradientBottomColor); |
1559 paintInfo.context->setStrokeGradient(borderGradient); | 1559 paintInfo.getContext()->setStrokeGradient(borderGradient); |
1560 paintInfo.context->setStrokeThickness(sliderThumbBorderWidth); | 1560 paintInfo.getContext()->setStrokeThickness(sliderThumbBorderWidth); |
1561 paintInfo.context->strokeEllipse(borderBounds); | 1561 paintInfo.getContext()->strokeEllipse(borderBounds); |
1562 | 1562 |
1563 if (isFocused(o)) { | 1563 if (isFocused(o)) { |
1564 Path borderPath; | 1564 Path borderPath; |
1565 borderPath.addEllipse(borderBounds); | 1565 borderPath.addEllipse(borderBounds); |
1566 paintInfo.context->drawFocusRing(borderPath, 5, -2, focusRingColor()); | 1566 paintInfo.getContext()->drawFocusRing(borderPath, 5, -2, focusRingColor(
)); |
1567 } | 1567 } |
1568 | 1568 |
1569 return false; | 1569 return false; |
1570 } | 1570 } |
1571 | 1571 |
1572 bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1572 bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, PaintInfo& paintI
nfo, const IntRect& r) |
1573 { | 1573 { |
1574 LocalCurrentGraphicsContext localContext(paintInfo.context); | 1574 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
1575 | 1575 |
1576 NSSearchFieldCell* search = this->search(); | 1576 NSSearchFieldCell* search = this->search(); |
1577 setSearchCellState(o, r); | 1577 setSearchCellState(o, r); |
1578 [search setControlSize:searchFieldControlSizeForFont(o->style())]; | 1578 [search setControlSize:searchFieldControlSizeForFont(o->style())]; |
1579 | 1579 |
1580 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1580 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1581 | 1581 |
1582 float zoomLevel = o->style()->effectiveZoom(); | 1582 float zoomLevel = o->style()->effectiveZoom(); |
1583 | 1583 |
1584 IntRect unzoomedRect = r; | 1584 IntRect unzoomedRect = r; |
1585 | 1585 |
1586 if (zoomLevel != 1.0f) { | 1586 if (zoomLevel != 1.0f) { |
1587 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 1587 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
1588 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 1588 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
1589 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1589 paintInfo.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
1590 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1590 paintInfo.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
1591 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1591 paintInfo.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
1592 } | 1592 } |
1593 | 1593 |
1594 // Set the search button to nil before drawing. Then reset it so we can dra
w it later. | 1594 // Set the search button to nil before drawing. Then reset it so we can dra
w it later. |
1595 [search setSearchButtonCell:nil]; | 1595 [search setSearchButtonCell:nil]; |
1596 | 1596 |
1597 [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)]; | 1597 [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)]; |
1598 | 1598 |
1599 [search setControlView:nil]; | 1599 [search setControlView:nil]; |
1600 [search resetSearchButtonCell]; | 1600 [search resetSearchButtonCell]; |
1601 | 1601 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1661 style->setPaddingLeft(Length(horizontalPadding, Fixed)); | 1661 style->setPaddingLeft(Length(horizontalPadding, Fixed)); |
1662 style->setPaddingRight(Length(horizontalPadding, Fixed)); | 1662 style->setPaddingRight(Length(horizontalPadding, Fixed)); |
1663 style->setPaddingTop(Length(verticalPadding, Fixed)); | 1663 style->setPaddingTop(Length(verticalPadding, Fixed)); |
1664 style->setPaddingBottom(Length(verticalPadding, Fixed)); | 1664 style->setPaddingBottom(Length(verticalPadding, Fixed)); |
1665 | 1665 |
1666 setFontFromControlSize(style, controlSize); | 1666 setFontFromControlSize(style, controlSize); |
1667 | 1667 |
1668 style->setBoxShadow(nullptr); | 1668 style->setBoxShadow(nullptr); |
1669 } | 1669 } |
1670 | 1670 |
1671 bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const
PaintInfo& paintInfo, const IntRect& r) | 1671 bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, Paint
Info& paintInfo, const IntRect& r) |
1672 { | 1672 { |
1673 Element* input = o->node()->shadowHost(); | 1673 Element* input = o->node()->shadowHost(); |
1674 if (!input) | 1674 if (!input) |
1675 input = toElement(o->node()); | 1675 input = toElement(o->node()); |
1676 | 1676 |
1677 if (!input->renderer()->isBox()) | 1677 if (!input->renderer()->isBox()) |
1678 return false; | 1678 return false; |
1679 | 1679 |
1680 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1680 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1681 | 1681 |
1682 float zoomLevel = o->style()->effectiveZoom(); | 1682 float zoomLevel = o->style()->effectiveZoom(); |
1683 FloatRect unzoomedRect(r); | 1683 FloatRect unzoomedRect(r); |
1684 if (zoomLevel != 1.0f) { | 1684 if (zoomLevel != 1.0f) { |
1685 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 1685 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
1686 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 1686 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
1687 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1687 paintInfo.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
1688 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1688 paintInfo.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
1689 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1689 paintInfo.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
1690 } | 1690 } |
1691 | 1691 |
1692 Color fillColor(200, 200, 200); | 1692 Color fillColor(200, 200, 200); |
1693 | 1693 |
1694 if (isPressed(o)) { | 1694 if (isPressed(o)) { |
1695 Color tintColor(0, 0, 0, 32); | 1695 Color tintColor(0, 0, 0, 32); |
1696 fillColor = fillColor.blend(tintColor); | 1696 fillColor = fillColor.blend(tintColor); |
1697 } | 1697 } |
1698 | 1698 |
1699 float centerX = unzoomedRect.x() + unzoomedRect.width() / 2; | 1699 float centerX = unzoomedRect.x() + unzoomedRect.width() / 2; |
1700 float centerY = unzoomedRect.y() + unzoomedRect.height() / 2; | 1700 float centerY = unzoomedRect.y() + unzoomedRect.height() / 2; |
1701 // The line width is 3px on a regular sized, high DPI NSCancelButtonCell | 1701 // The line width is 3px on a regular sized, high DPI NSCancelButtonCell |
1702 // (which is 28px wide). | 1702 // (which is 28px wide). |
1703 float lineWidth = unzoomedRect.width() * 3 / 28; | 1703 float lineWidth = unzoomedRect.width() * 3 / 28; |
1704 // The line length is 16px on a regular sized, high DPI NSCancelButtonCell. | 1704 // The line length is 16px on a regular sized, high DPI NSCancelButtonCell. |
1705 float lineLength = unzoomedRect.width() * 16 / 28; | 1705 float lineLength = unzoomedRect.width() * 16 / 28; |
1706 | 1706 |
1707 Path xPath; | 1707 Path xPath; |
1708 FloatSize lineRectRadius(lineWidth / 2, lineWidth / 2); | 1708 FloatSize lineRectRadius(lineWidth / 2, lineWidth / 2); |
1709 xPath.addRoundedRect(FloatRect(-lineLength / 2, -lineWidth / 2, lineLength,
lineWidth), | 1709 xPath.addRoundedRect(FloatRect(-lineLength / 2, -lineWidth / 2, lineLength,
lineWidth), |
1710 lineRectRadius, lineRectRadius, lineRectRadius, lineRectRadius); | 1710 lineRectRadius, lineRectRadius, lineRectRadius, lineRectRadius); |
1711 xPath.addRoundedRect(FloatRect(-lineWidth / 2, -lineLength / 2, lineWidth, l
ineLength), | 1711 xPath.addRoundedRect(FloatRect(-lineWidth / 2, -lineLength / 2, lineWidth, l
ineLength), |
1712 lineRectRadius, lineRectRadius, lineRectRadius, lineRectRadius); | 1712 lineRectRadius, lineRectRadius, lineRectRadius, lineRectRadius); |
1713 | 1713 |
1714 paintInfo.context->translate(centerX, centerY); | 1714 paintInfo.getContext()->translate(centerX, centerY); |
1715 paintInfo.context->rotate(deg2rad(45.0)); | 1715 paintInfo.getContext()->rotate(deg2rad(45.0)); |
1716 paintInfo.context->clipOut(xPath); | 1716 paintInfo.getContext()->clipOut(xPath); |
1717 paintInfo.context->rotate(deg2rad(-45.0)); | 1717 paintInfo.getContext()->rotate(deg2rad(-45.0)); |
1718 paintInfo.context->translate(-centerX, -centerY); | 1718 paintInfo.getContext()->translate(-centerX, -centerY); |
1719 | 1719 |
1720 paintInfo.context->setFillColor(fillColor); | 1720 paintInfo.getContext()->setFillColor(fillColor); |
1721 paintInfo.context->fillEllipse(unzoomedRect); | 1721 paintInfo.getContext()->fillEllipse(unzoomedRect); |
1722 | 1722 |
1723 return false; | 1723 return false; |
1724 } | 1724 } |
1725 | 1725 |
1726 const IntSize* RenderThemeChromiumMac::cancelButtonSizes() const | 1726 const IntSize* RenderThemeChromiumMac::cancelButtonSizes() const |
1727 { | 1727 { |
1728 static const IntSize sizes[3] = { IntSize(14, 14), IntSize(11, 11), IntSize(
9, 9) }; | 1728 static const IntSize sizes[3] = { IntSize(14, 14), IntSize(11, 11), IntSize(
9, 9) }; |
1729 return sizes; | 1729 return sizes; |
1730 } | 1730 } |
1731 | 1731 |
(...skipping 14 matching lines...) Expand all Loading... |
1746 void RenderThemeChromiumMac::adjustSearchFieldDecorationStyle(RenderStyle* style
, Element*) const | 1746 void RenderThemeChromiumMac::adjustSearchFieldDecorationStyle(RenderStyle* style
, Element*) const |
1747 { | 1747 { |
1748 NSControlSize controlSize = controlSizeForSystemFont(style); | 1748 NSControlSize controlSize = controlSizeForSystemFont(style); |
1749 IntSize searchFieldSize = searchFieldSizes()[controlSize]; | 1749 IntSize searchFieldSize = searchFieldSizes()[controlSize]; |
1750 int width = searchFieldSize.height() / 2 - searchFieldBorderWidth - searchFi
eldHorizontalPaddings()[controlSize]; | 1750 int width = searchFieldSize.height() / 2 - searchFieldBorderWidth - searchFi
eldHorizontalPaddings()[controlSize]; |
1751 style->setWidth(Length(width, Fixed)); | 1751 style->setWidth(Length(width, Fixed)); |
1752 style->setHeight(Length(0, Fixed)); | 1752 style->setHeight(Length(0, Fixed)); |
1753 style->setBoxShadow(nullptr); | 1753 style->setBoxShadow(nullptr); |
1754 } | 1754 } |
1755 | 1755 |
1756 bool RenderThemeChromiumMac::paintSearchFieldDecoration(RenderObject*, const Pai
ntInfo&, const IntRect&) | 1756 bool RenderThemeChromiumMac::paintSearchFieldDecoration(RenderObject*, PaintInfo
&, const IntRect&) |
1757 { | 1757 { |
1758 return false; | 1758 return false; |
1759 } | 1759 } |
1760 | 1760 |
1761 void RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(RenderStyle
* style, Element*) const | 1761 void RenderThemeChromiumMac::adjustSearchFieldResultsDecorationStyle(RenderStyle
* style, Element*) const |
1762 { | 1762 { |
1763 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); | 1763 IntSize size = sizeForSystemFont(style, resultsButtonSizes()); |
1764 style->setWidth(Length(size.width(), Fixed)); | 1764 style->setWidth(Length(size.width(), Fixed)); |
1765 style->setHeight(Length(size.height(), Fixed)); | 1765 style->setHeight(Length(size.height(), Fixed)); |
1766 style->setBoxShadow(nullptr); | 1766 style->setBoxShadow(nullptr); |
1767 } | 1767 } |
1768 | 1768 |
1769 bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o,
const PaintInfo& paintInfo, const IntRect& r) | 1769 bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o,
PaintInfo& paintInfo, const IntRect& r) |
1770 { | 1770 { |
1771 Node* input = o->node()->shadowHost(); | 1771 Node* input = o->node()->shadowHost(); |
1772 if (!input) | 1772 if (!input) |
1773 input = o->node(); | 1773 input = o->node(); |
1774 if (!input->renderer()->isBox()) | 1774 if (!input->renderer()->isBox()) |
1775 return false; | 1775 return false; |
1776 | 1776 |
1777 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 1777 GraphicsContextStateSaver stateSaver(*(paintInfo.getContext())); |
1778 | 1778 |
1779 float zoomLevel = o->style()->effectiveZoom(); | 1779 float zoomLevel = o->style()->effectiveZoom(); |
1780 FloatRect unzoomedRect(r); | 1780 FloatRect unzoomedRect(r); |
1781 if (zoomLevel != 1) { | 1781 if (zoomLevel != 1) { |
1782 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); | 1782 unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); |
1783 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); | 1783 unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); |
1784 paintInfo.context->translate(unzoomedRect.x(), unzoomedRect.y()); | 1784 paintInfo.getContext()->translate(unzoomedRect.x(), unzoomedRect.y()); |
1785 paintInfo.context->scale(FloatSize(zoomLevel, zoomLevel)); | 1785 paintInfo.getContext()->scale(FloatSize(zoomLevel, zoomLevel)); |
1786 paintInfo.context->translate(-unzoomedRect.x(), -unzoomedRect.y()); | 1786 paintInfo.getContext()->translate(-unzoomedRect.x(), -unzoomedRect.y()); |
1787 } | 1787 } |
1788 | 1788 |
1789 LocalCurrentGraphicsContext localContext(paintInfo.context); | 1789 LocalCurrentGraphicsContext localContext(paintInfo.getContext()); |
1790 | 1790 |
1791 NSSearchFieldCell* search = this->search(); | 1791 NSSearchFieldCell* search = this->search(); |
1792 setSearchCellState(input->renderer(), r); | 1792 setSearchCellState(input->renderer(), r); |
1793 [search setControlSize:searchFieldControlSizeForFont(o->style())]; | 1793 [search setControlSize:searchFieldControlSizeForFont(o->style())]; |
1794 if ([search searchMenuTemplate] != nil) | 1794 if ([search searchMenuTemplate] != nil) |
1795 [search setSearchMenuTemplate:nil]; | 1795 [search setSearchMenuTemplate:nil]; |
1796 | 1796 |
1797 updateActiveState([search searchButtonCell], o); | 1797 updateActiveState([search searchButtonCell], o); |
1798 | 1798 |
1799 [[search searchButtonCell] drawWithFrame:unzoomedRect inView:documentViewFor
(o)]; | 1799 [[search searchButtonCell] drawWithFrame:unzoomedRect inView:documentViewFor
(o)]; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1940 bool RenderThemeChromiumMac::shouldShowPlaceholderWhenFocused() const | 1940 bool RenderThemeChromiumMac::shouldShowPlaceholderWhenFocused() const |
1941 { | 1941 { |
1942 return true; | 1942 return true; |
1943 } | 1943 } |
1944 | 1944 |
1945 void RenderThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) cons
t | 1945 void RenderThemeChromiumMac::adjustMediaSliderThumbSize(RenderStyle* style) cons
t |
1946 { | 1946 { |
1947 RenderMediaControlsChromium::adjustMediaSliderThumbSize(style); | 1947 RenderMediaControlsChromium::adjustMediaSliderThumbSize(style); |
1948 } | 1948 } |
1949 | 1949 |
1950 bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) | 1950 bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, PaintInf
o& paintInfo, const IntRect& rect) |
1951 { | 1951 { |
1952 return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton,
object, paintInfo, rect); | 1952 return RenderMediaControlsChromium::paintMediaControlsPart(MediaPlayButton,
object, paintInfo, rect); |
1953 } | 1953 } |
1954 | 1954 |
1955 bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) | 1955 bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, PaintInf
o& paintInfo, const IntRect& rect) |
1956 { | 1956 { |
1957 return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton,
object, paintInfo, rect); | 1957 return RenderMediaControlsChromium::paintMediaControlsPart(MediaMuteButton,
object, paintInfo, rect); |
1958 } | 1958 } |
1959 | 1959 |
1960 bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const P
aintInfo& paintInfo, const IntRect& rect) | 1960 bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, PaintIn
fo& paintInfo, const IntRect& rect) |
1961 { | 1961 { |
1962 return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, obje
ct, paintInfo, rect); | 1962 return RenderMediaControlsChromium::paintMediaControlsPart(MediaSlider, obje
ct, paintInfo, rect); |
1963 } | 1963 } |
1964 | 1964 |
1965 String RenderThemeChromiumMac::extraFullScreenStyleSheet() | 1965 String RenderThemeChromiumMac::extraFullScreenStyleSheet() |
1966 { | 1966 { |
1967 // FIXME: Chromium may wish to style its default media controls differently
in fullscreen. | 1967 // FIXME: Chromium may wish to style its default media controls differently
in fullscreen. |
1968 return String(); | 1968 return String(); |
1969 } | 1969 } |
1970 | 1970 |
1971 String RenderThemeChromiumMac::extraDefaultStyleSheet() | 1971 String RenderThemeChromiumMac::extraDefaultStyleSheet() |
1972 { | 1972 { |
1973 return RenderTheme::extraDefaultStyleSheet() + | 1973 return RenderTheme::extraDefaultStyleSheet() + |
1974 String(themeChromiumUserAgentStyleSheet, sizeof(themeChromiumUserAgen
tStyleSheet)); | 1974 String(themeChromiumUserAgentStyleSheet, sizeof(themeChromiumUserAgen
tStyleSheet)); |
1975 } | 1975 } |
1976 | 1976 |
1977 bool RenderThemeChromiumMac::paintMediaVolumeSliderContainer(RenderObject* objec
t, const PaintInfo& paintInfo, const IntRect& rect) | 1977 bool RenderThemeChromiumMac::paintMediaVolumeSliderContainer(RenderObject* objec
t, PaintInfo& paintInfo, const IntRect& rect) |
1978 { | 1978 { |
1979 return true; | 1979 return true; |
1980 } | 1980 } |
1981 | 1981 |
1982 bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) | 1982 bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, P
aintInfo& paintInfo, const IntRect& rect) |
1983 { | 1983 { |
1984 return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider
, object, paintInfo, rect); | 1984 return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider
, object, paintInfo, rect); |
1985 } | 1985 } |
1986 | 1986 |
1987 bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, c
onst PaintInfo& paintInfo, const IntRect& rect) | 1987 bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, P
aintInfo& paintInfo, const IntRect& rect) |
1988 { | 1988 { |
1989 return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider
Thumb, object, paintInfo, rect); | 1989 return RenderMediaControlsChromium::paintMediaControlsPart(MediaVolumeSlider
Thumb, object, paintInfo, rect); |
1990 } | 1990 } |
1991 | 1991 |
1992 bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const P
aintInfo& paintInfo, const IntRect& rect) | 1992 bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, PaintIn
fo& paintInfo, const IntRect& rect) |
1993 { | 1993 { |
1994 return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb,
object, paintInfo, rect); | 1994 return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb,
object, paintInfo, rect); |
1995 } | 1995 } |
1996 | 1996 |
1997 String RenderThemeChromiumMac::formatMediaControlsTime(float time) const | 1997 String RenderThemeChromiumMac::formatMediaControlsTime(float time) const |
1998 { | 1998 { |
1999 return RenderMediaControlsChromium::formatMediaControlsTime(time); | 1999 return RenderMediaControlsChromium::formatMediaControlsTime(time); |
2000 } | 2000 } |
2001 | 2001 |
2002 String RenderThemeChromiumMac::formatMediaControlsCurrentTime(float currentTime,
float duration) const | 2002 String RenderThemeChromiumMac::formatMediaControlsCurrentTime(float currentTime,
float duration) const |
2003 { | 2003 { |
2004 return RenderMediaControlsChromium::formatMediaControlsCurrentTime(currentTi
me, duration); | 2004 return RenderMediaControlsChromium::formatMediaControlsCurrentTime(currentTi
me, duration); |
2005 } | 2005 } |
2006 | 2006 |
2007 bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* object, co
nst PaintInfo& paintInfo, const IntRect& rect) | 2007 bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* object, Pa
intInfo& paintInfo, const IntRect& rect) |
2008 { | 2008 { |
2009 return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscr
eenButton, object, paintInfo, rect); | 2009 return RenderMediaControlsChromium::paintMediaControlsPart(MediaEnterFullscr
eenButton, object, paintInfo, rect); |
2010 } | 2010 } |
2011 | 2011 |
2012 bool RenderThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject*
object, const PaintInfo& paintInfo, const IntRect& rect) | 2012 bool RenderThemeChromiumMac::paintMediaToggleClosedCaptionsButton(RenderObject*
object, PaintInfo& paintInfo, const IntRect& rect) |
2013 { | 2013 { |
2014 return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCa
ptionsButton, object, paintInfo, rect); | 2014 return RenderMediaControlsChromium::paintMediaControlsPart(MediaShowClosedCa
ptionsButton, object, paintInfo, rect); |
2015 } | 2015 } |
2016 | 2016 |
2017 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const | 2017 bool RenderThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const |
2018 { | 2018 { |
2019 ControlPart part = style->appearance(); | 2019 ControlPart part = style->appearance(); |
2020 if (part == CheckboxPart || part == RadioPart) | 2020 if (part == CheckboxPart || part == RadioPart) |
2021 return style->effectiveZoom() != 1; | 2021 return style->effectiveZoom() != 1; |
2022 return false; | 2022 return false; |
2023 } | 2023 } |
2024 | 2024 |
2025 } // namespace WebCore | 2025 } // namespace WebCore |
OLD | NEW |