summaryrefslogtreecommitdiffstats
path: root/WebKit/mac/Misc
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/mac/Misc')
-rw-r--r--WebKit/mac/Misc/WebCoreStatistics.h1
-rw-r--r--WebKit/mac/Misc/WebCoreStatistics.mm12
-rw-r--r--WebKit/mac/Misc/WebIconDatabase.mm2
-rw-r--r--WebKit/mac/Misc/WebKitNSStringExtras.h1
-rw-r--r--WebKit/mac/Misc/WebKitNSStringExtras.mm21
-rw-r--r--WebKit/mac/Misc/WebNSPasteboardExtras.mm2
6 files changed, 25 insertions, 14 deletions
diff --git a/WebKit/mac/Misc/WebCoreStatistics.h b/WebKit/mac/Misc/WebCoreStatistics.h
index 33e3e0f..1565c26 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.h
+++ b/WebKit/mac/Misc/WebCoreStatistics.h
@@ -90,4 +90,5 @@
- (NSString *)pageProperty:(const char*)propertyName:(int)pageNumber;
- (bool)isPageBoxVisible:(int)pageNumber;
- (NSString *)pageSizeAndMarginsInPixels:(int)pageNumber:(int)width:(int)height:(int)marginTop:(int)marginRight:(int)marginBottom:(int)marginLeft;
+- (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels;
@end
diff --git a/WebKit/mac/Misc/WebCoreStatistics.mm b/WebKit/mac/Misc/WebCoreStatistics.mm
index bbe07d5..a5d5ae1 100644
--- a/WebKit/mac/Misc/WebCoreStatistics.mm
+++ b/WebKit/mac/Misc/WebCoreStatistics.mm
@@ -37,6 +37,7 @@
#import <WebCore/Frame.h>
#import <WebCore/GCController.h>
#import <WebCore/GlyphPageTreeNode.h>
+#import <WebCore/GraphicsContext.h>
#import <WebCore/IconDatabase.h>
#import <WebCore/JSDOMWindow.h>
#import <WebCore/PageCache.h>
@@ -289,4 +290,15 @@ using namespace WebCore;
{
return PrintContext::pageSizeAndMarginsInPixels(_private->coreFrame, pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
}
+
+- (void)printToCGContext:(CGContextRef)cgContext:(float)pageWidthInPixels:(float)pageHeightInPixels
+{
+ Frame* coreFrame = _private->coreFrame;
+ if (!coreFrame)
+ return;
+
+ GraphicsContext graphicsContext(cgContext);
+ PrintContext::spoolAllPagesWithBoundaries(coreFrame, graphicsContext, FloatSize(pageWidthInPixels, pageHeightInPixels));
+}
+
@end
diff --git a/WebKit/mac/Misc/WebIconDatabase.mm b/WebKit/mac/Misc/WebIconDatabase.mm
index f53bffa..7d0a350 100644
--- a/WebKit/mac/Misc/WebIconDatabase.mm
+++ b/WebKit/mac/Misc/WebIconDatabase.mm
@@ -104,7 +104,7 @@ static WebIconDatabaseClient* defaultClient()
return database;
}
-- init
+- (id)init
{
[super init];
WebCoreThreadViolationCheckRoundOne();
diff --git a/WebKit/mac/Misc/WebKitNSStringExtras.h b/WebKit/mac/Misc/WebKitNSStringExtras.h
index f252430..ddc49f0 100644
--- a/WebKit/mac/Misc/WebKitNSStringExtras.h
+++ b/WebKit/mac/Misc/WebKitNSStringExtras.h
@@ -32,6 +32,7 @@ extern NSString *WebKitLocalCacheDefaultsKey;
@interface NSString (WebKitExtras)
+- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor allowingFontSmoothing:(BOOL)fontSmoothingIsAllowed;
- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor;
- (void)_web_drawDoubledAtPoint:(NSPoint)textPoint withTopColor:(NSColor *)topColor bottomColor:(NSColor *)bottomColor font:(NSFont *)font;
diff --git a/WebKit/mac/Misc/WebKitNSStringExtras.mm b/WebKit/mac/Misc/WebKitNSStringExtras.mm
index da46630..8fc12bd 100644
--- a/WebKit/mac/Misc/WebKitNSStringExtras.mm
+++ b/WebKit/mac/Misc/WebKitNSStringExtras.mm
@@ -62,12 +62,16 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor
{
- // FIXME: Would be more efficient to change this to C++ and use Vector<UChar, 2048>.
+ [self _web_drawAtPoint:point font:font textColor:textColor allowingFontSmoothing:YES];
+}
+
+- (void)_web_drawAtPoint:(NSPoint)point font:(NSFont *)font textColor:(NSColor *)textColor allowingFontSmoothing:(BOOL)fontSmoothingIsAllowed
+{
unsigned length = [self length];
Vector<UniChar, 2048> buffer(length);
[self getCharacters:buffer.data()];
-
+
if (canUseFastRenderer(buffer.data(), length)) {
// The following is a half-assed attempt to match AppKit's rounding rules for drawAtPoint.
// It's probably incorrect for high DPI.
@@ -84,7 +88,7 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
if (!flipped)
CGContextScaleCTM(cgContext, 1, -1);
- Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen]);
+ Font webCoreFont(FontPlatformData(font), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
TextRun run(buffer.data(), length);
run.disableRoundingHacks();
@@ -116,17 +120,10 @@ static BOOL canUseFastRenderer(const UniChar *buffer, unsigned length)
font:(NSFont *)font
{
// turn off font smoothing so translucent text draws correctly (Radar 3118455)
- [NSGraphicsContext saveGraphicsState];
- CGContextSetShouldSmoothFonts(static_cast<CGContextRef>([[NSGraphicsContext currentContext] graphicsPort]), false);
- [self _web_drawAtPoint:textPoint
- font:font
- textColor:bottomColor];
+ [self _web_drawAtPoint:textPoint font:font textColor:bottomColor allowingFontSmoothing:NO];
textPoint.y += 1;
- [self _web_drawAtPoint:textPoint
- font:font
- textColor:topColor];
- [NSGraphicsContext restoreGraphicsState];
+ [self _web_drawAtPoint:textPoint font:font textColor:topColor allowingFontSmoothing:NO];
}
- (float)_web_widthWithFont:(NSFont *)font
diff --git a/WebKit/mac/Misc/WebNSPasteboardExtras.mm b/WebKit/mac/Misc/WebNSPasteboardExtras.mm
index ab3baf7..7caa47a 100644
--- a/WebKit/mac/Misc/WebNSPasteboardExtras.mm
+++ b/WebKit/mac/Misc/WebNSPasteboardExtras.mm
@@ -48,7 +48,7 @@
#import <wtf/StdLibExtras.h>
@interface NSFilePromiseDragSource : NSObject
-- initWithSource:(id)draggingSource;
+- (id)initWithSource:(id)draggingSource;
- (void)setTypes:(NSArray *)types onPasteboard:(NSPasteboard *)pboard;
@end