Changeset 95757 in webkit
- Timestamp:
- Sep 22, 2011 3:35:21 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r95756 r95757 1 2011-09-22 Jon Lee <jonlee@apple.com> 2 3 Progress control gets cropped on the bottom 4 https://bugs.webkit.org/show_bug.cgi?id=68302 5 <rdar://problem/10069915> 6 7 Reviewed by Kent Tamura. 8 9 As it turns out the smaller control type does not get rendered either, so this patch 10 fixes both. 11 12 * manual-tests/dom/progressbar.html: Altered to show both sizes of controls 13 * rendering/RenderThemeMac.h: 14 * rendering/RenderThemeMac.mm: Added methods to inflate the drawing rect 15 (WebCore::RenderThemeMac::progressBarSizes): 16 (WebCore::RenderThemeMac::progressBarMargins): 17 (WebCore::RenderThemeMac::minimumProgressBarHeight): 18 (WebCore::RenderThemeMac::paintProgressBar): Inflate the rect based on minimum desired 19 control height and glow margin. 20 1 21 2011-09-22 David Hyatt <hyatt@apple.com> 2 22 -
trunk/Source/WebCore/manual-tests/dom/progressbar.html
r56850 r95757 1 <html><body> 2 <h1>Indeterminate progress bar</h1> 1 <h1>Progress bars</h1> 2 <h2>Large</h2> 3 <div style="font-size:16px"> 3 4 This is an example of <progress value=7 max=10></progress> a determinate progress bar.<br> 4 5 This is an example of <progress></progress> an indeterminate progress bar.<br> 5 6 This is an example of <progress dir=rtl value=7 max=10></progress> a right-to-left determinate progress bar.<br> 6 7 This is an example of <progress dir=rtl></progress> a right-to-left indeterminate progress bar.<br> 7 8 </body></html> 8 </div> 9 <h2>Small</h2> 10 <div style="font-size:14px"> 11 This is an example of <progress value=4 max=10></progress> a small determinate progress bar.<br> 12 This is an example of <progress></progress> a small indeterminate progress bar.<br> 13 This is an example of <progress dir=rtl value=4 max=10></progress> a small right-to-left determinate progress bar.<br> 14 This is an example of <progress dir=rtl></progress> a small right-to-left indeterminate progress bar.<br> 15 </div> -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r89048 r95757 2 2 * This file is part of the theme implementation for form controls in WebCore. 3 3 * 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Computer, Inc.4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Computer, Inc. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 226 226 #endif 227 227 228 #if ENABLE(PROGRESS_TAG) 229 int minimumProgressBarHeight(RenderStyle*) const; 230 const IntSize* progressBarSizes() const; 231 const int* progressBarMargins(NSControlSize) const; 232 #endif 233 228 234 private: 229 235 mutable RetainPtr<NSPopUpButtonCell> m_popupButton; -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r93021 r95757 1 1 /* 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 910 910 911 911 #if ENABLE(PROGRESS_TAG) 912 912 const IntSize* RenderThemeMac::progressBarSizes() const 913 { 914 static const IntSize sizes[3] = { IntSize(0, 20), IntSize(0, 12), IntSize(0, 12) }; 915 return sizes; 916 } 917 918 const int* RenderThemeMac::progressBarMargins(NSControlSize controlSize) const 919 { 920 static const int margins[3][4] = 921 { 922 { 0, 0, 1, 0 }, 923 { 0, 0, 1, 0 }, 924 { 0, 0, 1, 0 }, 925 }; 926 return margins[controlSize]; 927 } 928 929 int RenderThemeMac::minimumProgressBarHeight(RenderStyle* style) const 930 { 931 return sizeForSystemFont(style, progressBarSizes()).height(); 932 } 933 913 934 double RenderThemeMac::animationRepeatIntervalForProgressBar(RenderProgress*) const 914 935 { … … 930 951 return true; 931 952 953 float zoomLevel = renderObject->style()->effectiveZoom(); 954 int controlSize = controlSizeForFont(renderObject->style()); 955 IntSize size = progressBarSizes()[controlSize]; 956 size.setHeight(size.height() * zoomLevel); 957 size.setWidth(rect.width()); 958 959 // Now inflate it to account for the shadow. 960 IntRect inflatedRect = rect; 961 if (rect.height() <= minimumProgressBarHeight(renderObject->style())) 962 inflatedRect = inflateRect(inflatedRect, size, progressBarMargins(controlSize), zoomLevel); 963 932 964 RenderProgress* renderProgress = toRenderProgress(renderObject); 933 965 HIThemeTrackDrawInfo trackInfo; 934 966 trackInfo.version = 0; 935 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndeterminateBar : kThemeLargeProgressBar; 936 trackInfo.bounds = IntRect(IntPoint(), rect.size()); 967 if (controlSize == NSRegularControlSize) 968 trackInfo.kind = renderProgress->position() < 0 ? kThemeLargeIndeterminateBar : kThemeLargeProgressBar; 969 else 970 trackInfo.kind = renderProgress->position() < 0 ? kThemeMediumIndeterminateBar : kThemeMediumProgressBar; 971 972 trackInfo.bounds = IntRect(IntPoint(), inflatedRect.size()); 937 973 trackInfo.min = 0; 938 974 trackInfo.max = numeric_limits<SInt32>::max(); … … 944 980 trackInfo.filler1 = 0; 945 981 946 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create( rect.size());982 OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(inflatedRect.size()); 947 983 if (!imageBuffer) 948 984 return true; … … 955 991 956 992 if (!renderProgress->style()->isLeftToRightDirection()) { 957 paintInfo.context->translate(2 * rect.x() + rect.width(), 0);993 paintInfo.context->translate(2 * inflatedRect.x() + inflatedRect.width(), 0); 958 994 paintInfo.context->scale(FloatSize(-1, 1)); 959 995 } 960 996 961 paintInfo.context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, rect.location());997 paintInfo.context->drawImageBuffer(imageBuffer.get(), ColorSpaceDeviceRGB, inflatedRect.location()); 962 998 return false; 963 999 }
Note: See TracChangeset
for help on using the changeset viewer.