From 9d07d6c2363e46693b9dbab461aecb4cc00b854d Mon Sep 17 00:00:00 2001 From: "tony@chromium.org" Date: Fri, 29 Jun 2012 18:14:47 +0000 Subject: [PATCH] Unreviewed, rolling out r121547. http://trac.webkit.org/changeset/121547 https://bugs.webkit.org/show_bug.cgi?id=90256 Breaks Chromium Mac build * platform/LocalizedStrings.cpp: (WebCore::imageTitle): * platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::setAllowsFontSmoothing): * platform/graphics/cg/ImageCG.cpp: (WebCore::Image::drawPattern): * platform/graphics/cg/ImageSourceCG.cpp: (WebCore::ImageSource::clear): * platform/graphics/cg/PathCG.cpp: (WebCore::Path::boundingRect): * platform/graphics/cocoa/FontPlatformDataCocoa.mm: (WebCore): (WebCore::canSetCascadeListForCustomFont): (WebCore::FontPlatformData::ctFont): * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/mac/ComplexTextController.cpp: * platform/graphics/mac/FontCacheMac.mm: (WebCore): (WebCore::fontCacheATSNotificationCallback): (WebCore::FontCache::platformInit): * platform/graphics/mac/FontCustomPlatformData.cpp: (WebCore::FontCustomPlatformData::~FontCustomPlatformData): (WebCore::createFontCustomPlatformData): * platform/graphics/mac/FontCustomPlatformData.h: (WebCore::FontCustomPlatformData::FontCustomPlatformData): * platform/graphics/mac/SimpleFontDataMac.mm: (WebCore::SimpleFontData::platformInit): * platform/graphics/mac/WebLayer.h: * platform/mac/CursorMac.mm: (WebCore::Cursor::ensurePlatformCursor): * platform/mac/DisplaySleepDisabler.cpp: (WebCore::DisplaySleepDisabler::DisplaySleepDisabler): (WebCore): (WebCore::DisplaySleepDisabler::systemActivityTimerFired): * platform/mac/DisplaySleepDisabler.h: (DisplaySleepDisabler): * platform/mac/HTMLConverter.h: * platform/mac/HTMLConverter.mm: * platform/mac/PopupMenuMac.mm: (WebCore::PopupMenuMac::populate): * platform/mac/ScrollElasticityController.mm: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121575 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 50 ++++++++++++++++++++++ Source/WebCore/platform/LocalizedStrings.cpp | 5 +++ .../platform/graphics/cg/GraphicsContextCG.cpp | 3 ++ Source/WebCore/platform/graphics/cg/ImageCG.cpp | 14 +++++- .../WebCore/platform/graphics/cg/ImageSourceCG.cpp | 12 +++++- Source/WebCore/platform/graphics/cg/PathCG.cpp | 11 ++++- .../graphics/cocoa/FontPlatformDataCocoa.mm | 22 +++++++++- .../gstreamer/MediaPlayerPrivateGStreamer.cpp | 5 +++ .../graphics/mac/ComplexTextController.cpp | 5 +++ .../WebCore/platform/graphics/mac/FontCacheMac.mm | 13 ++++++ .../graphics/mac/FontCustomPlatformData.cpp | 42 +++++++++++++++++- .../platform/graphics/mac/FontCustomPlatformData.h | 7 ++- .../platform/graphics/mac/SimpleFontDataMac.mm | 9 ++++ Source/WebCore/platform/graphics/mac/WebLayer.h | 7 +++ Source/WebCore/platform/mac/CursorMac.mm | 16 +++++++ .../WebCore/platform/mac/DisplaySleepDisabler.cpp | 20 +++++++++ Source/WebCore/platform/mac/DisplaySleepDisabler.h | 13 +++++- Source/WebCore/platform/mac/HTMLConverter.h | 2 + Source/WebCore/platform/mac/HTMLConverter.mm | 7 +++ Source/WebCore/platform/mac/PopupMenuMac.mm | 4 ++ .../platform/mac/ScrollElasticityController.mm | 6 +++ 21 files changed, 262 insertions(+), 11 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index d6ddbee..069f25a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,53 @@ +2012-06-29 Tony Chang + + Unreviewed, rolling out r121547. + http://trac.webkit.org/changeset/121547 + https://bugs.webkit.org/show_bug.cgi?id=90256 + + Breaks Chromium Mac build + + * platform/LocalizedStrings.cpp: + (WebCore::imageTitle): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::setAllowsFontSmoothing): + * platform/graphics/cg/ImageCG.cpp: + (WebCore::Image::drawPattern): + * platform/graphics/cg/ImageSourceCG.cpp: + (WebCore::ImageSource::clear): + * platform/graphics/cg/PathCG.cpp: + (WebCore::Path::boundingRect): + * platform/graphics/cocoa/FontPlatformDataCocoa.mm: + (WebCore): + (WebCore::canSetCascadeListForCustomFont): + (WebCore::FontPlatformData::ctFont): + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/FontCacheMac.mm: + (WebCore): + (WebCore::fontCacheATSNotificationCallback): + (WebCore::FontCache::platformInit): + * platform/graphics/mac/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::~FontCustomPlatformData): + (WebCore::createFontCustomPlatformData): + * platform/graphics/mac/FontCustomPlatformData.h: + (WebCore::FontCustomPlatformData::FontCustomPlatformData): + * platform/graphics/mac/SimpleFontDataMac.mm: + (WebCore::SimpleFontData::platformInit): + * platform/graphics/mac/WebLayer.h: + * platform/mac/CursorMac.mm: + (WebCore::Cursor::ensurePlatformCursor): + * platform/mac/DisplaySleepDisabler.cpp: + (WebCore::DisplaySleepDisabler::DisplaySleepDisabler): + (WebCore): + (WebCore::DisplaySleepDisabler::systemActivityTimerFired): + * platform/mac/DisplaySleepDisabler.h: + (DisplaySleepDisabler): + * platform/mac/HTMLConverter.h: + * platform/mac/HTMLConverter.mm: + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::populate): + * platform/mac/ScrollElasticityController.mm: + 2012-06-29 Eric Penner [chromium] Adding PrioritizedTexture and replacing ContentsTextureManager diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp index f77efa6..9c4bdf3 100644 --- a/Source/WebCore/platform/LocalizedStrings.cpp +++ b/Source/WebCore/platform/LocalizedStrings.cpp @@ -755,6 +755,7 @@ String htmlSelectMultipleItems(size_t count) String imageTitle(const String& filename, const IntSize& size) { #if USE(CF) +#if !defined(BUILDING_ON_LEOPARD) RetainPtr filenameCFString(AdoptCF, filename.createCFString()); RetainPtr locale(AdoptCF, CFLocaleCopyCurrent()); RetainPtr formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle)); @@ -769,6 +770,10 @@ String imageTitle(const String& filename, const IntSize& size) return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filenameCFString.get(), widthString.get(), heightString.get()); #else + RetainPtr filenameCFString(AdoptCF, filename.createCFString()); + return formatLocalizedString(WEB_UI_STRING("%@ %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filenameCFString.get(), size.width(), size.height()); +#endif +#else return formatLocalizedString(WEB_UI_STRING(" %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()).replace("", filename); #endif } diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 019fad8..7489468 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -1597,8 +1597,11 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const void GraphicsContext::setAllowsFontSmoothing(bool allowsFontSmoothing) { + UNUSED_PARAM(allowsFontSmoothing); +#if !defined(BUILDING_ON_LEOPARD) CGContextRef context = platformContext(); CGContextSetAllowsFontSmoothing(context, allowsFontSmoothing); +#endif } void GraphicsContext::setIsCALayerContext(bool isLayerContext) diff --git a/Source/WebCore/platform/graphics/cg/ImageCG.cpp b/Source/WebCore/platform/graphics/cg/ImageCG.cpp index cd12e45..fed911a 100644 --- a/Source/WebCore/platform/graphics/cg/ImageCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageCG.cpp @@ -262,13 +262,22 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const // Adjust the color space. subImage = Image::imageWithColorSpace(subImage.get(), styleColorSpace); - + + // Leopard has an optimized call for the tiling of image patterns, but we can only use it if the image has been decoded enough that + // its buffer is the same size as the overall image. Because a partially decoded CGImageRef with a smaller width or height than the + // overall image buffer needs to tile with "gaps", we can't use the optimized tiling call in that case. + // FIXME: We cannot use CGContextDrawTiledImage with scaled tiles on Leopard, because it suffers from rounding errors. Snow Leopard is ok. float scaledTileWidth = tileRect.width() * narrowPrecisionToFloat(patternTransform.a()); float w = CGImageGetWidth(tileImage); +#ifdef BUILDING_ON_LEOPARD + if (w == size().width() && h == size().height() && scaledTileWidth == tileRect.width() && scaledTileHeight == tileRect.height()) +#else if (w == size().width() && h == size().height()) +#endif CGContextDrawTiledImage(context, FloatRect(adjustedX, adjustedY, scaledTileWidth, scaledTileHeight), subImage.get()); else { - // This code now only runs for partially decoded images whose buffers do not yet match the overall size of the image. + + // On Leopard and newer, this code now only runs for partially decoded images whose buffers do not yet match the overall size of the image. static const CGPatternCallbacks patternCallbacks = { 0, drawPatternCallback, NULL }; CGAffineTransform matrix = CGAffineTransformMake(narrowPrecisionToCGFloat(patternTransform.a()), 0, 0, narrowPrecisionToCGFloat(patternTransform.d()), adjustedX, adjustedY); matrix = CGAffineTransformConcat(matrix, CGContextGetCTM(context)); @@ -292,6 +301,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const CGContextSetFillColorWithColor(context, color.get()); CGContextFillRect(context, CGContextGetClipBoundingBox(context)); + } stateSaver.restore(); diff --git a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 1d80cc1..4335365 100644 --- a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -85,11 +85,21 @@ ImageSource::~ImageSource() void ImageSource::clear(bool destroyAllFrames, size_t, SharedBuffer* data, bool allDataReceived) { - // ImageIO discards previously decoded image frames if the client +#if !defined(BUILDING_ON_LEOPARD) + // Recent versions of ImageIO discard previously decoded image frames if the client // application no longer holds references to them, so there's no need to throw away // the decoder unless we're explicitly asked to destroy all of the frames. + if (!destroyAllFrames) return; +#else + // Older versions of ImageIO hold references to previously decoded image frames. + // There is no API to selectively release some of the frames it is holding, and + // if we don't release the frames we use too much memory on large images. + // Destroying the decoder is the only way to release previous frames. + + UNUSED_PARAM(destroyAllFrames); +#endif if (m_decoder) { CFRelease(m_decoder); diff --git a/Source/WebCore/platform/graphics/cg/PathCG.cpp b/Source/WebCore/platform/graphics/cg/PathCG.cpp index d4acf31..6cc9378 100644 --- a/Source/WebCore/platform/graphics/cg/PathCG.cpp +++ b/Source/WebCore/platform/graphics/cg/PathCG.cpp @@ -171,8 +171,15 @@ void Path::translate(const FloatSize& size) FloatRect Path::boundingRect() const { - // CGPathGetPathBoundingBox does not include the path's control points. - CGRect bound = CGPathGetPathBoundingBox(m_path); + // CGPathGetBoundingBox includes the path's control points, CGPathGetPathBoundingBox + // does not, but only exists on 10.6 and above. + + CGRect bound = CGRectZero; +#if !defined(BUILDING_ON_LEOPARD) + bound = CGPathGetPathBoundingBox(m_path); +#else + bound = CGPathGetBoundingBox(m_path); +#endif return CGRectIsNull(bound) ? CGRectZero : bound; } diff --git a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm index 46d10b4..f30b181 100644 --- a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm +++ b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm @@ -240,6 +240,24 @@ static CTFontDescriptorRef cascadeToLastResortAndDisableSwashesFontDescriptor() return descriptor; } +// Adding a cascade list breaks the font on Leopard +static bool canSetCascadeListForCustomFont() +{ +#if PLATFORM(CHROMIUM) + static SInt32 systemVersion; + if (!systemVersion) { + if (Gestalt(gestaltSystemVersion, &systemVersion) != noErr) + return false; + } + + return systemVersion >= 0x1060; +#elif !defined(BUILDING_ON_LEOPARD) + return true; +#else + return false; +#endif +} + CTFontRef FontPlatformData::ctFont() const { if (m_CTFont) @@ -247,7 +265,7 @@ CTFontRef FontPlatformData::ctFont() const #if PLATFORM(CHROMIUM) if (m_inMemoryFont) { - m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_inMemoryFont->cgFont(), m_size, 0, cascadeToLastResortFontDescriptor())); + m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_inMemoryFont->cgFont(), m_size, 0, canSetCascadeListForCustomFont() ? cascadeToLastResortFontDescriptor() : 0)); return m_CTFont.get(); } #endif @@ -263,7 +281,7 @@ CTFontRef FontPlatformData::ctFont() const fontDescriptor = cascadeToLastResortFontDescriptor(); m_CTFont.adoptCF(CTFontCreateCopyWithAttributes(m_CTFont.get(), m_size, 0, fontDescriptor)); } else - m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, cascadeToLastResortFontDescriptor())); + m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_cgFont.get(), m_size, 0, canSetCascadeListForCustomFont() ? cascadeToLastResortFontDescriptor() : 0)); if (m_widthVariant != RegularWidth) { int featureTypeValue = kTextSpacingType; diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index 5c29164..e9d1bc1 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -1617,7 +1617,12 @@ bool MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin() const bool MediaPlayerPrivateGStreamer::supportsFullscreen() const { +#if defined(BUILDING_ON_LEOPARD) + // See + return false; +#else return true; +#endif } PlatformMedia MediaPlayerPrivateGStreamer::platformMedia() const diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index a07090a..6614adb 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -33,6 +33,11 @@ #include #include +#if defined(BUILDING_ON_LEOPARD) +// Undefined when compiling agains the 10.5 SDK. +#define kCTVersionNumber10_6 0x00030000 +#endif + using namespace std; namespace WebCore { diff --git a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm index 591822e..91dd426 100644 --- a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm +++ b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm @@ -52,17 +52,30 @@ static void invalidateFontCache(void*) fontCache()->invalidate(); } +#if !defined(BUILDING_ON_LEOPARD) static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef) { ASSERT_UNUSED(observer, observer == fontCache()); ASSERT_UNUSED(name, CFEqual(name, kCTFontManagerRegisteredFontsChangedNotification)); invalidateFontCache(0); } +#else +static void fontCacheATSNotificationCallback(ATSFontNotificationInfoRef, void*) +{ + invalidateFontCache(0); +} +#endif void FontCache::platformInit() { wkSetUpFontCache(); +#if !defined(BUILDING_ON_LEOPARD) CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately); +#else + // kCTFontManagerRegisteredFontsChangedNotification does not exist on Leopard and earlier. + // FIXME: Passing kATSFontNotifyOptionReceiveWhileSuspended may be an overkill and does not seem to work anyway. + ATSFontNotificationSubscribe(fontCacheATSNotificationCallback, kATSFontNotifyOptionReceiveWhileSuspended, 0, 0); +#endif } static int toAppKitFontWeight(FontWeight fontWeight) diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index f825ced..cfddf36 100644 --- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -78,6 +78,10 @@ private: FontCustomPlatformData::~FontCustomPlatformData() { +#ifdef BUILDING_ON_LEOPARD + if (m_atsContainer) + ATSFontDeactivate(m_atsContainer, NULL, kATSOptionFlagsDefault); +#endif #if USE(SKIA_ON_MAC_CHROMIUM) SkSafeUnref(m_typeface); #endif @@ -111,15 +115,51 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) } #endif + ATSFontContainerRef containerRef = 0; + RetainPtr cgFontRef; + +#ifndef BUILDING_ON_LEOPARD RetainPtr bufferData(AdoptCF, buffer->createCFData()); RetainPtr dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get())); cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get())); if (!cgFontRef) return 0; +#else + // Use ATS to activate the font. + + // The value "3" means that the font is private and can't be seen by anyone else. + ATSFontActivateFromMemory((void*)buffer->data(), buffer->size(), 3, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &containerRef); + if (!containerRef) + return 0; + ItemCount fontCount; + ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 0, NULL, &fontCount); + + // We just support the first font in the list. + if (fontCount == 0) { + ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); + return 0; + } + + ATSFontRef fontRef = 0; + ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 1, &fontRef, NULL); + if (!fontRef) { + ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); + return 0; + } + + cgFontRef.adoptCF(CGFontCreateWithPlatformFont(&fontRef)); + // Workaround for . + if (cgFontRef && !CGFontGetNumberOfGlyphs(cgFontRef.get())) + cgFontRef = 0; + if (!cgFontRef) { + ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); + return 0; + } +#endif // !defined(BUILDING_ON_LEOPARD) - FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(cgFontRef.leakRef()); + FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(containerRef, cgFontRef.leakRef()); #if USE(SKIA_ON_MAC_CHROMIUM) RemoteFontStream* stream = new RemoteFontStream(buffer); fontCustomPlatformData->m_typeface = SkTypeface::CreateFromStream(stream); diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h index b6e611d..562eb1f 100644 --- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h @@ -30,6 +30,8 @@ #include typedef struct CGFont* CGFontRef; +typedef UInt32 ATSFontContainerRef; +typedef UInt32 ATSFontRef; #if USE(SKIA_ON_MAC_CHROMIUM) class SkTypeface; @@ -43,8 +45,9 @@ class SharedBuffer; struct FontCustomPlatformData { WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); public: - explicit FontCustomPlatformData(CGFontRef cgFont) - : m_cgFont(cgFont) + FontCustomPlatformData(ATSFontContainerRef container, CGFontRef cgFont) + : m_atsContainer(container) + , m_cgFont(cgFont) #if USE(SKIA_ON_MAC_CHROMIUM) , m_typeface(0) #endif diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index 5d9a146..d5d5560 100644 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -233,6 +233,15 @@ void SimpleFontData::platformInit() NSString *familyName = [m_platformData.font() familyName]; if ([familyName isEqualToString:@"Times"] || [familyName isEqualToString:@"Helvetica"] || [familyName isEqualToString:@"Courier"]) ascent += floorf(((ascent + descent) * 0.15f) + 0.5f); +#if defined(BUILDING_ON_LEOPARD) + else if ([familyName isEqualToString:@"Geeza Pro"]) { + // Geeza Pro has glyphs that draw slightly above the ascent or far below the descent. Adjust + // those vertical metrics to better match reality, so that diacritics at the bottom of one line + // do not overlap diacritics at the top of the next line. + ascent *= 1.08f; + descent *= 2.f; + } +#endif // Compute and store line spacing, before the line metrics hacks are applied. m_fontMetrics.setLineSpacing(lroundf(ascent) + lroundf(descent) + lroundf(lineGap)); diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.h b/Source/WebCore/platform/graphics/mac/WebLayer.h index 65569ce..bb0f444 100644 --- a/Source/WebCore/platform/graphics/mac/WebLayer.h +++ b/Source/WebCore/platform/graphics/mac/WebLayer.h @@ -36,6 +36,13 @@ namespace WebCore { class PlatformCALayerClient; } +#if defined(BUILDING_ON_LEOPARD) +@interface CALayer(WebLayerInternal) +- (CGAffineTransform)contentsTransform; +- (void)setContentsTransform:(CGAffineTransform)t; +@end +#endif + @interface WebLayer : CALayer { } diff --git a/Source/WebCore/platform/mac/CursorMac.mm b/Source/WebCore/platform/mac/CursorMac.mm index 07875f2..d208533 100644 --- a/Source/WebCore/platform/mac/CursorMac.mm +++ b/Source/WebCore/platform/mac/CursorMac.mm @@ -254,7 +254,11 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ContextMenu: +#if !defined(BUILDING_ON_LEOPARD) m_platformCursor = [NSCursor contextualMenuCursor]; +#else + m_platformCursor = createNamedCursor("contextMenuCursor", 3, 2); +#endif break; case Cursor::Alias: @@ -274,11 +278,19 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NoDrop: +#if !defined(BUILDING_ON_LEOPARD) m_platformCursor = [NSCursor operationNotAllowedCursor]; +#else + m_platformCursor = createNamedCursor("noDropCursor", 3, 1); +#endif break; case Cursor::Copy: +#if !defined(BUILDING_ON_LEOPARD) m_platformCursor = [NSCursor dragCopyCursor]; +#else + m_platformCursor = createNamedCursor("copyCursor", 3, 2); +#endif break; case Cursor::None: @@ -286,7 +298,11 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NotAllowed: +#if !defined(BUILDING_ON_LEOPARD) m_platformCursor = [NSCursor operationNotAllowedCursor]; +#else + m_platformCursor = createNamedCursor("notAllowedCursor", 11, 11); +#endif break; case Cursor::ZoomIn: diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp index e65615d..1073087 100644 --- a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp +++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp @@ -29,20 +29,40 @@ #include #include +#ifdef BUILDING_ON_LEOPARD +#include +#endif + namespace WebCore { static const double systemActivityInterval = 1; DisplaySleepDisabler::DisplaySleepDisabler(const char* reason) : m_disableDisplaySleepAssertion(0) +#ifdef BUILDING_ON_LEOPARD + , m_systemActivityTimer(this, &DisplaySleepDisabler::systemActivityTimerFired) +#endif { +#ifndef BUILDING_ON_LEOPARD RetainPtr reasonCF(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8)); IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion); +#else + UNUSED_PARAM(reason); + IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &m_disableDisplaySleepAssertion); + m_systemActivityTimer.startRepeating(systemActivityInterval); +#endif } DisplaySleepDisabler::~DisplaySleepDisabler() { IOPMAssertionRelease(m_disableDisplaySleepAssertion); } + +#ifdef BUILDING_ON_LEOPARD +void DisplaySleepDisabler::systemActivityTimerFired(Timer*) +{ + UpdateSystemActivity(OverallAct); +} +#endif } diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.h b/Source/WebCore/platform/mac/DisplaySleepDisabler.h index 3958a9f..2e466dc1 100644 --- a/Source/WebCore/platform/mac/DisplaySleepDisabler.h +++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.h @@ -29,6 +29,10 @@ #include #include +#ifdef BUILDING_ON_LEOPARD +#include "Timer.h" +#endif + namespace WebCore { class DisplaySleepDisabler { @@ -36,11 +40,18 @@ class DisplaySleepDisabler { public: static PassOwnPtr create(const char* reason) { return adoptPtr(new DisplaySleepDisabler(reason)); } ~DisplaySleepDisabler(); - + private: DisplaySleepDisabler(const char* reason); + +#ifdef BUILDING_ON_LEOPARD + void systemActivityTimerFired(Timer*); +#endif uint32_t m_disableDisplaySleepAssertion; +#ifdef BUILDING_ON_LEOPARD + Timer m_systemActivityTimer; +#endif }; } diff --git a/Source/WebCore/platform/mac/HTMLConverter.h b/Source/WebCore/platform/mac/HTMLConverter.h index ddcd3b9..ea1b85d 100644 --- a/Source/WebCore/platform/mac/HTMLConverter.h +++ b/Source/WebCore/platform/mac/HTMLConverter.h @@ -79,10 +79,12 @@ namespace WebCore { } _flags; } +#if !defined(BUILDING_ON_LEOPARD) - (id)init; - (id)initWithDOMRange:(DOMRange *)domRange; - (NSAttributedString *)attributedString; +#endif + (NSAttributedString *)editingAttributedStringFromRange:(WebCore::Range*)range; @end diff --git a/Source/WebCore/platform/mac/HTMLConverter.mm b/Source/WebCore/platform/mac/HTMLConverter.mm index d3a9f75..22db81c 100644 --- a/Source/WebCore/platform/mac/HTMLConverter.mm +++ b/Source/WebCore/platform/mac/HTMLConverter.mm @@ -50,6 +50,7 @@ using namespace HTMLNames; static NSFileWrapper *fileWrapperForURL(DocumentLoader *, NSURL *); static NSFileWrapper *fileWrapperForElement(Element*); +#ifndef BUILDING_ON_LEOPARD // Additional control Unicode characters const unichar WebNextLineCharacter = 0x0085; @@ -95,8 +96,12 @@ static NSFont *WebDefaultFont() return defaultFont; } +#endif + @implementation WebHTMLConverter +#ifndef BUILDING_ON_LEOPARD + static NSFont *_fontForNameAndSize(NSString *fontName, CGFloat size, NSMutableDictionary *cache) { NSFontManager *fontManager = [NSFontManager sharedFontManager]; @@ -1652,6 +1657,8 @@ static NSInteger _colCompare(id block1, id block2, void *) return (0 == _errorCode) ? [[_attrStr retain] autorelease] : nil; } +#endif // !defined(BUILDING_ON_LEOPARD) + // This function uses TextIterator, which makes offsets in its result compatible with HTML editing. + (NSAttributedString *)editingAttributedStringFromRange:(Range*)range { diff --git a/Source/WebCore/platform/mac/PopupMenuMac.mm b/Source/WebCore/platform/mac/PopupMenuMac.mm index 4d21732..4607781 100644 --- a/Source/WebCore/platform/mac/PopupMenuMac.mm +++ b/Source/WebCore/platform/mac/PopupMenuMac.mm @@ -75,8 +75,10 @@ void PopupMenuMac::populate() if (!client()->shouldPopOver()) [m_popup.get() addItemWithTitle:@""]; +#ifndef BUILDING_ON_LEOPARD TextDirection menuTextDirection = client()->menuStyle().textDirection(); [m_popup.get() setUserInterfaceLayoutDirection:menuTextDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; +#endif // !defined(BUILDING_ON_LEOPARD) ASSERT(client()); int size = client()->listSize(); @@ -96,6 +98,7 @@ void PopupMenuMac::populate() [attributes setObject:font forKey:NSFontAttributeName]; } +#ifndef BUILDING_ON_LEOPARD RetainPtr paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment]; NSWritingDirection writingDirection = style.textDirection() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; @@ -106,6 +109,7 @@ void PopupMenuMac::populate() [attributes setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName]; } [attributes setObject:paragraphStyle.get() forKey:NSParagraphStyleAttributeName]; +#endif // !defined(BUILDING_ON_LEOPARD) // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. diff --git a/Source/WebCore/platform/mac/ScrollElasticityController.mm b/Source/WebCore/platform/mac/ScrollElasticityController.mm index e4aec76..7a75384 100644 --- a/Source/WebCore/platform/mac/ScrollElasticityController.mm +++ b/Source/WebCore/platform/mac/ScrollElasticityController.mm @@ -33,6 +33,12 @@ #if ENABLE(RUBBER_BANDING) +#ifdef BUILDING_ON_LEOPARD +@interface NSProcessInfo (ScrollAnimatorMacExt) +- (NSTimeInterval)systemUptime; +@end +#endif + #if ENABLE(RUBBER_BANDING) static NSTimeInterval systemUptime() { -- 2.7.4