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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 } | 578 } |
579 | 579 |
580 void LayoutThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject
* o) | 580 void LayoutThemeChromiumMac::updatePressedState(NSCell* cell, const RenderObject
* o) |
581 { | 581 { |
582 bool oldPressed = [cell isHighlighted]; | 582 bool oldPressed = [cell isHighlighted]; |
583 bool pressed = o->node() && o->node()->active(); | 583 bool pressed = o->node() && o->node()->active(); |
584 if (pressed != oldPressed) | 584 if (pressed != oldPressed) |
585 [cell setHighlighted:pressed]; | 585 [cell setHighlighted:pressed]; |
586 } | 586 } |
587 | 587 |
588 NSControlSize LayoutThemeChromiumMac::controlSizeForFont(RenderStyle* style) con
st | 588 NSControlSize LayoutThemeChromiumMac::controlSizeForFont(const RenderStyle* styl
e) const |
589 { | 589 { |
590 int fontSize = style->fontSize(); | 590 int fontSize = style->fontSize(); |
591 if (fontSize >= 16) | 591 if (fontSize >= 16) |
592 return NSRegularControlSize; | 592 return NSRegularControlSize; |
593 if (fontSize >= 11) | 593 if (fontSize >= 11) |
594 return NSSmallControlSize; | 594 return NSSmallControlSize; |
595 return NSMiniControlSize; | 595 return NSMiniControlSize; |
596 } | 596 } |
597 | 597 |
598 // We don't use controlSizeForFont() for search field decorations because it | 598 // We don't use controlSizeForFont() for search field decorations because it |
599 // needs to fit into the search field. The font size will already be modified by | 599 // needs to fit into the search field. The font size will already be modified by |
600 // setFontFromControlSize() called on the search field. | 600 // setFontFromControlSize() called on the search field. |
601 static NSControlSize searchFieldControlSizeForFont(RenderStyle* style) | 601 static NSControlSize searchFieldControlSizeForFont(const RenderStyle* style) |
602 { | 602 { |
603 int fontSize = style->fontSize(); | 603 int fontSize = style->fontSize(); |
604 if (fontSize >= 13) | 604 if (fontSize >= 13) |
605 return NSRegularControlSize; | 605 return NSRegularControlSize; |
606 if (fontSize >= 11) | 606 if (fontSize >= 11) |
607 return NSSmallControlSize; | 607 return NSSmallControlSize; |
608 return NSMiniControlSize; | 608 return NSMiniControlSize; |
609 } | 609 } |
610 | 610 |
611 void LayoutThemeChromiumMac::setControlSize(NSCell* cell, const IntSize* sizes,
const IntSize& minSize, float zoomLevel) | 611 void LayoutThemeChromiumMac::setControlSize(NSCell* cell, const IntSize* sizes,
const IntSize& minSize, float zoomLevel) |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 fontDescription.setComputedSize([font pointSize] * style->effectiveZoom()); | 665 fontDescription.setComputedSize([font pointSize] * style->effectiveZoom()); |
666 fontDescription.setSpecifiedSize([font pointSize] * style->effectiveZoom()); | 666 fontDescription.setSpecifiedSize([font pointSize] * style->effectiveZoom()); |
667 | 667 |
668 // Reset line height. | 668 // Reset line height. |
669 style->setLineHeight(RenderStyle::initialLineHeight()); | 669 style->setLineHeight(RenderStyle::initialLineHeight()); |
670 | 670 |
671 if (style->setFontDescription(fontDescription)) | 671 if (style->setFontDescription(fontDescription)) |
672 style->font().update(nullptr); | 672 style->font().update(nullptr); |
673 } | 673 } |
674 | 674 |
675 NSControlSize LayoutThemeChromiumMac::controlSizeForSystemFont(RenderStyle* styl
e) const | 675 NSControlSize LayoutThemeChromiumMac::controlSizeForSystemFont(const RenderStyle
* style) const |
676 { | 676 { |
677 float fontSize = style->fontSize(); | 677 float fontSize = style->fontSize(); |
678 float zoomLevel = style->effectiveZoom(); | 678 float zoomLevel = style->effectiveZoom(); |
679 if (zoomLevel != 1) | 679 if (zoomLevel != 1) |
680 fontSize /= zoomLevel; | 680 fontSize /= zoomLevel; |
681 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) | 681 if (fontSize >= [NSFont systemFontSizeForControlSize:NSRegularControlSize]) |
682 return NSRegularControlSize; | 682 return NSRegularControlSize; |
683 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) | 683 if (fontSize >= [NSFont systemFontSizeForControlSize:NSSmallControlSize]) |
684 return NSSmallControlSize; | 684 return NSSmallControlSize; |
685 return NSMiniControlSize; | 685 return NSMiniControlSize; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 { | 965 { |
966 static const int margins[3][4] = | 966 static const int margins[3][4] = |
967 { | 967 { |
968 { 0, 0, 1, 0 }, | 968 { 0, 0, 1, 0 }, |
969 { 0, 0, 1, 0 }, | 969 { 0, 0, 1, 0 }, |
970 { 0, 0, 1, 0 }, | 970 { 0, 0, 1, 0 }, |
971 }; | 971 }; |
972 return margins[controlSize]; | 972 return margins[controlSize]; |
973 } | 973 } |
974 | 974 |
975 int LayoutThemeChromiumMac::minimumProgressBarHeight(RenderStyle* style) const | 975 int LayoutThemeChromiumMac::minimumProgressBarHeight(const RenderStyle* style) c
onst |
976 { | 976 { |
977 return sizeForSystemFont(style, progressBarSizes()).height(); | 977 return sizeForSystemFont(style, progressBarSizes()).height(); |
978 } | 978 } |
979 | 979 |
980 double LayoutThemeChromiumMac::animationRepeatIntervalForProgressBar(RenderProgr
ess*) const | 980 double LayoutThemeChromiumMac::animationRepeatIntervalForProgressBar(RenderProgr
ess*) const |
981 { | 981 { |
982 return progressAnimationFrameRate; | 982 return progressAnimationFrameRate; |
983 } | 983 } |
984 | 984 |
985 double LayoutThemeChromiumMac::animationDurationForProgressBar(RenderProgress*)
const | 985 double LayoutThemeChromiumMac::animationDurationForProgressBar(RenderProgress*)
const |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 updateFocusedState(popupButton, o); | 1207 updateFocusedState(popupButton, o); |
1208 #endif | 1208 #endif |
1209 } | 1209 } |
1210 | 1210 |
1211 const IntSize* LayoutThemeChromiumMac::menuListSizes() const | 1211 const IntSize* LayoutThemeChromiumMac::menuListSizes() const |
1212 { | 1212 { |
1213 static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0
) }; | 1213 static const IntSize sizes[3] = { IntSize(9, 0), IntSize(5, 0), IntSize(0, 0
) }; |
1214 return sizes; | 1214 return sizes; |
1215 } | 1215 } |
1216 | 1216 |
1217 int LayoutThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const | 1217 int LayoutThemeChromiumMac::minimumMenuListSize(const RenderStyle* style) const |
1218 { | 1218 { |
1219 return sizeForSystemFont(style, menuListSizes()).width(); | 1219 return sizeForSystemFont(style, menuListSizes()).width(); |
1220 } | 1220 } |
1221 | 1221 |
1222 const int sliderTrackWidth = 5; | 1222 const int sliderTrackWidth = 5; |
1223 const int sliderTrackBorderWidth = 1; | 1223 const int sliderTrackBorderWidth = 1; |
1224 | 1224 |
1225 bool LayoutThemeChromiumMac::paintSliderTrack(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) | 1225 bool LayoutThemeChromiumMac::paintSliderTrack(RenderObject* o, const PaintInfo&
paintInfo, const IntRect& r) |
1226 { | 1226 { |
1227 paintSliderTicks(o, paintInfo, r); | 1227 paintSliderTicks(o, paintInfo, r); |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 | 1844 |
1845 bool LayoutThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const | 1845 bool LayoutThemeChromiumMac::shouldUseFallbackTheme(RenderStyle* style) const |
1846 { | 1846 { |
1847 ControlPart part = style->appearance(); | 1847 ControlPart part = style->appearance(); |
1848 if (part == CheckboxPart || part == RadioPart) | 1848 if (part == CheckboxPart || part == RadioPart) |
1849 return style->effectiveZoom() != 1; | 1849 return style->effectiveZoom() != 1; |
1850 return false; | 1850 return false; |
1851 } | 1851 } |
1852 | 1852 |
1853 } // namespace blink | 1853 } // namespace blink |
OLD | NEW |