Title: [191466] trunk/Source
Revision
191466
Author
mmaxfi...@apple.com
Date
2015-10-22 12:50:09 -0700 (Thu, 22 Oct 2015)

Log Message

[Cocoa] Migrate WKSetPatternPhaseInUserSpace() and WKGetUserToBaseCTM() from WKSI
https://bugs.webkit.org/show_bug.cgi?id=150460

Reviewed by Tim Horton.

Source/WebCore:

No reason to use WKSI for these calls.

No new tests because there is no behavior change.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::applyStrokePattern):
(WebCore::GraphicsContext::applyFillPattern):
(WebCore::GraphicsContext::setPlatformShadow):
* platform/graphics/cg/GraphicsContextCG.h:
(WebCore::getUserToBaseCTM):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::ImageBuffer::putByteArray):
* platform/graphics/mac/GraphicsContextMac.mm:
(WebCore::setPatternPhaseInUserSpace):
(WebCore::GraphicsContext::drawLineForDocumentMarker):
* platform/ios/WebCoreSystemInterfaceIOS.mm:
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:

Source/WebKit/mac:

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Deleted.

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (191465 => 191466)


--- trunk/Source/WebCore/ChangeLog	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/ChangeLog	2015-10-22 19:50:09 UTC (rev 191466)
@@ -1,3 +1,29 @@
+2015-10-22  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Migrate WKSetPatternPhaseInUserSpace() and WKGetUserToBaseCTM() from WKSI
+        https://bugs.webkit.org/show_bug.cgi?id=150460
+
+        Reviewed by Tim Horton.
+
+        No reason to use WKSI for these calls.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::applyStrokePattern):
+        (WebCore::GraphicsContext::applyFillPattern):
+        (WebCore::GraphicsContext::setPlatformShadow):
+        * platform/graphics/cg/GraphicsContextCG.h:
+        (WebCore::getUserToBaseCTM):
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::ImageBuffer::putByteArray):
+        * platform/graphics/mac/GraphicsContextMac.mm:
+        (WebCore::setPatternPhaseInUserSpace):
+        (WebCore::GraphicsContext::drawLineForDocumentMarker):
+        * platform/ios/WebCoreSystemInterfaceIOS.mm:
+        * platform/mac/WebCoreSystemInterface.h:
+        * platform/mac/WebCoreSystemInterface.mm:
+
 2015-10-22  Brady Eidson  <beid...@apple.com>
 
         Modern IDB: Basic createObjectStore implementation.

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (191465 => 191466)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2015-10-22 19:50:09 UTC (rev 191466)
@@ -583,7 +583,7 @@
 void GraphicsContext::applyStrokePattern()
 {
     CGContextRef cgContext = platformContext();
-    AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext));
+    AffineTransform userToBaseCTM = AffineTransform(getUserToBaseCTM(cgContext));
 
     RetainPtr<CGPatternRef> platformPattern = adoptCF(m_state.strokePattern->createPlatformPattern(userToBaseCTM));
     if (!platformPattern)
