Title: [185116] trunk/Source/WebCore
Revision
185116
Author
ander...@apple.com
Date
2015-06-02 13:00:01 -0700 (Tue, 02 Jun 2015)

Log Message

Move WKFontAntialiasingStateSaver to its own file
https://bugs.webkit.org/show_bug.cgi?id=145557
rdar://problem/21134776

Reviewed by Dan Bernstein.

Also rename it to FontAntialiasingStateSaver. Also, change it to use the CoreGraphicsSPI.h header for its
CGFontAntialiasingStyle definition instead of using an explicit typedef.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayer::drawLayerContents):
* platform/graphics/ios/FontAntialiasingStateSaver.h: Copied from Source/WebCore/platform/ios/wak/WKGraphics.h.
(WebCore::FontAntialiasingStateSaver::FontAntialiasingStateSaver):
(WebCore::FontAntialiasingStateSaver::setup):
(WebCore::FontAntialiasingStateSaver::restore):
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::drawWindowContent):
* platform/ios/wak/WKGraphics.h:
(WKFontAntialiasingStateSaver::WKFontAntialiasingStateSaver): Deleted.
* platform/ios/wak/WKGraphics.mm:
(WKFontAntialiasingStateSaver::setup): Deleted.
(WKFontAntialiasingStateSaver::restore): Deleted.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (185115 => 185116)


--- trunk/Source/WebCore/ChangeLog	2015-06-02 19:40:13 UTC (rev 185115)
+++ trunk/Source/WebCore/ChangeLog	2015-06-02 20:00:01 UTC (rev 185116)
@@ -1,3 +1,29 @@
+2015-06-02  Anders Carlsson  <ander...@apple.com>
+
+        Move WKFontAntialiasingStateSaver to its own file
+        https://bugs.webkit.org/show_bug.cgi?id=145557
+        rdar://problem/21134776
+
+        Reviewed by Dan Bernstein.
+
+        Also rename it to FontAntialiasingStateSaver. Also, change it to use the CoreGraphicsSPI.h header for its
+        CGFontAntialiasingStyle definition instead of using an explicit typedef.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayer::drawLayerContents):
+        * platform/graphics/ios/FontAntialiasingStateSaver.h: Copied from Source/WebCore/platform/ios/wak/WKGraphics.h.
+        (WebCore::FontAntialiasingStateSaver::FontAntialiasingStateSaver):
+        (WebCore::FontAntialiasingStateSaver::setup):
+        (WebCore::FontAntialiasingStateSaver::restore):
+        * platform/ios/LegacyTileCache.mm:
+        (WebCore::LegacyTileCache::drawWindowContent):
+        * platform/ios/wak/WKGraphics.h:
+        (WKFontAntialiasingStateSaver::WKFontAntialiasingStateSaver): Deleted.
+        * platform/ios/wak/WKGraphics.mm:
+        (WKFontAntialiasingStateSaver::setup): Deleted.
+        (WKFontAntialiasingStateSaver::restore): Deleted.
+
 2015-06-02  Xabier Rodriguez Calvar  <calva...@igalia.com> and Youenn Fablet <youenn.fab...@crf.canon.fr>
 
         [Streams API] Implement ReadableStreamReader read method in closed and errored state

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (185115 => 185116)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-02 19:40:13 UTC (rev 185115)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-02 20:00:01 UTC (rev 185116)
@@ -824,6 +824,7 @@
 		1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
 		1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
 		1AC2D845171734A100652FC0 /* Storage.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E3F9C40DA059DC00250911 /* Storage.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		1AC2D89D1B1E291F00D52E87 /* FontAntialiasingStateSaver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2D89C1B1E291F00D52E87 /* FontAntialiasingStateSaver.h */; };
 		1AC69593161A1E53003732CB /* GraphicsLayerFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AC900C31943C0FC008625B5 /* HTTPHeaderNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC900C01943C0A0008625B5 /* HTTPHeaderNames.cpp */; };
 		1ACADD791880D91C00D8B71D /* ProgressTrackerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACADD781880D91C00D8B71D /* ProgressTrackerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7928,6 +7929,7 @@
 		1ABC7108170E5E1B00F9A9D6 /* WorkerNavigatorStorageQuota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerNavigatorStorageQuota.h; sourceTree = "<group>"; };
 		1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMApplicationCache.cpp; sourceTree = "<group>"; };
 		1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMApplicationCache.h; sourceTree = "<group>"; };
+		1AC2D89C1B1E291F00D52E87 /* FontAntialiasingStateSaver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontAntialiasingStateSaver.h; sourceTree = "<group>"; };
 		1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerFactory.h; sourceTree = "<group>"; };
 		1AC900BF1943AF3D008625B5 /* HTTPHeaderNames.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = HTTPHeaderNames.in; sourceTree = "<group>"; };
 		1AC900C01943C0A0008625B5 /* HTTPHeaderNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPHeaderNames.cpp; sourceTree = "<group>"; };
@@ -16017,6 +16019,7 @@
 			children = (
 				2D29ECC9192F1F1D00984B78 /* DisplayRefreshMonitorIOS.h */,
 				0F97A657155DA81E00FADD4C /* DisplayRefreshMonitorIOS.mm */,
