Changeset 181114 in webkit
- Timestamp:
- Mar 5, 2015 4:34:25 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r181107 r181114 1 2015-03-05 Timothy Horton <timothy_horton@apple.com> 2 3 <attachment> should support indication of download progress 4 https://bugs.webkit.org/show_bug.cgi?id=142336 5 <rdar://problem/19982504> 6 7 Reviewed by Anders Carlsson. 8 9 * fast/attachment/attachment-progress.html: Added. 10 * platform/mac/fast/attachment/attachment-progress-expected.png: Added. 11 * platform/mac/fast/attachment/attachment-progress-expected.txt: Added. 12 * platform/mac-mavericks/fast/attachment/attachment-progress-expected.txt: Added. 13 Add a test for the <attachment> progress attribute. 14 15 * platform/mac/fast/attachment/attachment-rendering-expected.png: 16 Rebaseline a test that changed in r181058 (and will change again!), but 17 which didn't start failing because the pixel test tolerance is such that 18 it only fails the hash check and not the test itself. 19 1 20 2015-03-05 Benjamin Poulain <bpoulain@apple.com> 2 21 -
trunk/Source/WebCore/ChangeLog
r181111 r181114 1 2015-03-05 Timothy Horton <timothy_horton@apple.com> 2 3 <attachment> should support indication of download progress 4 https://bugs.webkit.org/show_bug.cgi?id=142336 5 <rdar://problem/19982504> 6 7 Reviewed by Anders Carlsson. 8 9 * html/HTMLAttachmentElement.cpp: 10 (WebCore::HTMLAttachmentElement::parseAttribute): 11 Invalidate the attachment if the progress attribute changes. 12 13 * platform/graphics/FloatRoundedRect.h: 14 (WebCore::FloatRoundedRect::Radii::Radii): 15 Add a Radii constructor that takes a single argument that is used 16 as the radius for all corners, for convenience. 17 18 * rendering/RenderThemeMac.mm: 19 (WebCore::attachmentProgressBarBackgroundColor): 20 (WebCore::attachmentProgressBarFillColor): 21 (WebCore::attachmentProgressBarBorderColor): 22 Add a bunch of constants for the progress bar. 23 24 (WebCore::paintAttachmentIconBackground): 25 Make use of fillRoundedRect instead of creating a path. 26 27 (WebCore::paintAttachmentProgress): 28 (WebCore::RenderThemeMac::paintAttachment): 29 Paint a progress bar if the progress attribute exists and 30 is a valid floating point number. 31 1 32 2015-03-05 Commit Queue <commit-queue@webkit.org> 2 33 -
trunk/Source/WebCore/html/HTMLAttachmentElement.cpp
r181056 r181114 75 75 void HTMLAttachmentElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 76 76 { 77 if ( name == subtitleAttr&& is<RenderAttachment>(renderer())) {77 if ((name == progressAttr || name == subtitleAttr) && is<RenderAttachment>(renderer())) { 78 78 downcast<RenderAttachment>(*renderer()).invalidate(); 79 79 return; -
trunk/Source/WebCore/platform/graphics/FloatRoundedRect.h
r177739 r181114 55 55 , m_bottomLeft(intRadii.bottomLeft()) 56 56 , m_bottomRight(intRadii.bottomRight()) 57 { 58 } 59 60 explicit Radii(float uniformRadius) 61 : m_topLeft(uniformRadius, uniformRadius) 62 , m_topRight(uniformRadius, uniformRadius) 63 , m_bottomLeft(uniformRadius, uniformRadius) 64 , m_bottomRight(uniformRadius, uniformRadius) 57 65 { 58 66 } -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r181058 r181114 2095 2095 static Color attachmentSubtitleTextColor() { return Color(82, 145, 214, 255); } 2096 2096 2097 const CGFloat attachmentProgressBarWidth = 30; 2098 const CGFloat attachmentProgressBarHeight = 5; 2099 const CGFloat attachmentProgressBarOffset = -9; 2100 const CGFloat attachmentProgressBarBorderWidth = 1; 2101 static Color attachmentProgressBarBackgroundColor() { return Color(0, 0, 0, 89); } 2102 static Color attachmentProgressBarFillColor() { return Color(Color::white); } 2103 static Color attachmentProgressBarBorderColor() { return Color(0, 0, 0, 128); } 2104 2097 2105 const CGFloat attachmentMargin = 3; 2098 2106 … … 2301 2309 backgroundRect.inflate(-attachmentIconSelectionBorderThickness); 2302 2310 2303 FloatSize iconBackgroundRadiusSize(attachmentIconBackgroundRadius, attachmentIconBackgroundRadius); 2304 2305 Path backgroundPath; 2306 backgroundPath.addRoundedRect(backgroundRect, iconBackgroundRadiusSize); 2307 context.setFillColor(attachmentIconBackgroundColor(), ColorSpaceDeviceRGB); 2308 context.fillPath(backgroundPath); 2311 context.fillRoundedRect(FloatRoundedRect(backgroundRect, FloatRoundedRect::Radii(attachmentIconBackgroundRadius)), attachmentIconBackgroundColor(), ColorSpaceDeviceRGB); 2309 2312 2310 2313 if (paintBorder) { … … 2312 2315 borderRect.inflate(-attachmentIconSelectionBorderThickness / 2); 2313 2316 2317 FloatSize iconBackgroundRadiusSize(attachmentIconBackgroundRadius, attachmentIconBackgroundRadius); 2314 2318 Path borderPath; 2315 2319 borderPath.addRoundedRect(borderRect, iconBackgroundRadiusSize); … … 2495 2499 } 2496 2500 2501 static void paintAttachmentProgress(const RenderAttachment& attachment, GraphicsContext& context, AttachmentLayout& layout) 2502 { 2503 String progressString = attachment.attachmentElement().fastGetAttribute(progressAttr); 2504 if (progressString.isEmpty()) 2505 return; 2506 bool validProgress; 2507 float progress = progressString.toFloat(&validProgress); 2508 if (!validProgress) 2509 return; 2510 2511 GraphicsContextStateSaver saver(context); 2512 2513 FloatRect progressBounds((attachmentIconBackgroundSize - attachmentProgressBarWidth) / 2, layout.iconBackgroundRect.maxY() + attachmentProgressBarOffset - attachmentProgressBarHeight, attachmentProgressBarWidth, attachmentProgressBarHeight); 2514 2515 FloatRect borderRect = progressBounds; 2516 borderRect.inflate(-0.5); 2517 FloatRect backgroundRect = borderRect; 2518 backgroundRect.inflate(-attachmentProgressBarBorderWidth / 2); 2519 2520 FloatRoundedRect backgroundRoundedRect(backgroundRect, FloatRoundedRect::Radii(backgroundRect.height() / 2)); 2521 context.fillRoundedRect(backgroundRoundedRect, attachmentProgressBarBackgroundColor(), ColorSpaceDeviceRGB); 2522 2523 { 2524 GraphicsContextStateSaver clipSaver(context); 2525 context.clipRoundedRect(backgroundRoundedRect); 2526 2527 FloatRect progressRect = progressBounds; 2528 progressRect.setWidth(progressRect.width() * progress); 2529 progressRect = encloseRectToDevicePixels(progressRect, attachment.document().deviceScaleFactor()); 2530 2531 context.fillRect(progressRect, attachmentProgressBarFillColor(), ColorSpaceDeviceRGB); 2532 } 2533 2534 Path borderPath; 2535 float borderRadius = borderRect.height() / 2; 2536 borderPath.addRoundedRect(borderRect, FloatSize(borderRadius, borderRadius)); 2537 context.setStrokeColor(attachmentProgressBarBorderColor(), ColorSpaceDeviceRGB); 2538 context.setStrokeThickness(attachmentProgressBarBorderWidth); 2539 context.strokePath(borderPath); 2540 } 2541 2497 2542 bool RenderThemeMac::paintAttachment(const RenderObject& renderer, const PaintInfo& paintInfo, const IntRect& paintRect) 2498 2543 { … … 2520 2565 paintAttachmentTitle(attachment, context, layout); 2521 2566 paintAttachmentSubtitle(attachment, context, layout); 2567 paintAttachmentProgress(attachment, context, layout); 2522 2568 2523 2569 return true;
Note: See TracChangeset
for help on using the changeset viewer.