@@ -599,7 +599,7 @@
 void GraphicsContext::applyFillPattern()
 {
     CGContextRef cgContext = platformContext();
-    AffineTransform userToBaseCTM = AffineTransform(wkGetUserToBaseCTM(cgContext));
+    AffineTransform userToBaseCTM = AffineTransform(getUserToBaseCTM(cgContext));
 
     RetainPtr<CGPatternRef> platformPattern = adoptCF(m_state.fillPattern->createPlatformPattern(userToBaseCTM));
     if (!platformPattern)
@@ -1070,7 +1070,7 @@
     CGContextRef context = platformContext();
 
     if (!m_state.shadowsIgnoreTransforms) {
-        CGAffineTransform userToBaseCTM = wkGetUserToBaseCTM(context);
+        CGAffineTransform userToBaseCTM = getUserToBaseCTM(context);
 
         CGFloat A = userToBaseCTM.a * userToBaseCTM.a + userToBaseCTM.b * userToBaseCTM.b;
         CGFloat B = userToBaseCTM.a * userToBaseCTM.c + userToBaseCTM.b * userToBaseCTM.d;

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h (191465 => 191466)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h	2015-10-22 19:50:09 UTC (rev 191466)
@@ -36,6 +36,11 @@
 WEBCORE_EXPORT CGColorSpaceRef sRGBColorSpaceRef();
 CGColorSpaceRef linearRGBColorSpaceRef();
 
+inline CGAffineTransform getUserToBaseCTM(CGContextRef context)
+{
+    return CGAffineTransformConcat(CGContextGetCTM(context), CGAffineTransformInvert(CGContextGetBaseCTM(context)));
+}
+
 static inline CGColorSpaceRef cachedCGColorSpace(ColorSpace colorSpace)
 {
     switch (colorSpace) {

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (191465 => 191466)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2015-10-22 19:50:09 UTC (rev 191466)
@@ -322,7 +322,7 @@
     CGContextRef destContext = context().platformContext();
     CGContextSaveGState(destContext);
     if (coordinateSystem == LogicalCoordinateSystem)
-        CGContextConcatCTM(destContext, AffineTransform(wkGetUserToBaseCTM(destContext)).inverse());
+        CGContextConcatCTM(destContext, AffineTransform(getUserToBaseCTM(destContext)).inverse());
     else
         CGContextConcatCTM(destContext, AffineTransform(CGContextGetCTM(destContext)).inverse());
     CGContextResetClip(destContext);

Modified: trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm (191465 => 191466)


--- trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm	2015-10-22 19:50:09 UTC (rev 191466)
@@ -155,6 +155,14 @@
     correctionPatternColor = nullptr;
 }
 
+static inline void setPatternPhaseInUserSpace(CGContextRef context, CGPoint phasePoint)
+{
+    CGAffineTransform userToBase = getUserToBaseCTM(context);
+    CGPoint phase = CGPointApplyAffineTransform(phasePoint, userToBase);
+
+    CGContextSetPatternPhase(context, CGSizeMake(phase.x, phase.y));
+}
+
 // WebKit on Mac is a standard platform component, so it must use the standard platform artwork for underline.
 void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float width, DocumentMarkerLineStyle style)
 {
@@ -251,7 +259,7 @@
     
     // FIXME: This code should not use NSGraphicsContext currentContext
     // In order to remove this requirement we will need to use CGPattern instead of NSColor
-    // FIXME: This code should not be using wkSetPatternPhaseInUserSpace, as this approach is wrong
+    // FIXME: This code should not be using setPatternPhaseInUserSpace, as this approach is wrong
     // for transforms.
 
     // Draw underline.
@@ -270,7 +278,7 @@
     WKSetPattern(context, dotPattern, YES, YES);
 #endif
 
-    wkSetPatternPhaseInUserSpace(context, offsetPoint);
+    setPatternPhaseInUserSpace(context, offsetPoint);
 
 #if !PLATFORM(IOS)
     NSRectFillUsingOperation(NSMakeRect(offsetPoint.x(), offsetPoint.y(), width, patternHeight), NSCompositeSourceOver);

Modified: trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (191465 => 191466)


--- trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm	2015-10-22 19:50:09 UTC (rev 191466)
@@ -32,8 +32,6 @@
 WEBCORE_EXPORT void (*wkClearGlyphVector)(void* glyphs);
 WEBCORE_EXPORT OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs);
 WEBCORE_EXPORT NSDate *(*wkGetNSURLResponseLastModifiedDate)(NSURLResponse *response);
-WEBCORE_EXPORT void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
-WEBCORE_EXPORT CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
 WEBCORE_EXPORT bool (*wkCGContextIsPDFContext)(CGContextRef);
 WEBCORE_EXPORT NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*);
 WEBCORE_EXPORT void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (191465 => 191466)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h	2015-10-22 19:50:09 UTC (rev 191466)
@@ -197,8 +197,6 @@
 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
 #endif
 extern void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
-extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint);
-extern CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
 extern bool (*wkCGContextIsPDFContext)(CGContextRef);
 extern unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);
 extern int (*wkGetHTTPRequestPriority)(CFURLRequestRef);

Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (191465 => 191466)


