Title: [237691] trunk
Revision
237691
Author
commit-qu...@webkit.org
Date
2018-11-01 11:49:13 -0700 (Thu, 01 Nov 2018)

Log Message

[CG] Adopt CG SPI for non-even cornered rounded rects
https://bugs.webkit.org/show_bug.cgi?id=190155

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2018-11-01
Reviewed by Simon Fraser.

Source/WebCore:

Instead of creating bezier curves for the non-even corners of the rounded
rects, we should use the optimized SPI provided by CG.

* platform/graphics/cg/PathCG.cpp:
(WebCore::Path::platformAddPathForRoundedRect):

Source/WebCore/PAL:

* pal/spi/cg/CoreGraphicsSPI.h:

LayoutTests:

This test fails on iOS simulator because of just one pixel difference
between drawing a shadow of the element and drawing a copy of the element.
This failure happens on iOS and does not happen on macOS because we don't
use accelerated drawing for macOS testing but we use it for iOS testing.

* platform/ios/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (237690 => 237691)


--- trunk/LayoutTests/ChangeLog	2018-11-01 18:32:33 UTC (rev 237690)
+++ trunk/LayoutTests/ChangeLog	2018-11-01 18:49:13 UTC (rev 237691)
@@ -1,3 +1,17 @@
+2018-11-01  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        [CG] Adopt CG SPI for non-even cornered rounded rects
+        https://bugs.webkit.org/show_bug.cgi?id=190155
+
+        Reviewed by Simon Fraser.
+
+        This test fails on iOS simulator because of just one pixel difference
+        between drawing a shadow of the element and drawing a copy of the element.
+        This failure happens on iOS and does not happen on macOS because we don't 
+        use accelerated drawing for macOS testing but we use it for iOS testing.
+
+        * platform/ios/TestExpectations:
+
 2018-11-01  Chris Dumez  <cdu...@apple.com>
 
         [PSON] Unable to submit a file in FormData cross-site

Modified: trunk/LayoutTests/platform/ios/TestExpectations (237690 => 237691)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-11-01 18:32:33 UTC (rev 237690)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-11-01 18:49:13 UTC (rev 237691)
@@ -1936,6 +1936,7 @@
 fast/borders/0px-borders.html
 fast/box-decoration-break/box-decoration-break-rendering.html
 fast/box-shadow/border-radius-big.html
+fast/box-shadow/box-shadow-with-zero-radius.html [ ImageOnlyFailure ]
 
 # <rdar://problem/19226186> ASSERT(m_mainThreadLoader) fails in WorkerThreadableLoader::MainThreadBridge::MainThreadBridge()
 fast/workers/stress-js-execution.html

Modified: trunk/Source/WebCore/ChangeLog (237690 => 237691)


--- trunk/Source/WebCore/ChangeLog	2018-11-01 18:32:33 UTC (rev 237690)
+++ trunk/Source/WebCore/ChangeLog	2018-11-01 18:49:13 UTC (rev 237691)
@@ -1,3 +1,16 @@
+2018-11-01  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        [CG] Adopt CG SPI for non-even cornered rounded rects
+        https://bugs.webkit.org/show_bug.cgi?id=190155
+
+        Reviewed by Simon Fraser.
+
+        Instead of creating bezier curves for the non-even corners of the rounded
+        rects, we should use the optimized SPI provided by CG.
+
+        * platform/graphics/cg/PathCG.cpp:
+        (WebCore::Path::platformAddPathForRoundedRect):
+
 2018-11-01  Youenn Fablet  <you...@apple.com>
 
         RTCTrackEvent.streams should be SameObject

Modified: trunk/Source/WebCore/PAL/ChangeLog (237690 => 237691)


--- trunk/Source/WebCore/PAL/ChangeLog	2018-11-01 18:32:33 UTC (rev 237690)
+++ trunk/Source/WebCore/PAL/ChangeLog	2018-11-01 18:49:13 UTC (rev 237691)
@@ -1,3 +1,12 @@
+2018-11-01  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        [CG] Adopt CG SPI for non-even cornered rounded rects
+        https://bugs.webkit.org/show_bug.cgi?id=190155
+
+        Reviewed by Simon Fraser.
+
+        * pal/spi/cg/CoreGraphicsSPI.h:
+
 2018-10-30  Alexey Proskuryakov  <a...@apple.com>
 
         Clean up some obsolete MAX_ALLOWED macros

Modified: trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h (237690 => 237691)


--- trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2018-11-01 18:32:33 UTC (rev 237690)
+++ trunk/Source/WebCore/PAL/pal/spi/cg/CoreGraphicsSPI.h	2018-11-01 18:49:13 UTC (rev 237691)
@@ -281,7 +281,11 @@
 void CGContextSetStyle(CGContextRef, CGStyleRef);
 
 void CGContextDrawConicGradient(CGContextRef, CGGradientRef, CGPoint center, CGFloat angle);
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
+void CGPathAddUnevenCornersRoundedRect(CGMutablePathRef, const CGAffineTransform *, CGRect, const CGSize corners[4]);
 #endif
+#endif
 
 #if PLATFORM(WIN)
 CGFontCache* CGFontCacheGetLocalCache();

Modified: trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp (237690 => 237691)


--- trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2018-11-01 18:32:33 UTC (rev 237690)
+++ trunk/Source/WebCore/platform/graphics/cg/PathCG.cpp	2018-11-01 18:49:13 UTC (rev 237691)
@@ -318,7 +318,14 @@
         CGPathAddRoundedRect(ensurePlatformPath(), nullptr, rectToDraw, radiusWidth, radiusHeight);
         return;
     }
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000)
+    CGRect rectToDraw = rect;
+    CGSize corners[4] = { bottomLeftRadius, bottomRightRadius, topRightRadius, topLeftRadius };
+    CGPathAddUnevenCornersRoundedRect(ensurePlatformPath(), nullptr, rectToDraw, corners);
+    return;
 #endif
+#endif
 
     addBeziersForRoundedRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to