diff options
Diffstat (limited to 'WebCore/platform/graphics/mac')
9 files changed, 31 insertions, 35 deletions
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp index e6a7bef..d353d55 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -462,7 +462,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() if (ch == '\t' && m_run.allowTabs()) { float tabWidth = m_font.tabWidth(*fontData); advance.width = tabWidth - fmodf(m_run.xPos() + m_totalWidth + widthSinceLastRounding, tabWidth); - } else if (ch == zeroWidthSpace || Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) { + } else if (ch == zeroWidthSpace || (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace)) { advance.width = 0; glyph = fontData->spaceGlyph(); } @@ -518,7 +518,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() // Check to see if the next character is a "rounding hack character", if so, adjust the // width so that the total run width will be on an integer boundary. - if (m_run.applyWordRounding() && !lastGlyph && Font::isRoundingHackCharacter(nextCh) || m_run.applyRunRounding() && lastGlyph) { + if ((m_run.applyWordRounding() && !lastGlyph && Font::isRoundingHackCharacter(nextCh)) || (m_run.applyRunRounding() && lastGlyph)) { CGFloat totalWidth = widthSinceLastRounding + advance.width; widthSinceLastRounding = ceilCGFloat(totalWidth); CGFloat extraWidth = widthSinceLastRounding - totalWidth; diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp index 7ff316c..c24a914 100644 --- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp @@ -280,7 +280,7 @@ static ATSUStyle initializeATSUStyle(const SimpleFontData* fontData, Typesetting if (!addResult.second) return atsuStyle; - ATSUFontID fontID = fontData->platformData().m_atsuFontID; + ATSUFontID fontID = fontData->platformData().ctFont() ? CTFontGetPlatformFont(fontData->platformData().ctFont(), 0) : 0; if (!fontID) { LOG_ERROR("unable to get ATSUFontID for %p", fontData->platformData().font()); fontData->m_ATSUStyleMap.remove(addResult.first); diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp index cbb7610..42e7897 100644 --- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp @@ -138,8 +138,8 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC const short rtlForcedEmbeddingLevelValue = 1; static const void* ltrOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, <rForcedEmbeddingLevelValue) }; static const void* rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) }; - static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); - static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, sizeof(optionKeys) / sizeof(*optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) }; diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index cead71b..d04d0e4 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -40,7 +40,7 @@ FontCustomPlatformData::~FontCustomPlatformData() FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation orientation, FontRenderingMode) { - return FontPlatformData(m_cgFont, (ATSUFontID)m_atsFont, size, bold, italic, orientation); + return FontPlatformData(m_cgFont, size, bold, italic, orientation); } FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) @@ -66,7 +66,6 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) #endif ATSFontContainerRef containerRef = 0; - ATSFontRef fontRef = 0; RetainPtr<CGFontRef> cgFontRef; @@ -93,6 +92,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return 0; } + ATSFontRef fontRef = 0; ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 1, &fontRef, NULL); if (!fontRef) { ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); @@ -111,7 +111,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) } #endif // !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - return new FontCustomPlatformData(containerRef, fontRef, cgFontRef.releaseRef()); + return new FontCustomPlatformData(containerRef, cgFontRef.releaseRef()); } bool FontCustomPlatformData::supportsFormat(const String& format) diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h index 7702457..c11858c 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h @@ -37,9 +37,12 @@ class FontPlatformData; class SharedBuffer; struct FontCustomPlatformData : Noncopyable { - FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont) - : m_atsContainer(container), m_atsFont(atsFont), m_cgFont(cgFont) - {} + FontCustomPlatformData(ATSFontContainerRef container, CGFontRef cgFont) + : m_atsContainer(container) + , m_cgFont(cgFont) + { + } + ~FontCustomPlatformData(); FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontOrientation = Horizontal, FontRenderingMode = NormalRenderingMode); @@ -47,11 +50,10 @@ struct FontCustomPlatformData : Noncopyable { static bool supportsFormat(const String&); ATSFontContainerRef m_atsContainer; - ATSFontRef m_atsFont; CGFontRef m_cgFont; }; -FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer); +FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer*); } diff --git a/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/WebCore/platform/graphics/mac/GraphicsContextMac.mm index 15cae20..c149d70 100644 --- a/WebCore/platform/graphics/mac/GraphicsContextMac.mm +++ b/WebCore/platform/graphics/mac/GraphicsContextMac.mm @@ -57,23 +57,19 @@ static void drawFocusRingToContext(CGContextRef context, CGPathRef focusRingPath #endif } -void GraphicsContext::drawFocusRing(const Vector<Path>& paths, int width, int offset, const Color& color) +void GraphicsContext::drawFocusRing(const Path& path, int width, int /*offset*/, const Color& color) { + // FIXME: Use 'offset' for something? http://webkit.org/b/49909 + if (paintingDisabled()) return; - + int radius = (width - 1) / 2; - offset += radius; CGColorRef colorRef = color.isValid() ? cachedCGColor(color, ColorSpaceDeviceRGB) : 0; - RetainPtr<CGMutablePathRef> focusRingPath(AdoptCF, CGPathCreateMutable()); - unsigned pathCount = paths.size(); - for (unsigned i = 0; i < pathCount; i++) - CGPathAddPath(focusRingPath.get(), 0, paths[i].platformPath()); - - drawFocusRingToContext(platformContext(), focusRingPath.get(), colorRef, radius); -} - + drawFocusRingToContext(platformContext(), path.platformPath(), colorRef, radius); +} + void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index a2325da..1538e07 100644 --- a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -316,7 +316,7 @@ static void disableComponentsOnce() {'imdc', 'pdf ', 'appl', 0, 0}, }; - for (size_t i = 0; i < sizeof(componentsToDisable)/sizeof(componentsToDisable[0]); ++i) + for (size_t i = 0; i < WTF_ARRAY_LENGTH(componentsToDisable); ++i) wkQTMovieDisableComponent(componentsToDisable[i]); } @@ -896,12 +896,12 @@ void MediaPlayerPrivateQTKit::setPreservesPitch(bool preservesPitch) if ([[m_qtMovie.get() attributeForKey:QTMovieRateChangesPreservePitchAttribute] boolValue] == preservesPitch) return; - NSDictionary *movieAttributes = [[m_qtMovie.get() movieAttributes] mutableCopy]; + RetainPtr<NSDictionary> movieAttributes(AdoptNS, [[m_qtMovie.get() movieAttributes] mutableCopy]); ASSERT(movieAttributes); - [movieAttributes setValue:[NSNumber numberWithBool:preservesPitch] forKey:QTMovieRateChangesPreservePitchAttribute]; + [movieAttributes.get() setValue:[NSNumber numberWithBool:preservesPitch] forKey:QTMovieRateChangesPreservePitchAttribute]; m_timeToRestore = currentTime(); - createQTMovie([movieAttributes valueForKey:QTMovieURLAttribute], movieAttributes); + createQTMovie([movieAttributes.get() valueForKey:QTMovieURLAttribute], movieAttributes.get()); } PassRefPtr<TimeRanges> MediaPlayerPrivateQTKit::buffered() const diff --git a/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm b/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm index beea018..4b2e7b2 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm +++ b/WebCore/platform/graphics/mac/SimpleFontDataATSUI.mm @@ -48,8 +48,8 @@ void SimpleFontData::checkShapesArabic() const ASSERT(!m_checkedShapesArabic); m_checkedShapesArabic = true; - - ATSUFontID fontID = m_platformData.m_atsuFontID; + + ATSUFontID fontID = m_platformData.ctFont() ? CTFontGetPlatformFont(m_platformData.ctFont(), 0) : 0; if (!fontID) { LOG_ERROR("unable to get ATSUFontID for %@", m_platformData.font()); return; @@ -59,7 +59,7 @@ void SimpleFontData::checkShapesArabic() const // heuristic is that if such a font has a glyph metamorphosis table, then // it includes shaping information for Arabic. FourCharCode tables[] = { 'morx', 'mort' }; - for (unsigned i = 0; i < sizeof(tables) / sizeof(tables[0]); ++i) { + for (size_t i = 0; i < WTF_ARRAY_LENGTH(tables); ++i) { ByteCount tableSize; OSStatus status = ATSFontGetTable(fontID, tables[i], 0, 0, 0, &tableSize); if (status == noErr) { diff --git a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp index db6de49..452bd54 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp +++ b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp @@ -62,15 +62,13 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures ? ligaturesAllowed : ligaturesNotAllowed, orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled, - sizeof(keysWithKerningDisabled) / sizeof(*keysWithKerningDisabled), - &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + WTF_ARRAY_LENGTH(keysWithKerningDisabled), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); } else { // By omitting the kCTKernAttributeName attribute, we get Core Text's standard kerning. static const void* keysWithKerningEnabled[] = { kCTFontAttributeName, kCTLigatureAttributeName, kCTVerticalFormsAttributeName }; const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed, orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled, - sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled), - &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + WTF_ARRAY_LENGTH(keysWithKerningEnabled), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); } return attributesDictionary.get(); |