--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm	2015-10-22 19:50:09 UTC (rev 191466)
@@ -76,8 +76,6 @@
 
 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*, BOOL);
 void (*wkSetDragImage)(NSImage*, NSPoint offset);
-void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
-CGAffineTransform (*wkGetUserToBaseCTM)(CGContextRef);
 bool (*wkCGContextIsPDFContext)(CGContextRef);
 void (*wkSetNSURLRequestShouldContentSniff)(NSMutableURLRequest *, BOOL);
 unsigned (*wkInitializeMaximumHTTPConnectionCountPerHost)(unsigned preferredConnectionCount);

Modified: trunk/Source/WebKit/mac/ChangeLog (191465 => 191466)


--- trunk/Source/WebKit/mac/ChangeLog	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-10-22 19:50:09 UTC (rev 191466)
@@ -1,3 +1,13 @@
+2015-10-22  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Migrate WKSetPatternPhaseInUserSpace() and WKGetUserToBaseCTM() from WKSI
+        https://bugs.webkit.org/show_bug.cgi?id=150460
+
+        Reviewed by Tim Horton.
+
+        * WebCoreSupport/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Deleted.
+
 2015-10-21  Carlos Garcia Campos  <cgar...@igalia.com>
 
         NetworkProcess: DNS prefetch happens in the Web Process

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (191465 => 191466)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm	2015-10-22 19:50:09 UTC (rev 191466)
@@ -93,9 +93,7 @@
     INIT(SetHTTPRequestMinimumFastLanePriority);
     INIT(HTTPRequestEnablePipelining);
     INIT(SetNSURLRequestShouldContentSniff);
-    INIT(SetPatternPhaseInUserSpace);
     INIT(CGContextIsPDFContext);
-    INIT(GetUserToBaseCTM);
 #if ENABLE(VIDEO) && !PLATFORM(IOS)
     INIT(QTIncludeOnlyModernMediaFileTypes);
     INIT(QTMovieDisableComponent);

Modified: trunk/Source/WebKit2/ChangeLog (191465 => 191466)


--- trunk/Source/WebKit2/ChangeLog	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-22 19:50:09 UTC (rev 191466)
@@ -1,3 +1,13 @@
+2015-10-22  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        [Cocoa] Migrate WKSetPatternPhaseInUserSpace() and WKGetUserToBaseCTM() from WKSI
+        https://bugs.webkit.org/show_bug.cgi?id=150460
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+        (InitWebCoreSystemInterface): Deleted.
+
 2015-10-22  Alex Christensen  <achristen...@webkit.org>
 
         Initial NSURLSession WebResourceLoader implementation

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (191465 => 191466)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2015-10-22 19:10:15 UTC (rev 191465)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm	2015-10-22 19:50:09 UTC (rev 191466)
@@ -62,7 +62,6 @@
 #if !PLATFORM(IOS)
         INIT(SignedPublicKeyAndChallengeString);
 #endif
-        INIT(GetUserToBaseCTM);
         INIT(GetWebDefaultCFStringEncoding);
         INIT(CGContextIsPDFContext);
 #if !PLATFORM(IOS)
@@ -99,7 +98,6 @@
         INIT(SetHTTPRequestPriority);
         INIT(SetHTTPRequestMinimumFastLanePriority);
         INIT(SetNSURLRequestShouldContentSniff);
-        INIT(SetPatternPhaseInUserSpace);
         INIT(CreatePrivateStorageSession);
         INIT(CopyRequestWithStorageSession);
         INIT(CopyHTTPCookieStorage);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to