Title: [249507] trunk
Revision
249507
Author
[email protected]
Date
2019-09-04 18:02:17 -0700 (Wed, 04 Sep 2019)

Log Message

Line artifacts in note body after viewing note with <attachment>s
https://bugs.webkit.org/show_bug.cgi?id=201474
<rdar://problem/51306108>

Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/attachment/attachment-border-should-stay-inside-attachment.html

* rendering/RenderThemeIOS.mm:
(WebCore::attachmentBorderPath):
(WebCore::paintAttachmentBorder):
Inset the border rect by half the width, so that <attachment> doesn't
paint out-of-bounds.

LayoutTests:

* fast/attachment/attachment-border-should-stay-inside-attachment-expected.html: Added.
* fast/attachment/attachment-border-should-stay-inside-attachment.html: Added.
Add a test that ensures that <attachment> stays inside its bounds.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (249506 => 249507)


--- trunk/LayoutTests/ChangeLog	2019-09-05 00:47:32 UTC (rev 249506)
+++ trunk/LayoutTests/ChangeLog	2019-09-05 01:02:17 UTC (rev 249507)
@@ -1,3 +1,15 @@
+2019-09-04  Tim Horton  <[email protected]>
+
+        Line artifacts in note body after viewing note with <attachment>s
+        https://bugs.webkit.org/show_bug.cgi?id=201474
+        <rdar://problem/51306108>
+
+        Reviewed by Simon Fraser.
+
+        * fast/attachment/attachment-border-should-stay-inside-attachment-expected.html: Added.
+        * fast/attachment/attachment-border-should-stay-inside-attachment.html: Added.
+        Add a test that ensures that <attachment> stays inside its bounds.
+
 2019-09-04  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Local Overrides - Provide substitution content for resource loads (URL based)

Added: trunk/LayoutTests/fast/attachment/attachment-border-should-stay-inside-attachment-expected.html ( => )


Added: trunk/LayoutTests/fast/attachment/attachment-border-should-stay-inside-attachment.html
===================================================================
--- trunk/LayoutTests/fast/attachment/attachment-border-should-stay-inside-attachment.html	                        (rev 0)
+++ trunk/LayoutTests/fast/attachment/attachment-border-should-stay-inside-attachment.html	2019-09-05 01:02:17 UTC (rev 249507)
@@ -0,0 +1,58 @@
+<!DOCTYPE html><!-- webkit-test-runner [ enableAttachmentElement=true ] -->
+<html>
+<style>
+    attachment {
+        position: absolute;
+    }
+    div {
+        background-color: white;
+        width: 200px;
+        height: 200px;
+        position: absolute;
+    }
+</style>
+<body>
+<attachment style="top: 0px; left: 0px;"></attachment>
+<div style="top: 0px; left: 0px;"></div>
+<attachment style="top: 1px; left: 1px;"></attachment>
+<div style="top: 1px; left: 1px;"></div>
+<attachment style="top: 2px; left: 2px;"></attachment>
+<div style="top: 2px; left: 2px;"></div>
+<attachment style="top: 3px; left: 3px;"></attachment>
+<div style="top: 3px; left: 3px;"></div>
+<attachment style="top: 4px; left: 4px;"></attachment>
+<div style="top: 4px; left: 4px;"></div>
+<attachment style="top: 5px; left: 5px;"></attachment>
+<div style="top: 5px; left: 5px;"></div>
+<attachment style="top: 6px; left: 6px;"></attachment>
+<div style="top: 6px; left: 6px;"></div>
+<attachment style="top: 7px; left: 7px;"></attachment>
+<div style="top: 7px; left: 7px;"></div>
+<attachment style="top: 8px; left: 8px;"></attachment>
+<div style="top: 8px; left: 8px;"></div>
+<attachment style="top: 9px; left: 9px;"></attachment>
+<div style="top: 9px; left: 9px;"></div>
+<attachment style="top: 10px; left: 10px;"></attachment>
+<div style="top: 10px; left: 10px;"></div>
+<attachment style="top: 11px; left: 11px;"></attachment>
+<div style="top: 11px; left: 11px;"></div>
+<attachment style="top: 12px; left: 12px;"></attachment>
+<div style="top: 12px; left: 12px;"></div>
+<attachment style="top: 13px; left: 13px;"></attachment>
+<div style="top: 13px; left: 13px;"></div>
+<attachment style="top: 14px; left: 14px;"></attachment>
+<div style="top: 14px; left: 14px;"></div>
+<attachment style="top: 15px; left: 15px;"></attachment>
+<div style="top: 15px; left: 15px;"></div>
+<attachment style="top: 16px; left: 16px;"></attachment>
+<div style="top: 16px; left: 16px;"></div>
+<attachment style="top: 17px; left: 17px;"></attachment>
+<div style="top: 17px; left: 17px;"></div>
+<attachment style="top: 18px; left: 18px;"></attachment>
+<div style="top: 18px; left: 18px;"></div>
+<attachment style="top: 19px; left: 19px;"></attachment>
+<div style="top: 19px; left: 19px;"></div>
+<attachment style="top: 20px; left: 20px;"></attachment>
+<div style="top: 20px; left: 20px;"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (249506 => 249507)


--- trunk/Source/WebCore/ChangeLog	2019-09-05 00:47:32 UTC (rev 249506)
+++ trunk/Source/WebCore/ChangeLog	2019-09-05 01:02:17 UTC (rev 249507)
@@ -1,3 +1,19 @@
+2019-09-04  Tim Horton  <[email protected]>
+
+        Line artifacts in note body after viewing note with <attachment>s
+        https://bugs.webkit.org/show_bug.cgi?id=201474
+        <rdar://problem/51306108>
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/attachment/attachment-border-should-stay-inside-attachment.html
+
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::attachmentBorderPath):
+        (WebCore::paintAttachmentBorder):
+        Inset the border rect by half the width, so that <attachment> doesn't
+        paint out-of-bounds.
+
 2019-09-04  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Local Overrides - Provide substitution content for resource loads (URL based)

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (249506 => 249507)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2019-09-05 00:47:32 UTC (rev 249506)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm	2019-09-05 01:02:17 UTC (rev 249507)
@@ -1529,6 +1529,7 @@
 
 const CGFloat attachmentBorderRadius = 16;
 static Color attachmentBorderColor() { return Color(204, 204, 204); }
+static CGFloat attachmentBorderThickness = 1;
 
 static Color attachmentProgressColor() { return Color(222, 222, 222); }
 const CGFloat attachmentProgressBorderThickness = 3;
@@ -1839,8 +1840,11 @@
 
 static Path attachmentBorderPath(RenderAttachmentInfo& info)
 {
+    auto insetAttachmentRect = info.attachmentRect;
+    insetAttachmentRect.inflate(-attachmentBorderThickness / 2);
+
     Path borderPath;
-    borderPath.addRoundedRect(info.attachmentRect, FloatSize(attachmentBorderRadius, attachmentBorderRadius));
+    borderPath.addRoundedRect(insetAttachmentRect, FloatSize(attachmentBorderRadius, attachmentBorderRadius));
     return borderPath;
 }
 
@@ -1847,7 +1851,7 @@
 static void paintAttachmentBorder(GraphicsContext& context, Path& borderPath)
 {
     context.setStrokeColor(attachmentBorderColor());
-    context.setStrokeThickness(1);
+    context.setStrokeThickness(attachmentBorderThickness);
     context.strokePath(borderPath);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to