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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutThemeMac.mm

Issue 2331443002: Mac: adjust sizes of progress bars to be equal to painted size. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google, Inc. 3 * Copyright (C) 2008, 2009 Google, Inc.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 { 677 {
678 static const int padding[3][4] = 678 static const int padding[3][4] =
679 { 679 {
680 { 2, 26, 3, 8 }, 680 { 2, 26, 3, 8 },
681 { 2, 23, 3, 8 }, 681 { 2, 23, 3, 8 },
682 { 2, 22, 3, 10 } 682 { 2, 22, 3, 10 }
683 }; 683 };
684 return padding[size]; 684 return padding[size];
685 } 685 }
686 686
687 const IntSize* LayoutThemeMac::progressBarSizes() const 687 const int* LayoutThemeMac::progressBarHeights() const
688 { 688 {
689 static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) }; 689 static const int sizes[3] = { 20, 12, 12 };
690 return sizes; 690 return sizes;
691 } 691 }
692 692
693 const int* LayoutThemeMac::progressBarMargins(NSControlSize controlSize) const
694 {
695 static const int margins[3][4] =
696 {
697 { 0, 0, 1, 0 },
698 { 0, 0, 1, 0 },
699 { 0, 0, 1, 0 },
700 };
701 return margins[controlSize];
702 }
703
704 int LayoutThemeMac::minimumProgressBarHeight(const ComputedStyle& style) const
705 {
706 return sizeForSystemFont(style, progressBarSizes()).height();
707 }
708
709 double LayoutThemeMac::animationRepeatIntervalForProgressBar() const 693 double LayoutThemeMac::animationRepeatIntervalForProgressBar() const
710 { 694 {
711 return progressAnimationFrameRate; 695 return progressAnimationFrameRate;
712 } 696 }
713 697
714 double LayoutThemeMac::animationDurationForProgressBar() const 698 double LayoutThemeMac::animationDurationForProgressBar() const
715 { 699 {
716 return progressAnimationNumFrames * progressAnimationFrameRate; 700 return progressAnimationNumFrames * progressAnimationFrameRate;
717 } 701 }
718 702
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 IntSize LayoutThemeMac::sliderTickSize() const 902 IntSize LayoutThemeMac::sliderTickSize() const
919 { 903 {
920 return IntSize(1, 3); 904 return IntSize(1, 3);
921 } 905 }
922 906
923 int LayoutThemeMac::sliderTickOffsetFromTrackCenter() const 907 int LayoutThemeMac::sliderTickOffsetFromTrackCenter() const
924 { 908 {
925 return -9; 909 return -9;
926 } 910 }
927 911
912 void LayoutThemeMac::adjustProgressBarBounds(ComputedStyle& style) const
913 {
914 float zoomLevel = style.effectiveZoom();
915 NSControlSize controlSize = controlSizeForFont(style);
916 int height = progressBarHeights()[controlSize] * zoomLevel;
917
918 // Now inflate it to account for the shadow.
919 style.setMinHeight(Length(height + zoomLevel, Fixed));
920 }
921
928 void LayoutThemeMac::adjustSliderThumbSize(ComputedStyle& style) const 922 void LayoutThemeMac::adjustSliderThumbSize(ComputedStyle& style) const
929 { 923 {
930 float zoomLevel = style.effectiveZoom(); 924 float zoomLevel = style.effectiveZoom();
931 if (style.appearance() == SliderThumbHorizontalPart || style.appearance() == SliderThumbVerticalPart) { 925 if (style.appearance() == SliderThumbHorizontalPart || style.appearance() == SliderThumbVerticalPart) {
932 style.setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fi xed)); 926 style.setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fi xed));
933 style.setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); 927 style.setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed));
934 } else { 928 } else {
935 adjustMediaSliderThumbSize(style); 929 adjustMediaSliderThumbSize(style);
936 } 930 }
937 } 931 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 1100
1107 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const 1101 bool LayoutThemeMac::shouldUseFallbackTheme(const ComputedStyle& style) const
1108 { 1102 {
1109 ControlPart part = style.appearance(); 1103 ControlPart part = style.appearance();
1110 if (part == CheckboxPart || part == RadioPart) 1104 if (part == CheckboxPart || part == RadioPart)
1111 return style.effectiveZoom() != 1; 1105 return style.effectiveZoom() != 1;
1112 return false; 1106 return false;
1113 } 1107 }
1114 1108
1115 } // namespace blink 1109 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutThemeMac.h ('k') | third_party/WebKit/Source/core/paint/ThemePainterMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698