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 22 matching lines...) Expand all Loading... |
33 #import "core/html/HTMLMeterElement.h" | 33 #import "core/html/HTMLMeterElement.h" |
34 #import "core/html/TimeRanges.h" | 34 #import "core/html/TimeRanges.h" |
35 #import "core/html/shadow/MediaControlElements.h" | 35 #import "core/html/shadow/MediaControlElements.h" |
36 #import "core/layout/Layer.h" | 36 #import "core/layout/Layer.h" |
37 #import "core/layout/LayoutSlider.h" | 37 #import "core/layout/LayoutSlider.h" |
38 #import "core/layout/PaintInfo.h" | 38 #import "core/layout/PaintInfo.h" |
39 #import "core/layout/style/AuthorStyleInfo.h" | 39 #import "core/layout/style/AuthorStyleInfo.h" |
40 #import "core/layout/style/ShadowList.h" | 40 #import "core/layout/style/ShadowList.h" |
41 #import "core/layout/LayoutMedia.h" | 41 #import "core/layout/LayoutMedia.h" |
42 #import "core/layout/LayoutMediaControls.h" | 42 #import "core/layout/LayoutMediaControls.h" |
| 43 #import "core/layout/LayoutProgress.h" |
43 #import "core/rendering/RenderMeter.h" | 44 #import "core/rendering/RenderMeter.h" |
44 #import "core/rendering/RenderProgress.h" | |
45 #import "core/rendering/RenderView.h" | 45 #import "core/rendering/RenderView.h" |
46 #import "platform/LayoutTestSupport.h" | 46 #import "platform/LayoutTestSupport.h" |
47 #import "platform/PlatformResourceLoader.h" | 47 #import "platform/PlatformResourceLoader.h" |
48 #import "platform/SharedBuffer.h" | 48 #import "platform/SharedBuffer.h" |
49 #import "platform/geometry/FloatRoundedRect.h" | 49 #import "platform/geometry/FloatRoundedRect.h" |
50 #import "platform/graphics/BitmapImage.h" | 50 #import "platform/graphics/BitmapImage.h" |
51 #import "platform/graphics/GraphicsContextStateSaver.h" | 51 #import "platform/graphics/GraphicsContextStateSaver.h" |
52 #import "platform/graphics/Image.h" | 52 #import "platform/graphics/Image.h" |
53 #import "platform/graphics/ImageBuffer.h" | 53 #import "platform/graphics/ImageBuffer.h" |
54 #import "platform/mac/ColorMac.h" | 54 #import "platform/mac/ColorMac.h" |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 LayoutThemeMac::minimumProgressBarHeight(const LayoutStyle& style) const | 975 int LayoutThemeMac::minimumProgressBarHeight(const LayoutStyle& style) const |
976 { | 976 { |
977 return sizeForSystemFont(style, progressBarSizes()).height(); | 977 return sizeForSystemFont(style, progressBarSizes()).height(); |
978 } | 978 } |
979 | 979 |
980 double LayoutThemeMac::animationRepeatIntervalForProgressBar(RenderProgress*) co
nst | 980 double LayoutThemeMac::animationRepeatIntervalForProgressBar(LayoutProgress*) co
nst |
981 { | 981 { |
982 return progressAnimationFrameRate; | 982 return progressAnimationFrameRate; |
983 } | 983 } |
984 | 984 |
985 double LayoutThemeMac::animationDurationForProgressBar(RenderProgress*) const | 985 double LayoutThemeMac::animationDurationForProgressBar(LayoutProgress*) const |
986 { | 986 { |
987 return progressAnimationNumFrames * progressAnimationFrameRate; | 987 return progressAnimationNumFrames * progressAnimationFrameRate; |
988 } | 988 } |
989 | 989 |
990 bool LayoutThemeMac::paintProgressBar(LayoutObject* layoutObject, const PaintInf
o& paintInfo, const IntRect& rect) | 990 bool LayoutThemeMac::paintProgressBar(LayoutObject* layoutObject, const PaintInf
o& paintInfo, const IntRect& rect) |
991 { | 991 { |
992 if (!layoutObject->isProgress()) | 992 if (!layoutObject->isProgress()) |
993 return true; | 993 return true; |
994 | 994 |
995 float zoomLevel = layoutObject->style()->effectiveZoom(); | 995 float zoomLevel = layoutObject->style()->effectiveZoom(); |
996 int controlSize = controlSizeForFont(layoutObject->styleRef()); | 996 int controlSize = controlSizeForFont(layoutObject->styleRef()); |
997 IntSize size = progressBarSizes()[controlSize]; | 997 IntSize size = progressBarSizes()[controlSize]; |
998 size.setHeight(size.height() * zoomLevel); | 998 size.setHeight(size.height() * zoomLevel); |
999 size.setWidth(rect.width()); | 999 size.setWidth(rect.width()); |
1000 | 1000 |
1001 // Now inflate it to account for the shadow. | 1001 // Now inflate it to account for the shadow. |
1002 IntRect inflatedRect = rect; | 1002 IntRect inflatedRect = rect; |
1003 if (rect.height() <= minimumProgressBarHeight(layoutObject->styleRef())) | 1003 if (rect.height() <= minimumProgressBarHeight(layoutObject->styleRef())) |
1004 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, progressBarMarg
ins(controlSize), zoomLevel); | 1004 inflatedRect = ThemeMac::inflateRect(inflatedRect, size, progressBarMarg
ins(controlSize), zoomLevel); |
1005 | 1005 |
1006 RenderProgress* renderProgress = toRenderProgress(layoutObject); | 1006 LayoutProgress* renderProgress = toLayoutProgress(layoutObject); |
1007 HIThemeTrackDrawInfo trackInfo; | 1007 HIThemeTrackDrawInfo trackInfo; |
1008 trackInfo.version = 0; | 1008 trackInfo.version = 0; |
1009 if (controlSize == NSRegularControlSize) | 1009 if (controlSize == NSRegularControlSize) |
1010 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina
teBar : kThemeLargeProgressBar; | 1010 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndetermina
teBar : kThemeLargeProgressBar; |
1011 else | 1011 else |
1012 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin
ateBar : kThemeMediumProgressBar; | 1012 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndetermin
ateBar : kThemeMediumProgressBar; |
1013 | 1013 |
1014 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); | 1014 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); |
1015 trackInfo.min = 0; | 1015 trackInfo.min = 0; |
1016 trackInfo.max = std::numeric_limits<SInt32>::max(); | 1016 trackInfo.max = std::numeric_limits<SInt32>::max(); |
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1844 | 1844 |
1845 bool LayoutThemeMac::shouldUseFallbackTheme(const LayoutStyle& style) const | 1845 bool LayoutThemeMac::shouldUseFallbackTheme(const LayoutStyle& 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 |