summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/mac
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/mac')
-rw-r--r--WebCore/platform/mac/FoundationExtras.h3
-rw-r--r--WebCore/platform/mac/GeolocationServiceMac.h75
-rw-r--r--WebCore/platform/mac/GeolocationServiceMac.mm209
-rw-r--r--WebCore/platform/mac/LocalCurrentGraphicsContext.h4
-rw-r--r--WebCore/platform/mac/PasteboardMac.mm12
-rw-r--r--WebCore/platform/mac/PlatformScreenMac.mm6
-rw-r--r--WebCore/platform/mac/SharedBufferMac.mm10
-rw-r--r--WebCore/platform/mac/ThreadCheck.mm62
-rw-r--r--WebCore/platform/mac/WebCoreSystemInterface.h9
-rw-r--r--WebCore/platform/mac/WebCoreSystemInterface.mm1
-rw-r--r--WebCore/platform/mac/WebCoreTextRenderer.h9
-rw-r--r--WebCore/platform/mac/WebCoreTextRenderer.mm1
-rw-r--r--WebCore/platform/mac/WebFontCache.h3
-rw-r--r--WebCore/platform/mac/WebFontCache.mm2
-rw-r--r--WebCore/platform/mac/WheelEventMac.mm14
15 files changed, 374 insertions, 46 deletions
diff --git a/WebCore/platform/mac/FoundationExtras.h b/WebCore/platform/mac/FoundationExtras.h
index 51a7df0..85ce8d7 100644
--- a/WebCore/platform/mac/FoundationExtras.h
+++ b/WebCore/platform/mac/FoundationExtras.h
@@ -23,6 +23,9 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import <CoreFoundation/CFBase.h>
+#import <Foundation/NSObject.h>
+
// nil-checked CFRetain/CFRelease covers for Objective-C ids
// Use CFRetain, CFRelease, HardRetain, or HardRelease instead of
diff --git a/WebCore/platform/mac/GeolocationServiceMac.h b/WebCore/platform/mac/GeolocationServiceMac.h
new file mode 100644
index 0000000..d0342e7
--- /dev/null
+++ b/WebCore/platform/mac/GeolocationServiceMac.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2009 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. ``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
+ * 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 GeolocationServiceMac_h
+#define GeolocationServiceMac_h
+
+#if ENABLE(GEOLOCATION)
+
+#include "GeolocationService.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
+#ifdef __OBJC__
+@class CLLocationManager;
+@class WebCoreCoreLocationObserver;
+#else
+class CLLocationManager;
+class WebCoreCoreLocationObserver;
+#endif
+
+namespace WebCore {
+
+class GeolocationServiceMac : public GeolocationService {
+public:
+ GeolocationServiceMac(GeolocationServiceClient*);
+ virtual ~GeolocationServiceMac();
+
+ virtual bool startUpdating(PositionOptions*);
+ virtual void stopUpdating();
+
+ virtual void suspend();
+ virtual void resume();
+
+ virtual Geoposition* lastPosition() const { return m_lastPosition.get(); }
+ virtual PositionError* lastError() const { return m_lastError.get(); }
+
+ void positionChanged(PassRefPtr<Geoposition>);
+ void errorOccurred(PassRefPtr<PositionError>);
+
+private:
+ RetainPtr<CLLocationManager> m_locationManager;
+ RetainPtr<WebCoreCoreLocationObserver> m_objcObserver;
+
+ RefPtr<Geoposition> m_lastPosition;
+ RefPtr<PositionError> m_lastError;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(GEOLOCATION)
+
+#endif // GeolocationServiceMac_h
diff --git a/WebCore/platform/mac/GeolocationServiceMac.mm b/WebCore/platform/mac/GeolocationServiceMac.mm
new file mode 100644
index 0000000..c21b02c
--- /dev/null
+++ b/WebCore/platform/mac/GeolocationServiceMac.mm
@@ -0,0 +1,209 @@
+/*
+ * Copyright (C) 2009 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. ``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
+ * 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.
+ */
+
+#import "config.h"
+
+#if ENABLE(GEOLOCATION)
+
+#import "GeolocationServiceMac.h"
+
+#import "Geoposition.h"
+#import "PositionError.h"
+#import "PositionOptions.h"
+#import "SoftLinking.h"
+#import <CoreLocation/CoreLocation.h>
+#import <objc/objc-runtime.h>
+#import <wtf/RefPtr.h>
+#import <wtf/UnusedParam.h>
+
+SOFT_LINK_FRAMEWORK(CoreLocation)
+
+SOFT_LINK_CLASS(CoreLocation, CLLocationManager)
+SOFT_LINK_CLASS(CoreLocation, CLLocation)
+
+SOFT_LINK_CONSTANT(CoreLocation, kCLLocationAccuracyBest, double)
+SOFT_LINK_CONSTANT(CoreLocation, kCLLocationAccuracyHundredMeters, double)
+
+#define kCLLocationAccuracyBest getkCLLocationAccuracyBest()
+#define kCLLocationAccuracyHundredMeters getkCLLocationAccuracyHundredMeters()
+
+using namespace WebCore;
+
+@interface WebCoreCoreLocationObserver : NSObject<CLLocationManagerDelegate>
+{
+ GeolocationServiceMac* m_callback;
+}
+
+- (id)initWithCallback:(GeolocationServiceMac*)callback;
+
+- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation;
+- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error;
+
+@end
+
+namespace WebCore {
+
+GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
+{
+ return new GeolocationServiceMac(client);
+}
+
+GeolocationServiceMac::GeolocationServiceMac(GeolocationServiceClient* client)
+ : GeolocationService(client)
+ , m_objcObserver(AdoptNS, [[WebCoreCoreLocationObserver alloc] initWithCallback:this])
+{
+}
+
+GeolocationServiceMac::~GeolocationServiceMac()
+{
+ [m_locationManager.get() stopUpdatingLocation];
+ m_locationManager.get().delegate = nil;
+}
+
+bool GeolocationServiceMac::startUpdating(PositionOptions* options)
+{
+ #define CLLocationManager getCLLocationManagerClass()
+ if (!m_locationManager.get()) {
+ m_locationManager.adoptNS([[CLLocationManager alloc] init]);
+ m_locationManager.get().delegate = m_objcObserver.get();
+ }
+
+ if (!m_locationManager.get().locationServicesEnabled)
+ return false;
+
+ if (options) {
+ // CLLocationAccuracy values suggested by Ron Huang.
+ CLLocationAccuracy accuracy = options->enableHighAccuracy() ? kCLLocationAccuracyBest : kCLLocationAccuracyHundredMeters;
+ m_locationManager.get().desiredAccuracy = accuracy;
+ }
+
+ // This can safely be called multiple times.
+ [m_locationManager.get() startUpdatingLocation];
+
+ return true;
+ #undef CLLocationManager
+}
+
+void GeolocationServiceMac::stopUpdating()
+{
+ [m_locationManager.get() stopUpdatingLocation];
+}
+
+void GeolocationServiceMac::suspend()
+{
+ [m_locationManager.get() stopUpdatingLocation];
+}
+
+void GeolocationServiceMac::resume()
+{
+ [m_locationManager.get() startUpdatingLocation];
+}
+
+void GeolocationServiceMac::positionChanged(PassRefPtr<Geoposition> position)
+{
+ m_lastPosition = position;
+ GeolocationService::positionChanged();
+}
+
+void GeolocationServiceMac::errorOccurred(PassRefPtr<PositionError> error)
+{
+ m_lastError = error;
+ GeolocationService::errorOccurred();
+}
+
+} // namespace WebCore
+
+@implementation WebCoreCoreLocationObserver
+
+- (id)initWithCallback:(GeolocationServiceMac *)callback
+{
+ self = [super init];
+ if (self)
+ m_callback = callback;
+ return self;
+}
+
+- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
+{
+ ASSERT(m_callback);
+ ASSERT(newLocation);
+ UNUSED_PARAM(manager);
+ UNUSED_PARAM(oldLocation);
+
+ // Normalize
+ double altitude = newLocation.altitude;
+ double altitudeAccuracy = newLocation.verticalAccuracy;
+ if (altitudeAccuracy < 0.0) {
+ altitudeAccuracy = 0.0;
+ altitude = 0.0;
+ }
+ double speed = newLocation.speed;
+ if (speed < 0.0)
+ speed = 0.0;
+ double heading = newLocation.course;
+ if (heading < 0.0)
+ heading = 0.0;
+
+ WTF::RefPtr<WebCore::Coordinates> newCoordinates = WebCore::Coordinates::create(
+ newLocation.coordinate.latitude,
+ newLocation.coordinate.longitude,
+ altitude,
+ newLocation.horizontalAccuracy,
+ altitudeAccuracy,
+ heading,
+ speed);
+ WTF::RefPtr<WebCore::Geoposition> newPosition = WebCore::Geoposition::create(
+ newCoordinates.release(),
+ [newLocation.timestamp timeIntervalSince1970] * 1000.0); // seconds -> milliseconds
+
+ m_callback->positionChanged(newPosition.release());
+}
+
+- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
+{
+ ASSERT(m_callback);
+ ASSERT(error);
+
+ UNUSED_PARAM(manager);
+
+ PositionError::ErrorCode code;
+ switch ([error code]) {
+ case kCLErrorDenied:
+ code = PositionError::PERMISSION_DENIED;
+ break;
+ case kCLErrorLocationUnknown:
+ code = PositionError::POSITION_UNAVAILABLE;
+ break;
+ default:
+ code = PositionError::POSITION_UNAVAILABLE;
+ break;
+ }
+
+ m_callback->errorOccurred(PositionError::create(code, [error localizedDescription]));
+}
+
+@end
+
+#endif // ENABLE(GEOLOCATION)
diff --git a/WebCore/platform/mac/LocalCurrentGraphicsContext.h b/WebCore/platform/mac/LocalCurrentGraphicsContext.h
index 856cf52..1c5cae7 100644
--- a/WebCore/platform/mac/LocalCurrentGraphicsContext.h
+++ b/WebCore/platform/mac/LocalCurrentGraphicsContext.h
@@ -19,7 +19,11 @@
#include <wtf/Noncopyable.h>
+#ifdef __OBJC__
+@class NSGraphicsContext;
+#else
class NSGraphicsContext;
+#endif
namespace WebCore {
diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm
index de369fc..36b00f6 100644
--- a/WebCore/platform/mac/PasteboardMac.mm
+++ b/WebCore/platform/mac/PasteboardMac.mm
@@ -278,7 +278,7 @@ void Pasteboard::writeImage(Node* node, const KURL& url, const String& title)
ASSERT(cocoaURL);
ASSERT(node->renderer() && node->renderer()->isImage());
- RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
+ RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
ASSERT(cachedImage);
@@ -310,7 +310,7 @@ String Pasteboard::plainText(Frame* frame)
NSArray *types = [m_pasteboard.get() types];
if ([types containsObject:NSStringPboardType])
- return [m_pasteboard.get() stringForType:NSStringPboardType];
+ return [[m_pasteboard.get() stringForType:NSStringPboardType] precomposedStringWithCanonicalMapping];
NSAttributedString *attributedString = nil;
NSString *string;
@@ -320,13 +320,13 @@ String Pasteboard::plainText(Frame* frame)
if (attributedString == nil && [types containsObject:NSRTFPboardType])
attributedString = [[NSAttributedString alloc] initWithRTF:[m_pasteboard.get() dataForType:NSRTFPboardType] documentAttributes:NULL];
if (attributedString != nil) {
- string = [[attributedString string] copy];
+ string = [[attributedString string] precomposedStringWithCanonicalMapping];
[attributedString release];
- return [string autorelease];
+ return string;
}
if ([types containsObject:NSFilenamesPboardType]) {
- string = [[m_pasteboard.get() propertyListForType:NSFilenamesPboardType] componentsJoinedByString:@"\n"];
+ string = [[[m_pasteboard.get() propertyListForType:NSFilenamesPboardType] componentsJoinedByString:@"\n"] precomposedStringWithCanonicalMapping];
if (string != nil)
return string;
}
@@ -338,7 +338,7 @@ String Pasteboard::plainText(Frame* frame)
// helper code that should either be done in a separate patch or figured out in another way.
string = frame->editor()->client()->userVisibleString(url);
if ([string length] > 0)
- return string;
+ return [string precomposedStringWithCanonicalMapping];
}
diff --git a/WebCore/platform/mac/PlatformScreenMac.mm b/WebCore/platform/mac/PlatformScreenMac.mm
index 8f12df0..5dbfcf4 100644
--- a/WebCore/platform/mac/PlatformScreenMac.mm
+++ b/WebCore/platform/mac/PlatformScreenMac.mm
@@ -45,11 +45,7 @@ int screenDepthPerComponent(Widget*)
bool screenIsMonochrome(Widget*)
{
- NSString *colorSpace = NSColorSpaceFromDepth([[NSScreen deepestScreen] depth]);
- return colorSpace == NSCalibratedWhiteColorSpace
- || colorSpace == NSCalibratedBlackColorSpace
- || colorSpace == NSDeviceWhiteColorSpace
- || colorSpace == NSDeviceBlackColorSpace;
+ return false;
}
// These functions scale between screen and page coordinates because JavaScript/DOM operations
diff --git a/WebCore/platform/mac/SharedBufferMac.mm b/WebCore/platform/mac/SharedBufferMac.mm
index f1d9517..c4e7528 100644
--- a/WebCore/platform/mac/SharedBufferMac.mm
+++ b/WebCore/platform/mac/SharedBufferMac.mm
@@ -39,7 +39,7 @@ using namespace WebCore;
@interface WebCoreSharedBufferData : NSData
{
- SharedBuffer* sharedBuffer;
+ RefPtr<SharedBuffer> sharedBuffer;
}
- (id)initWithSharedBuffer:(SharedBuffer*)buffer;
@@ -59,16 +59,12 @@ using namespace WebCore;
{
if (WebCoreObjCScheduleDeallocateOnMainThread([WebCoreSharedBufferData class], self))
return;
-
- sharedBuffer->deref();
[super dealloc];
}
- (void)finalize
{
- sharedBuffer->deref();
-
[super finalize];
}
@@ -76,10 +72,8 @@ using namespace WebCore;
{
self = [super init];
- if (self) {
+ if (self)
sharedBuffer = buffer;
- sharedBuffer->ref();
- }
return self;
}
diff --git a/WebCore/platform/mac/ThreadCheck.mm b/WebCore/platform/mac/ThreadCheck.mm
index b862598..ddee05c 100644
--- a/WebCore/platform/mac/ThreadCheck.mm
+++ b/WebCore/platform/mac/ThreadCheck.mm
@@ -32,56 +32,74 @@
namespace WebCore {
-static ThreadViolationBehavior defaultThreadViolationBehavior = RaiseExceptionOnThreadViolation;
-
static bool didReadThreadViolationBehaviorFromUserDefaults = false;
-static bool threadViolationBehaviorIsDefault;
-static ThreadViolationBehavior threadViolationBehavior;
+static bool threadViolationBehaviorIsDefault = true;
+static ThreadViolationBehavior threadViolationBehavior[MaximumThreadViolationRound] = { RaiseExceptionOnThreadViolation, RaiseExceptionOnThreadViolation };
static void readThreadViolationBehaviorFromUserDefaults()
{
+ didReadThreadViolationBehaviorFromUserDefaults = true;
+
+ ThreadViolationBehavior newBehavior = LogOnFirstThreadViolation;
NSString *threadCheckLevel = [[NSUserDefaults standardUserDefaults] stringForKey:@"WebCoreThreadCheck"];
+ if (!threadCheckLevel)
+ return;
+
if ([threadCheckLevel isEqualToString:@"None"])
- threadViolationBehavior = NoThreadCheck;
+ newBehavior = NoThreadCheck;
else if ([threadCheckLevel isEqualToString:@"Exception"])
- threadViolationBehavior = RaiseExceptionOnThreadViolation;
+ newBehavior = RaiseExceptionOnThreadViolation;
else if ([threadCheckLevel isEqualToString:@"Log"])
- threadViolationBehavior = LogOnThreadViolation;
+ newBehavior = LogOnThreadViolation;
else if ([threadCheckLevel isEqualToString:@"LogOnce"])
- threadViolationBehavior = LogOnFirstThreadViolation;
- else {
- threadViolationBehavior = defaultThreadViolationBehavior;
- threadViolationBehaviorIsDefault = true;
- }
- didReadThreadViolationBehaviorFromUserDefaults = true;
+ newBehavior = LogOnFirstThreadViolation;
+ else
+ ASSERT_NOT_REACHED();
+
+ threadViolationBehaviorIsDefault = false;
+
+ for (unsigned i = 0; i < MaximumThreadViolationRound; ++i)
+ threadViolationBehavior[i] = newBehavior;
}
-void setDefaultThreadViolationBehavior(ThreadViolationBehavior behavior)
+void setDefaultThreadViolationBehavior(ThreadViolationBehavior behavior, ThreadViolationRound round)
{
- defaultThreadViolationBehavior = behavior;
+ ASSERT(round < MaximumThreadViolationRound);
+ if (round >= MaximumThreadViolationRound)
+ return;
+ if (!didReadThreadViolationBehaviorFromUserDefaults)
+ readThreadViolationBehaviorFromUserDefaults();
if (threadViolationBehaviorIsDefault)
- threadViolationBehavior = behavior;
+ threadViolationBehavior[round] = behavior;
}
-void reportThreadViolation(const char* function)
+void reportThreadViolation(const char* function, ThreadViolationRound round)
{
+ ASSERT(round < MaximumThreadViolationRound);
+ if (round >= MaximumThreadViolationRound)
+ return;
if (!didReadThreadViolationBehaviorFromUserDefaults)
- readThreadViolationBehaviorFromUserDefaults();
- if (threadViolationBehavior == NoThreadCheck)
+ readThreadViolationBehaviorFromUserDefaults();
+ if (threadViolationBehavior[round] == NoThreadCheck)
return;
if (pthread_main_np())
return;
- WebCoreReportThreadViolation(function);
+ WebCoreReportThreadViolation(function, round);
}
} // namespace WebCore
// Split out the actual reporting of the thread violation to make it easier to set a breakpoint
-void WebCoreReportThreadViolation(const char* function)
+void WebCoreReportThreadViolation(const char* function, WebCore::ThreadViolationRound round)
{
using namespace WebCore;
+
+ ASSERT(round < MaximumThreadViolationRound);
+ if (round >= MaximumThreadViolationRound)
+ return;
+
DEFINE_STATIC_LOCAL(HashSet<String>, loggedFunctions, ());
- switch (threadViolationBehavior) {
+ switch (threadViolationBehavior[round]) {
case NoThreadCheck:
break;
case LogOnFirstThreadViolation:
diff --git a/WebCore/platform/mac/WebCoreSystemInterface.h b/WebCore/platform/mac/WebCoreSystemInterface.h
index 14d1713..3feed69 100644
--- a/WebCore/platform/mac/WebCoreSystemInterface.h
+++ b/WebCore/platform/mac/WebCoreSystemInterface.h
@@ -40,12 +40,21 @@ typedef struct _NSRect NSRect;
#endif
#ifdef __OBJC__
+@class NSArray;
@class NSButtonCell;
@class NSData;
+@class NSDate;
@class NSEvent;
@class NSFont;
+@class NSImage;
+@class NSMenu;
@class NSMutableURLRequest;
+@class NSString;
+@class NSTextFieldCell;
+@class NSURLConnection;
@class NSURLRequest;
+@class NSURLResponse;
+@class NSView;
@class QTMovie;
@class QTMovieView;
#else
diff --git a/WebCore/platform/mac/WebCoreSystemInterface.mm b/WebCore/platform/mac/WebCoreSystemInterface.mm
index b629b4e..edd9d50 100644
--- a/WebCore/platform/mac/WebCoreSystemInterface.mm
+++ b/WebCore/platform/mac/WebCoreSystemInterface.mm
@@ -25,6 +25,7 @@
#import "config.h"
#import "WebCoreSystemInterface.h"
+#import <Foundation/Foundation.h>
void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *);
BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef);
diff --git a/WebCore/platform/mac/WebCoreTextRenderer.h b/WebCore/platform/mac/WebCoreTextRenderer.h
index 3e77434..73753bc 100644
--- a/WebCore/platform/mac/WebCoreTextRenderer.h
+++ b/WebCore/platform/mac/WebCoreTextRenderer.h
@@ -23,6 +23,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import <AppKit/NSFontManager.h>
+#import <CoreFoundation/CFString.h>
+
+#ifdef __OBJC__
+@class NSColor;
+@class NSFont;
+@class NSString;
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/WebCore/platform/mac/WebCoreTextRenderer.mm b/WebCore/platform/mac/WebCoreTextRenderer.mm
index 0cd5967..ab053ef 100644
--- a/WebCore/platform/mac/WebCoreTextRenderer.mm
+++ b/WebCore/platform/mac/WebCoreTextRenderer.mm
@@ -31,6 +31,7 @@
#import "GraphicsContext.h"
#import "IntPoint.h"
#import "WebFontCache.h"
+#import <AppKit/AppKit.h>
using namespace WebCore;
diff --git a/WebCore/platform/mac/WebFontCache.h b/WebCore/platform/mac/WebFontCache.h
index b31a684..8d3e4dd 100644
--- a/WebCore/platform/mac/WebFontCache.h
+++ b/WebCore/platform/mac/WebFontCache.h
@@ -24,7 +24,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <wtf/Vector.h>
+#import <AppKit/NSFontManager.h>
+#import <wtf/Vector.h>
// This interface exists so that third party products (like Silk) can patch in to an Obj-C method to manipulate WebKit's font caching/substitution.
@interface WebFontCache : NSObject
diff --git a/WebCore/platform/mac/WebFontCache.mm b/WebCore/platform/mac/WebFontCache.mm
index 6cf1ef4..ac70f06 100644
--- a/WebCore/platform/mac/WebFontCache.mm
+++ b/WebCore/platform/mac/WebFontCache.mm
@@ -31,6 +31,8 @@
#import "WebFontCache.h"
#import "FontTraitsMask.h"
+#import <AppKit/AppKit.h>
+#import <Foundation/Foundation.h>
#import <math.h>
using namespace WebCore;
diff --git a/WebCore/platform/mac/WheelEventMac.mm b/WebCore/platform/mac/WheelEventMac.mm
index 7b60494..5821139 100644
--- a/WebCore/platform/mac/WheelEventMac.mm
+++ b/WebCore/platform/mac/WheelEventMac.mm
@@ -27,6 +27,7 @@
#import "PlatformWheelEvent.h"
#import "PlatformMouseEvent.h"
+#import "Scrollbar.h"
#import "WebCoreSystemInterface.h"
namespace WebCore {
@@ -34,6 +35,7 @@ namespace WebCore {
PlatformWheelEvent::PlatformWheelEvent(NSEvent* event)
: m_position(pointForEvent(event))
, m_globalPosition(globalPointForEvent(event))
+ , m_granularity(ScrollByPixelWheelEvent)
, m_isAccepted(false)
, m_shiftKey([event modifierFlags] & NSShiftKeyMask)
, m_ctrlKey([event modifierFlags] & NSControlKeyMask)
@@ -42,10 +44,14 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event)
{
BOOL continuous;
wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
- m_granularity = continuous ? ScrollByPixelWheelEvent : ScrollByLineWheelEvent;
- if (m_granularity == ScrollByLineWheelEvent) {
- m_deltaX *= horizontalLineMultiplier();
- m_deltaY *= verticalLineMultiplier();
+ if (continuous) {
+ m_wheelTicksX = m_deltaX / static_cast<float>(cScrollbarPixelsPerLineStep);
+ m_wheelTicksY = m_deltaY / static_cast<float>(cScrollbarPixelsPerLineStep);
+ } else {
+ m_wheelTicksX = m_deltaX;
+ m_wheelTicksY = m_deltaY;
+ m_deltaX *= static_cast<float>(cScrollbarPixelsPerLineStep);
+ m_deltaY *= static_cast<float>(cScrollbarPixelsPerLineStep);
}
}