+				1AC2D89C1B1E291F00D52E87 /* FontAntialiasingStateSaver.h */,
 				3727DFD4142AAE4500D449CB /* FontCacheIOS.mm */,
 				C58361A71744523F00173511 /* FontServicesIOS.h */,
 				C58361A81744523F00173511 /* FontServicesIOS.mm */,
@@ -24406,6 +24409,7 @@
 				D359D791129CA3C00006E5D2 /* DOMHTMLDetailsElement.h in Headers */,
 				D359D793129CA3C00006E5D2 /* DOMHTMLDetailsElementInternal.h in Headers */,
 				85BA4D0B0AA688680088052D /* DOMHTMLDirectoryElement.h in Headers */,
+				1AC2D89D1B1E291F00D52E87 /* FontAntialiasingStateSaver.h in Headers */,
 				85E711A30AC5D5350053270F /* DOMHTMLDirectoryElementInternal.h in Headers */,
 				85BA4D0D0AA688680088052D /* DOMHTMLDivElement.h in Headers */,
 				85E711A40AC5D5350053270F /* DOMHTMLDivElementInternal.h in Headers */,

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (185115 => 185116)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2015-06-02 19:40:13 UTC (rev 185115)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2015-06-02 20:00:01 UTC (rev 185116)
@@ -29,6 +29,7 @@
 
 #import "AnimationUtilities.h"
 #import "BlockExceptions.h"
+#import "FontAntialiasingStateSaver.h"
 #import "GraphicsContext.h"
 #import "GraphicsLayerCA.h"
 #import "LengthFunctions.h"
@@ -1037,7 +1038,7 @@
     ASSERT(layerContents->platformCALayerContentsOrientation() == GraphicsLayer::CompositingCoordinatesTopDown);
     
 #if PLATFORM(IOS)
-    WKFontAntialiasingStateSaver fontAntialiasingState(context, [platformCALayer->platformLayer() isOpaque]);
+    FontAntialiasingStateSaver fontAntialiasingState(context, [platformCALayer->platformLayer() isOpaque]);
     fontAntialiasingState.setup([WAKWindow hasLandscapeOrientation]);
 #else
     [NSGraphicsContext saveGraphicsState];

Copied: trunk/Source/WebCore/platform/graphics/ios/FontAntialiasingStateSaver.h (from rev 185115, trunk/Source/WebCore/platform/ios/wak/WKGraphics.h) (0 => 185116)


--- trunk/Source/WebCore/platform/graphics/ios/FontAntialiasingStateSaver.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ios/FontAntialiasingStateSaver.h	2015-06-02 20:00:01 UTC (rev 185116)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2005, 2006, 2007, 2009, 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FontAntialiasingStateSaver_h
+#define FontAntialiasingStateSaver_h
+
+#if PLATFORM(IOS)
+
+#import "CoreGraphicsSPI.h"
+
+namespace WebCore {
+
+class FontAntialiasingStateSaver {
+public:
+    FontAntialiasingStateSaver(CGContextRef context, bool useOrientationDependentFontAntialiasing)
+#if !PLATFORM(IOS_SIMULATOR)
+        : m_context(context)
+        , m_useOrientationDependentFontAntialiasing(useOrientationDependentFontAntialiasing)
+#endif
+    {
+#if PLATFORM(IOS_SIMULATOR)
+        UNUSED_PARAM(context);
+        UNUSED_PARAM(useOrientationDependentFontAntialiasing);
+#endif
+    }
+
+    void setup(bool isLandscapeOrientation)
+    {
+#if !PLATFORM(IOS_SIMULATOR)
+    m_oldAntialiasingStyle = CGContextGetFontAntialiasingStyle(m_context);
+
+    if (m_useOrientationDependentFontAntialiasing)
+        CGContextSetFontAntialiasingStyle(m_context, isLandscapeOrientation ? kCGFontAntialiasingStyleFilterLight : kCGFontAntialiasingStyleUnfiltered);
+#else
+    UNUSED_PARAM(isLandscapeOrientation);
+#endif
+    }
+
+    void restore()
+    {
+#if !PLATFORM(IOS_SIMULATOR)
+        if (m_useOrientationDependentFontAntialiasing)
+            CGContextSetFontAntialiasingStyle(m_context, m_oldAntialiasingStyle);
+#endif
+    }
+
+private:
+#if !PLATFORM(IOS_SIMULATOR)
+    CGContextRef m_context;
+    bool m_useOrientationDependentFontAntialiasing;
+    CGFontAntialiasingStyle m_oldAntialiasingStyle;
+#endif
+};
+
+}
+
+#endif
+
+#endif // FontAntialiasingStateSaver_h

Modified: trunk/Source/WebCore/platform/ios/LegacyTileCache.mm (185115 => 185116)


--- trunk/Source/WebCore/platform/ios/LegacyTileCache.mm	2015-06-02 19:40:13 UTC (rev 185115)
+++ trunk/Source/WebCore/platform/ios/LegacyTileCache.mm	2015-06-02 20:00:01 UTC (rev 185116)
@@ -28,7 +28,7 @@
 
 #if PLATFORM(IOS)
 
-#include "CoreGraphicsSPI.h"
+#include "FontAntialiasingStateSaver.h"
 #include "LegacyTileGrid.h"
 #include "LegacyTileGridTile.h"
 #include "LegacyTileLayer.h"
@@ -514,7 +514,7 @@
 void LegacyTileCache::drawWindowContent(LegacyTileLayer* layer, CGContextRef context, CGRect dirtyRect)
 {
     CGRect frame = [layer frame];
-    WKFontAntialiasingStateSaver fontAntialiasingState(context, [m_window useOrientationDependentFontAntialiasing] && [layer isOpaque]);
+    FontAntialiasingStateSaver fontAntialiasingState(context, [m_window useOrientationDependentFontAntialiasing] && [layer isOpaque]);
     fontAntialiasingState.setup([WAKWindow hasLandscapeOrientation]);
 
     CGSRegionObj drawRegion = (CGSRegionObj)[layer regionBeingDrawn];

Modified: trunk/Source/WebCore/platform/ios/wak/WKGraphics.h (185115 => 185116)


--- trunk/Source/WebCore/platform/ios/wak/WKGraphics.h	2015-06-02 19:40:13 UTC (rev 185115)
+++ trunk/Source/WebCore/platform/ios/wak/WKGraphics.h	2015-06-02 20:00:01 UTC (rev 185116)
@@ -31,7 +31,6 @@
 #import <CoreGraphics/CoreGraphics.h>
 
 typedef int WKCompositeOperation;
-typedef uint32_t CGFontAntialiasingStyle;
 
 #ifdef __cplusplus
 extern "C" {
@@ -51,37 +50,6 @@
 }
 #endif
 
-#ifdef __cplusplus
-class WKFontAntialiasingStateSaver
-{
-public:
-
-    WKFontAntialiasingStateSaver(CGContextRef context, bool useOrientationDependentFontAntialiasing)
-        : m_context(context)
-        , m_useOrientationDependentFontAntialiasing(useOrientationDependentFontAntialiasing)
-    {
-    }
-
-    void setup(bool isLandscapeOrientation);
-    void restore();
-
-private:
-
-#if TARGET_IPHONE_SIMULATOR
-#pragma clang diagnostic push
-#if defined(__has_warning) && __has_warning("-Wunused-private-field")
-#pragma clang diagnostic ignored "-Wunused-private-field"
-#endif
-#endif
-    CGContextRef m_context;
-    bool m_useOrientationDependentFontAntialiasing;
-    CGFontAntialiasingStyle m_oldAntialiasingStyle;
-#if TARGET_IPHONE_SIMULATOR
-#pragma clang diagnostic pop
-#endif
-};
-#endif
-
 #endif // TARGET_OS_IPHONE
 
 #endif // WKGraphics_h

Modified: trunk/Source/WebCore/platform/ios/wak/WKGraphics.mm (185115 => 185116)


--- trunk/Source/WebCore/platform/ios/wak/WKGraphics.mm	2015-06-02 19:40:13 UTC (rev 185115)
+++ trunk/Source/WebCore/platform/ios/wak/WKGraphics.mm	2015-06-02 20:00:01 UTC (rev 185116)
@@ -172,24 +172,4 @@
     CGColorSpaceRelease(colorspace);
 }
 
-void WKFontAntialiasingStateSaver::setup(bool isLandscapeOrientation)
-{
-#if !PLATFORM(IOS_SIMULATOR)
-    m_oldAntialiasingStyle = CGContextGetFontAntialiasingStyle(m_context);
-
-    if (m_useOrientationDependentFontAntialiasing)
-        CGContextSetFontAntialiasingStyle(m_context, isLandscapeOrientation ? kCGFontAntialiasingStyleFilterLight : kCGFontAntialiasingStyleUnfiltered);
-#else
-    UNUSED_PARAM(isLandscapeOrientation);
-#endif
-}
-
-void WKFontAntialiasingStateSaver::restore()
-{
-#if !PLATFORM(IOS_SIMULATOR)
-    if (m_useOrientationDependentFontAntialiasing)
-        CGContextSetFontAntialiasingStyle(m_context, m_oldAntialiasingStyle);
-#endif
-}
-
 #endif // PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to