Title: [198191] trunk/Source/WebCore
- Revision
- 198191
- Author
- [email protected]
- Date
- 2016-03-14 21:01:39 -0700 (Mon, 14 Mar 2016)
Log Message
<attachment> on iOS should paint its progress indicator instead of a green square
https://bugs.webkit.org/show_bug.cgi?id=155482
<rdar://problem/24805991>
Reviewed by Simon Fraser.
No new tests; there are existing tests that will be enabled shortly.
* rendering/RenderThemeIOS.mm:
(WebCore::getAttachmentProgress):
Clamp progress to 0-1.
(WebCore::paintAttachmentProgress):
Paint a pie.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (198190 => 198191)
--- trunk/Source/WebCore/ChangeLog 2016-03-15 03:53:21 UTC (rev 198190)
+++ trunk/Source/WebCore/ChangeLog 2016-03-15 04:01:39 UTC (rev 198191)
@@ -1,3 +1,20 @@
+2016-03-14 Tim Horton <[email protected]>
+
+ <attachment> on iOS should paint its progress indicator instead of a green square
+ https://bugs.webkit.org/show_bug.cgi?id=155482
+ <rdar://problem/24805991>
+
+ Reviewed by Simon Fraser.
+
+ No new tests; there are existing tests that will be enabled shortly.
+
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::getAttachmentProgress):
+ Clamp progress to 0-1.
+
+ (WebCore::paintAttachmentProgress):
+ Paint a pie.
+
2016-03-14 Chris Dumez <[email protected]>
Unreviewed, rolling out r197981.
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (198190 => 198191)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2016-03-15 03:53:21 UTC (rev 198190)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2016-03-15 04:01:39 UTC (rev 198191)
@@ -1340,6 +1340,9 @@
const CGFloat attachmentBorderRadius = 16;
static Color attachmentBorderColor() { return Color(204, 204, 204); }
+static Color attachmentProgressColor() { return Color(222, 222, 222); }
+const CGFloat attachmentProgressBorderThickness = 3;
+
const CGFloat attachmentProgressSize = 36;
const CGFloat attachmentIconSize = 48;
@@ -1475,7 +1478,7 @@
if (progressString.isEmpty())
return NO;
bool validProgress;
- progress = progressString.toFloat(&validProgress);
+ progress = std::max<float>(std::min<float>(progressString.toFloat(&validProgress), 1), 0);
return validProgress;
}
@@ -1586,7 +1589,6 @@
context.drawImage(*iconImage, info.iconRect);
}
-
static void paintAttachmentText(GraphicsContext& context, AttachmentInfo& info)
{
for (const auto& line : info.lines) {
@@ -1604,8 +1606,19 @@
{
GraphicsContextStateSaver saver(context);
- // FIXME: Implement progress indicator.
- context.fillRect(info.progressRect, Color(0, 255, 0));
+ context.setStrokeThickness(attachmentProgressBorderThickness);
+ context.setStrokeColor(attachmentProgressColor());
+ context.setFillColor(attachmentProgressColor());
+ context.strokeEllipse(info.progressRect);
+
+ FloatPoint center = info.progressRect.center();
+
+ Path progressPath;
+ progressPath.moveTo(center);
+ progressPath.addLineTo(FloatPoint(center.x(), info.progressRect.y()));
+ progressPath.addArc(center, info.progressRect.width() / 2, -M_PI_2, info.progress * 2 * M_PI - M_PI_2, 0);
+ progressPath.closeSubpath();
+ context.fillPath(progressPath);
}
static void paintAttachmentBorder(GraphicsContext& context, AttachmentInfo& info)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes