Start cleaning up iOS upstreaming #ifs in platform/graphics
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jan 2014 07:16:13 +0000 (07:16 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Jan 2014 07:16:13 +0000 (07:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127641

Reviewed by Sam Weinig.

* platform/graphics/BitmapImage.h:
* platform/graphics/mac/ColorMac.h:
Use USE(APPKIT) instead of PLATFORM(MAC) && !PLATFORM(IOS) for NSImage/getNSImage().

* platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
(WebCore::AVTrackPrivateAVFObjCImpl::label):
* platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
(WebCore::InbandTextTrackPrivateLegacyAVFObjC::label):
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
Remove some code that was only used on OS X on Lion or below.

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::platformInit):
ToT WebKit doesn't build on Lion or earlier anymore, so this code can always run.

* platform/graphics/cg/FloatPointCG.cpp:
* platform/graphics/cg/FloatRectCG.cpp:
* platform/graphics/cg/FloatSizeCG.cpp:
* platform/graphics/cg/GradientCG.cpp:
* platform/graphics/cg/ImageBufferCG.cpp:
* platform/graphics/cg/ImageCG.cpp:
* platform/graphics/cg/IntPointCG.cpp:
* platform/graphics/cg/IntRectCG.cpp:
* platform/graphics/cg/PathCG.cpp:
* platform/graphics/cg/PatternCG.cpp:
* platform/graphics/mac/FontCustomPlatformData.cpp:
Use CoreGraphics/CoreGraphics.h instead of ApplicationServices/ApplicationServices.h
even on Mac, so we can share the include.

* platform/graphics/cg/IntSizeCG.cpp:
Remove a random comment of a style we don't tend to use in WebKit,
and from a file not large enough to need it.

* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::FontPlatformData):
(WebCore::FontPlatformData::setFont):
Remove some more always-true #ifs.

* platform/graphics/mac/WebLayer.mm:
Move a #if'd include out to its own block as per the style guide.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162827 268f45cc-cd09-0410-ab3c-d52691b4dbfc

24 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/BitmapImage.h
Source/WebCore/platform/graphics/Image.h
Source/WebCore/platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm
Source/WebCore/platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/platform/graphics/cg/BitmapImageCG.cpp
Source/WebCore/platform/graphics/cg/FloatPointCG.cpp
Source/WebCore/platform/graphics/cg/FloatRectCG.cpp
Source/WebCore/platform/graphics/cg/FloatSizeCG.cpp
Source/WebCore/platform/graphics/cg/GradientCG.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp
Source/WebCore/platform/graphics/cg/ImageCG.cpp
Source/WebCore/platform/graphics/cg/IntPointCG.cpp
Source/WebCore/platform/graphics/cg/IntRectCG.cpp
Source/WebCore/platform/graphics/cg/IntSizeCG.cpp
Source/WebCore/platform/graphics/cg/PathCG.cpp
Source/WebCore/platform/graphics/cg/PatternCG.cpp
Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm
Source/WebCore/platform/graphics/mac/ColorMac.h
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
Source/WebCore/platform/graphics/mac/ImageMac.mm
Source/WebCore/platform/graphics/mac/WebLayer.mm

index 00fbd3d..d86d246 100644 (file)
@@ -1,3 +1,52 @@
+2014-01-26  Tim Horton  <timothy_horton@apple.com>
+
+        Start cleaning up iOS upstreaming #ifs in platform/graphics
+        https://bugs.webkit.org/show_bug.cgi?id=127641
+
+        Reviewed by Sam Weinig.
+
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/mac/ColorMac.h:
+        Use USE(APPKIT) instead of PLATFORM(MAC) && !PLATFORM(IOS) for NSImage/getNSImage().
+
+        * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
+        (WebCore::AVTrackPrivateAVFObjCImpl::label):
+        * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
+        (WebCore::InbandTextTrackPrivateLegacyAVFObjC::label):
+        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
+        Remove some code that was only used on OS X on Lion or below.
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::platformInit):
+        ToT WebKit doesn't build on Lion or earlier anymore, so this code can always run.
+
+        * platform/graphics/cg/FloatPointCG.cpp:
+        * platform/graphics/cg/FloatRectCG.cpp:
+        * platform/graphics/cg/FloatSizeCG.cpp:
+        * platform/graphics/cg/GradientCG.cpp:
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        * platform/graphics/cg/ImageCG.cpp:
+        * platform/graphics/cg/IntPointCG.cpp:
+        * platform/graphics/cg/IntRectCG.cpp:
+        * platform/graphics/cg/PathCG.cpp:
+        * platform/graphics/cg/PatternCG.cpp:
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        Use CoreGraphics/CoreGraphics.h instead of ApplicationServices/ApplicationServices.h
+        even on Mac, so we can share the include.
+
+        * platform/graphics/cg/IntSizeCG.cpp:
+        Remove a random comment of a style we don't tend to use in WebKit,
+        and from a file not large enough to need it.
+
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::FontPlatformData):
+        (WebCore::FontPlatformData::setFont):
+        Remove some more always-true #ifs.
+
+        * platform/graphics/mac/WebLayer.mm:
+        Move a #if'd include out to its own block as per the style guide.
+
 2014-01-26  David Hyatt  <hyatt@apple.com>
 
         [New Multicolumn] Change the axis property to be a boolean like other isInline checks
index 652188f..c2161b6 100644 (file)
 
 #if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
-#if !PLATFORM(IOS)
+#endif
+
+#if USE(APPKIT)
 OBJC_CLASS NSImage;
-#endif // PLATFORM(IOS)
 #endif
 
 #if PLATFORM(WIN)
@@ -156,11 +157,13 @@ public:
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,
         const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal) override;
 
-#if PLATFORM(MAC)
     // Accessors for native image formats.
-#if !PLATFORM(IOS)
+
+#if USE(APPKIT)
     virtual NSImage* getNSImage() override;
 #endif
+
+#if PLATFORM(MAC)
     virtual CFDataRef getTIFFRepresentation() override;
 #endif
 
@@ -313,10 +316,10 @@ private:
     int m_repetitionsComplete;  // How many repetitions we've finished.
     double m_desiredFrameStartTime;  // The system time at which we hope to see the next call to startAnimation().
 
-#if PLATFORM(MAC)
-#if !PLATFORM(IOS)
+#if USE(APPKIT)
     mutable RetainPtr<NSImage> m_nsImage; // A cached NSImage of frame 0. Only built lazily if someone actually queries for one.
 #endif
+#if USE(CG)
     mutable RetainPtr<CFDataRef> m_tiffRep; // Cached TIFF rep for frame 0.  Only built lazily if someone queries for one.
 #endif
 
index f8d61c9..251f5a4 100644 (file)
@@ -141,10 +141,14 @@ public:
 
     virtual PassNativeImagePtr nativeImageForCurrentFrame() { return 0; }
     virtual ImageOrientation orientationForCurrentFrame() { return ImageOrientation(); }
-    
-#if PLATFORM(MAC)
+
     // Accessors for native image formats.
+
+#if USE(APPKIT)
     virtual NSImage* getNSImage() { return 0; }
+#endif
+
+#if PLATFORM(MAC)
     virtual CFDataRef getTIFFRepresentation() { return 0; }
 #endif
 
index 9e455b4..13ff3c5 100644 (file)
@@ -115,11 +115,7 @@ AtomicString AVTrackPrivateAVFObjCImpl::label() const
         return emptyAtom;
 
     // If possible, return a title in one of the user's preferred languages.
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
     NSArray *titlesForPreferredLanguages = [AVMetadataItem metadataItemsFromArray:titles filteredAndSortedAccordingToPreferredLanguages:[NSLocale preferredLanguages]];
-#else
-    NSArray *titlesForPreferredLanguages = [AVMetadataItem metadataItemsFromArray:titles withLocale:[NSLocale currentLocale]];
-#endif
     if ([titlesForPreferredLanguages count])
         return [[titlesForPreferredLanguages objectAtIndex:0] stringValue];
     return [[titles objectAtIndex:0] stringValue];
index a8df55a..92d1623 100644 (file)
@@ -104,12 +104,8 @@ AtomicString InbandTextTrackPrivateLegacyAVFObjC::label() const
 
     NSArray *titles = [AVMetadataItem metadataItemsFromArray:[[m_playerItemTrack assetTrack] commonMetadata] withKey:AVMetadataCommonKeyTitle keySpace:AVMetadataKeySpaceCommon];
     if ([titles count]) {
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
         // If possible, return a title in one of the user's preferred languages.
         NSArray *titlesForPreferredLanguages = [AVMetadataItem metadataItemsFromArray:titles filteredAndSortedAccordingToPreferredLanguages:[NSLocale preferredLanguages]];
-#else
-         NSArray *titlesForPreferredLanguages = [AVMetadataItem metadataItemsFromArray:titles withLocale:[NSLocale currentLocale]];
-#endif
         if ([titlesForPreferredLanguages count])
             title = [[titlesForPreferredLanguages objectAtIndex:0] stringValue];
 
index f38e20b..25f8728 100644 (file)
@@ -476,7 +476,6 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url)
 
     [options.get() setObject:[NSNumber numberWithInt:AVAssetReferenceRestrictionForbidRemoteReferenceToLocal | AVAssetReferenceRestrictionForbidLocalReferenceToRemote] forKey:AVURLAssetReferenceRestrictionsKey];
 
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
     RetainPtr<NSMutableDictionary> headerFields = adoptNS([[NSMutableDictionary alloc] init]);
 
     String referrer = player()->referrer();
@@ -489,7 +488,6 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url)
 
     if ([headerFields.get() count])
         [options.get() setObject:headerFields.get() forKey:@"AVURLAssetHTTPHeaderFieldsKey"];
-#endif
 
     NSURL *cocoaURL = URL(ParsedURLString, url);
     m_avAsset = adoptNS([[AVURLAsset alloc] initWithURL:cocoaURL options:options.get()]);
index cebc15e..5434438 100644 (file)
 #include "GraphicsContextCG.h"
 #include "ImageObserver.h"
 #include "SubimageCacheWithTimer.h"
-#if !PLATFORM(IOS)
+#include <wtf/RetainPtr.h>
+
+#if USE(APPKIT)
 #include <ApplicationServices/ApplicationServices.h>
-#else
-#include <CoreGraphics/CGContextPrivate.h>
 #endif
-#include <wtf/RetainPtr.h>
 
 #if PLATFORM(MAC)
 #include "WebCoreSystemInterface.h"
index 250ed50..d269318 100644 (file)
 
 #if USE(CG)
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index 8a0a53c..33ca381 100644 (file)
 
 #if USE(CG)
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index 4f1e108..4126e91 100644 (file)
 
 #if USE(CG)
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index 38710a1..f9ced94 100644 (file)
 #include "Gradient.h"
 
 #include "GraphicsContextCG.h"
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 #include <wtf/RetainPtr.h>
 
 namespace WebCore {
index 642c2f0..f11db6e 100644 (file)
@@ -1017,10 +1017,8 @@ static void applyShadowOffsetWorkaroundIfNeeded(const GraphicsContext& context,
     if (context.isAcceleratedContext())
         return;
 
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
     if (wkCGContextDrawsWithCorrectShadowOffsets(context.platformContext()))
         return;
-#endif
 
     // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated
     // to the desired integer. Also see: <rdar://problem/10056277>
index 625af49..f9f4940 100644 (file)
 #include "ImageData.h"
 #include "MIMETypeRegistry.h"
 #include <math.h>
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
 #include <ImageIO/ImageIO.h>
-#endif
 #include <wtf/Assertions.h>
 #include <wtf/CheckedArithmetic.h>
 #include <wtf/MainThread.h>
index 495d662..e24c749 100644 (file)
 #include "FloatRect.h"
 #include "GraphicsContextCG.h"
 #include "ImageObserver.h"
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 #include <wtf/RetainPtr.h>
 
 #if PLATFORM(MAC)
index bd04574..df03c7f 100644 (file)
 
 #if USE(CG)
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index d1f7b2e..0249ccc 100644 (file)
 
 #if USE(CG)
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index e5d0b82..450a94a 100644 (file)
 
 #if USE(CG)
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index 33bd891..597fde8 100644 (file)
 #include "GraphicsContext.h"
 #include "IntRect.h"
 #include "StrokeStyleApplier.h"
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
-#include <CoreGraphics/CGPathPrivate.h>
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 #include <wtf/MathExtras.h>
 #include <wtf/RetainPtr.h>
 #include <wtf/text/WTFString.h>
@@ -325,9 +320,6 @@ FloatPoint Path::currentPoint() const
     return CGPathGetCurrentPoint(m_path);
 }
 
-// MARK: -
-// MARK: Path Management
-
 struct PathApplierInfo {
     void* info;
     PathApplierFunction function;
index 0c08048..1806504 100644 (file)
 #include "AffineTransform.h"
 #include "GraphicsContext.h"
 
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 #include <wtf/MainThread.h>
 
 #if PLATFORM(MAC)
index 7b7632a..e9a92e7 100644 (file)
@@ -79,9 +79,7 @@ FontPlatformData::FontPlatformData(CTFontRef ctFont, float size, bool isPrinterF
     {
         CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font));
         m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait;
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
         m_isCompositeFontReference = traits & kCTFontCompositeTrait;
-#endif
     }
 
     if (m_font)
@@ -194,9 +192,7 @@ void FontPlatformData::setFont(NSFont *font)
     {
         CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font));
         m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait;
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080
         m_isCompositeFontReference = traits & kCTFontCompositeTrait;
-#endif
     }
     m_CTFont = 0;
 }
index 013c1e5..4e8b1ed 100644 (file)
 
 #include "Color.h"
 
-#if !PLATFORM(IOS)
+#if USE(APPKIT)
 OBJC_CLASS NSColor;
 #endif
 
 namespace WebCore {
     
-#if !PLATFORM(IOS)
+#if USE(APPKIT)
     // These functions assume NSColors are in DeviceRGB colorspace
     Color colorFromNSColor(NSColor *);
     NSColor *nsColor(const Color&);
index 376e0d1..75c4e9f 100644 (file)
 
 #include "FontPlatformData.h"
 #include "SharedBuffer.h"
-#if !PLATFORM(IOS)
-#include <ApplicationServices/ApplicationServices.h>
-#else
 #include <CoreGraphics/CoreGraphics.h>
-#endif
 
 namespace WebCore {
 
index 120458c..73e1bc5 100644 (file)
@@ -56,7 +56,7 @@ void BitmapImage::invalidatePlatformData()
     if (m_frames.size() != 1)
         return;
 
-#if !PLATFORM(IOS)
+#if USE(APPKIT)
     m_nsImage = 0;
 #endif
     m_tiffRep = 0;
@@ -84,9 +84,9 @@ CFDataRef BitmapImage::getTIFFRepresentation()
 {
     if (m_tiffRep)
         return m_tiffRep.get();
-    
+
     unsigned numFrames = frameCount();
-    
+
     // If numFrames is zero, we know for certain this image doesn't have valid data
     // Even though the call to CGImageDestinationCreateWithData will fail and we'll handle it gracefully,
     // in certain circumstances that call will spam the console with an error message
@@ -101,13 +101,13 @@ CFDataRef BitmapImage::getTIFFRepresentation()
     }
 
     unsigned numValidFrames = images.size();
-    
+
     RetainPtr<CFMutableDataRef> data = adoptCF(CFDataCreateMutable(0, 0));
     RetainPtr<CGImageDestinationRef> destination = adoptCF(CGImageDestinationCreateWithData(data.get(), kUTTypeTIFF, numValidFrames, 0));
 
     if (!destination)
         return 0;
-    
+
     for (unsigned i = 0; i < numValidFrames; ++i)
         CGImageDestinationAddImage(destination.get(), images[i], 0);
 
@@ -117,7 +117,7 @@ CFDataRef BitmapImage::getTIFFRepresentation()
     return m_tiffRep.get();
 }
 
-#if !PLATFORM(IOS)
+#if USE(APPKIT)
 NSImage* BitmapImage::getNSImage()
 {
     if (m_nsImage)
index a924cdf..d99df2e 100644 (file)
@@ -32,9 +32,6 @@
 #import "GraphicsContext.h"
 #import "GraphicsLayerCA.h"
 #import "PlatformCALayer.h"
-#if !PLATFORM(IOS)
-#import "ThemeMac.h"
-#endif
 #import <QuartzCore/QuartzCore.h>
 
 #if PLATFORM(IOS)
 #import "WebCoreThread.h"
 #endif
 
+#if !PLATFORM(IOS)
+#import "ThemeMac.h"
+#endif
+
 @interface CALayer(WebCoreCALayerPrivate)
 - (void)reloadValueForKeyPath:(NSString *)keyPath;
 @end