diff options
author | Russell Brenner <russellbrenner@google.com> | 2010-11-18 17:33:13 -0800 |
---|---|---|
committer | Russell Brenner <russellbrenner@google.com> | 2010-12-02 13:47:21 -0800 |
commit | 6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch) | |
tree | 103a13998c33944d6ab3b8318c509a037e639460 /WebCore/platform/graphics/mac | |
parent | bdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff) | |
download | external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2 |
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebCore/platform/graphics/mac')
-rw-r--r-- | WebCore/platform/graphics/mac/ComplexTextController.cpp | 4 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp | 37 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/FontCacheMac.mm | 4 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/FontMac.mm | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/GraphicsContext3DMac.mm | 11 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/GraphicsLayerMac.h (renamed from WebCore/platform/graphics/mac/GraphicsLayerCA.h) | 12 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/GraphicsLayerMac.mm (renamed from WebCore/platform/graphics/mac/GraphicsLayerCA.mm) | 268 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h | 12 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm | 196 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp | 6 | ||||
-rw-r--r-- | WebCore/platform/graphics/mac/SimpleFontDataMac.mm | 31 |
13 files changed, 327 insertions, 260 deletions
diff --git a/WebCore/platform/graphics/mac/ComplexTextController.cpp b/WebCore/platform/graphics/mac/ComplexTextController.cpp index a2733f8..e6a7bef 100644 --- a/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -487,7 +487,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() advance.width += m_font.letterSpacing(); // Handle justification and word-spacing. - if (glyph == fontData->spaceGlyph()) { + if (treatAsSpace) { // Account for padding. WebCore uses space padding to justify text. // We distribute the specified padding over the available spaces in the run. if (m_padding) { @@ -503,7 +503,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() } // Account for word-spacing. - if (treatAsSpace && characterIndex > 0 && !Font::treatAsSpace(*m_run.data(characterIndex - 1)) && m_font.wordSpacing()) + if (characterIndex > 0 && !Font::treatAsSpace(*m_run.data(characterIndex - 1)) && m_font.wordSpacing()) advance.width += m_font.wordSpacing(); } } diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp index 1656854..7ff316c 100644 --- a/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp @@ -262,7 +262,7 @@ static void disableLigatures(const SimpleFontData* fontData, ATSUStyle atsuStyle // Don't be too aggressive: if the font doesn't contain 'a', then assume that any ligatures it contains are // in characters that always go through ATSUI, and therefore allow them. Geeza Pro is an example. // See bugzilla 5166. - if ((typesettingFeatures & Ligatures) || fontData->platformData().allowsLigatures()) + if ((typesettingFeatures & Ligatures) || (fontData->orientation() == Horizontal && fontData->platformData().allowsLigatures())) return; ATSUFontFeatureType featureTypes[] = { kLigaturesType }; diff --git a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp index 744e6d4..cbb7610 100644 --- a/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp +++ b/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp @@ -24,6 +24,7 @@ #include "config.h" #include "ComplexTextController.h" +#include "WebCoreSystemInterface.h" #if USE(CORE_TEXT) @@ -101,6 +102,23 @@ void ComplexTextController::ComplexTextRun::createTextRunFromFontDataCoreText(bo m_advances = m_advancesVector.data(); } +struct ProviderInfo { + const UChar* cp; + unsigned length; + CFDictionaryRef attributes; +}; + +static const UniChar* provideStringAndAttributes(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void* refCon) +{ + ProviderInfo* info = static_cast<struct ProviderInfo*>(refCon); + if (stringIndex < 0 || static_cast<unsigned>(stringIndex) >= info->length) + return 0; + + *charCount = info->length - stringIndex; + *attributes = info->attributes; + return info->cp + stringIndex; +} + void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UChar* cp, unsigned length, unsigned stringLocation, const SimpleFontData* fontData) { if (!fontData) { @@ -112,10 +130,6 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC if (m_fallbackFonts && fontData != m_font.primaryFont()) m_fallbackFonts->add(fontData); - RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(NULL, cp, length, kCFAllocatorNull)); - - RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(NULL, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures()))); - RetainPtr<CTLineRef> line; if (!m_mayUseNaturalWritingDirection || m_run.directionalOverride()) { @@ -126,11 +140,22 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC 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); + +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) }; + RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions)); +#else + RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, cp, length, kCFAllocatorNull)); + RetainPtr<CFAttributedStringRef> attributedString(AdoptCF, CFAttributedStringCreate(kCFAllocatorDefault, string.get(), fontData->getCFStringAttributes(m_font.typesettingFeatures()))); RetainPtr<CTTypesetterRef> typesetter(AdoptCF, CTTypesetterCreateWithAttributedStringAndOptions(attributedString.get(), m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions)); +#endif line.adoptCF(CTTypesetterCreateLine(typesetter.get(), CFRangeMake(0, 0))); - } else - line.adoptCF(CTLineCreateWithAttributedString(attributedString.get())); + } else { + ProviderInfo info = { cp, length, fontData->getCFStringAttributes(m_font.typesettingFeatures()) }; + + line.adoptCF(wkCreateCTLineWithUniCharProvider(&provideStringAndAttributes, 0, &info)); + } CFArrayRef runArray = CTLineGetGlyphRuns(line.get()); diff --git a/WebCore/platform/graphics/mac/FontCacheMac.mm b/WebCore/platform/graphics/mac/FontCacheMac.mm index 313db1c..068bd8e 100644 --- a/WebCore/platform/graphics/mac/FontCacheMac.mm +++ b/WebCore/platform/graphics/mac/FontCacheMac.mm @@ -140,7 +140,7 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteFont]; NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont]; - FontPlatformData alternateFont(substituteFont, + FontPlatformData alternateFont(substituteFont, platformData.size(), !font.isPlatformFont() && isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(substituteFontWeight), !font.isPlatformFont() && (traits & NSFontItalicTrait) && !(substituteFontTraits & NSFontItalicTrait), platformData.m_orientation); @@ -211,7 +211,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD bool syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight); bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait); - return new FontPlatformData(platformFont, syntheticBold, syntheticOblique, fontDescription.orientation()); + return new FontPlatformData(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation()); } } // namespace WebCore diff --git a/WebCore/platform/graphics/mac/FontMac.mm b/WebCore/platform/graphics/mac/FontMac.mm index d760f5a..8dc741b 100644 --- a/WebCore/platform/graphics/mac/FontMac.mm +++ b/WebCore/platform/graphics/mac/FontMac.mm @@ -52,7 +52,7 @@ static void showGlyphsWithAdvances(const SimpleFontData* font, CGContextRef cont const FontPlatformData& platformData = font->platformData(); if (!platformData.isColorBitmapFont()) { CGAffineTransform savedMatrix; - bool isVertical = platformData.orientation() == Vertical; + bool isVertical = font->orientation() == Vertical; if (isVertical) { CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0); diff --git a/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp b/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp index 48ad1c0..9524cd2 100644 --- a/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp +++ b/WebCore/platform/graphics/mac/GlyphPageTreeNodeMac.cpp @@ -40,7 +40,7 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b bool haveGlyphs = false; #ifndef BUILDING_ON_TIGER - if (fontData->platformData().orientation() == Horizontal) { + if (fontData->orientation() == Horizontal || fontData->isBrokenIdeographFont()) { Vector<CGGlyph, 512> glyphs(bufferLength); wkGetGlyphsForCharacters(fontData->platformData().cgFont(), buffer, glyphs.data(), bufferLength); for (unsigned i = 0; i < length; ++i) { diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm index ab6993f..321d0ef 100644 --- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm +++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm @@ -251,17 +251,6 @@ bool GraphicsContext3D::isGLES2Compliant() const return false; } -bool GraphicsContext3D::isGLES2NPOTStrict() const -{ - return false; -} - -bool GraphicsContext3D::isErrorGeneratedOnOutOfBoundsAccesses() const -{ - return false; -} - - } #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerMac.h index 17a67ac..5d4dfe2 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h +++ b/WebCore/platform/graphics/mac/GraphicsLayerMac.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef GraphicsLayerCA_h -#define GraphicsLayerCA_h +#ifndef GraphicsLayerMac_h +#define GraphicsLayerMac_h #if USE(ACCELERATED_COMPOSITING) @@ -43,11 +43,11 @@ namespace WebCore { -class GraphicsLayerCA : public GraphicsLayer { +class GraphicsLayerMac : public GraphicsLayer { public: - GraphicsLayerCA(GraphicsLayerClient*); - virtual ~GraphicsLayerCA(); + GraphicsLayerMac(GraphicsLayerClient*); + virtual ~GraphicsLayerMac(); virtual void setName(const String&); @@ -385,4 +385,4 @@ private: #endif // USE(ACCELERATED_COMPOSITING) -#endif // GraphicsLayerCA_h +#endif // GraphicsLayerMac_h diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerMac.mm index c4128ef..f9b16a0 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm +++ b/WebCore/platform/graphics/mac/GraphicsLayerMac.mm @@ -27,7 +27,7 @@ #if USE(ACCELERATED_COMPOSITING) -#import "GraphicsLayerCA.h" +#import "GraphicsLayerMac.h" #import "Animation.h" #import "BlockExceptions.h" @@ -90,12 +90,12 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) @end @interface WebAnimationDelegate : NSObject { - WebCore::GraphicsLayerCA* m_graphicsLayer; + WebCore::GraphicsLayerMac* m_graphicsLayer; } - (void)animationDidStart:(CAAnimation *)anim; -- (WebCore::GraphicsLayerCA*)graphicsLayer; -- (void)setLayer:(WebCore::GraphicsLayerCA*)graphicsLayer; +- (WebCore::GraphicsLayerMac*)graphicsLayer; +- (void)setLayer:(WebCore::GraphicsLayerMac*)graphicsLayer; @end @@ -107,12 +107,12 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) m_graphicsLayer->animationDidStart(animation); } -- (WebCore::GraphicsLayerCA*)graphicsLayer +- (WebCore::GraphicsLayerMac*)graphicsLayer { return m_graphicsLayer; } -- (void)setLayer:(WebCore::GraphicsLayerCA*)graphicsLayer +- (void)setLayer:(WebCore::GraphicsLayerMac*)graphicsLayer { m_graphicsLayer = graphicsLayer; } @@ -342,10 +342,10 @@ static bool animationHasStepsTimingFunction(const KeyframeValueList& valueList, PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) { - return new GraphicsLayerCA(client); + return new GraphicsLayerMac(client); } -GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client) +GraphicsLayerMac::GraphicsLayerMac(GraphicsLayerClient* client) : GraphicsLayer(client) , m_contentsLayerPurpose(NoContentsLayer) , m_contentsLayerHasBackgroundColor(false) @@ -367,11 +367,11 @@ GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client) END_BLOCK_OBJC_EXCEPTIONS } -GraphicsLayerCA::~GraphicsLayerCA() +GraphicsLayerMac::~GraphicsLayerMac() { // We release our references to the CALayers here, but do not actively unparent them, // since that will cause a commit and break our batched commit model. The layers will - // get released when the rootmost modified GraphicsLayerCA rebuilds its child layers. + // get released when the rootmost modified GraphicsLayerMac rebuilds its child layers. BEGIN_BLOCK_OBJC_EXCEPTIONS @@ -395,19 +395,19 @@ GraphicsLayerCA::~GraphicsLayerCA() END_BLOCK_OBJC_EXCEPTIONS } -void GraphicsLayerCA::setName(const String& name) +void GraphicsLayerMac::setName(const String& name) { String longName = String::format("CALayer(%p) GraphicsLayer(%p) ", m_layer.get(), this) + name; GraphicsLayer::setName(longName); noteLayerPropertyChanged(NameChanged); } -NativeLayer GraphicsLayerCA::nativeLayer() const +NativeLayer GraphicsLayerMac::nativeLayer() const { return m_layer.get(); } -bool GraphicsLayerCA::setChildren(const Vector<GraphicsLayer*>& children) +bool GraphicsLayerMac::setChildren(const Vector<GraphicsLayer*>& children) { bool childrenChanged = GraphicsLayer::setChildren(children); if (childrenChanged) @@ -416,31 +416,31 @@ bool GraphicsLayerCA::setChildren(const Vector<GraphicsLayer*>& children) return childrenChanged; } -void GraphicsLayerCA::addChild(GraphicsLayer* childLayer) +void GraphicsLayerMac::addChild(GraphicsLayer* childLayer) { GraphicsLayer::addChild(childLayer); noteSublayersChanged(); } -void GraphicsLayerCA::addChildAtIndex(GraphicsLayer* childLayer, int index) +void GraphicsLayerMac::addChildAtIndex(GraphicsLayer* childLayer, int index) { GraphicsLayer::addChildAtIndex(childLayer, index); noteSublayersChanged(); } -void GraphicsLayerCA::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling) +void GraphicsLayerMac::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling) { GraphicsLayer::addChildBelow(childLayer, sibling); noteSublayersChanged(); } -void GraphicsLayerCA::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling) +void GraphicsLayerMac::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling) { GraphicsLayer::addChildAbove(childLayer, sibling); noteSublayersChanged(); } -bool GraphicsLayerCA::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) +bool GraphicsLayerMac::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild) { if (GraphicsLayer::replaceChild(oldChild, newChild)) { noteSublayersChanged(); @@ -449,14 +449,14 @@ bool GraphicsLayerCA::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newCh return false; } -void GraphicsLayerCA::removeFromParent() +void GraphicsLayerMac::removeFromParent() { if (m_parent) - static_cast<GraphicsLayerCA*>(m_parent)->noteSublayersChanged(); + static_cast<GraphicsLayerMac*>(m_parent)->noteSublayersChanged(); GraphicsLayer::removeFromParent(); } -void GraphicsLayerCA::setMaskLayer(GraphicsLayer* layer) +void GraphicsLayerMac::setMaskLayer(GraphicsLayer* layer) { if (layer == m_maskLayer) return; @@ -467,10 +467,10 @@ void GraphicsLayerCA::setMaskLayer(GraphicsLayer* layer) propagateLayerChangeToReplicas(); if (m_replicatedLayer) - static_cast<GraphicsLayerCA*>(m_replicatedLayer)->propagateLayerChangeToReplicas(); + static_cast<GraphicsLayerMac*>(m_replicatedLayer)->propagateLayerChangeToReplicas(); } -void GraphicsLayerCA::setReplicatedLayer(GraphicsLayer* layer) +void GraphicsLayerMac::setReplicatedLayer(GraphicsLayer* layer) { if (layer == m_replicatedLayer) return; @@ -479,7 +479,7 @@ void GraphicsLayerCA::setReplicatedLayer(GraphicsLayer* layer) noteLayerPropertyChanged(ReplicatedLayerChanged); } -void GraphicsLayerCA::setReplicatedByLayer(GraphicsLayer* layer) +void GraphicsLayerMac::setReplicatedByLayer(GraphicsLayer* layer) { if (layer == m_replicaLayer) return; @@ -489,7 +489,7 @@ void GraphicsLayerCA::setReplicatedByLayer(GraphicsLayer* layer) noteLayerPropertyChanged(ReplicatedLayerChanged); } -void GraphicsLayerCA::setPosition(const FloatPoint& point) +void GraphicsLayerMac::setPosition(const FloatPoint& point) { if (point == m_position) return; @@ -498,7 +498,7 @@ void GraphicsLayerCA::setPosition(const FloatPoint& point) noteLayerPropertyChanged(PositionChanged); } -void GraphicsLayerCA::setAnchorPoint(const FloatPoint3D& point) +void GraphicsLayerMac::setAnchorPoint(const FloatPoint3D& point) { if (point == m_anchorPoint) return; @@ -507,7 +507,7 @@ void GraphicsLayerCA::setAnchorPoint(const FloatPoint3D& point) noteLayerPropertyChanged(AnchorPointChanged); } -void GraphicsLayerCA::setSize(const FloatSize& size) +void GraphicsLayerMac::setSize(const FloatSize& size) { if (size == m_size) return; @@ -516,7 +516,7 @@ void GraphicsLayerCA::setSize(const FloatSize& size) noteLayerPropertyChanged(SizeChanged); } -void GraphicsLayerCA::setTransform(const TransformationMatrix& t) +void GraphicsLayerMac::setTransform(const TransformationMatrix& t) { if (t == m_transform) return; @@ -525,7 +525,7 @@ void GraphicsLayerCA::setTransform(const TransformationMatrix& t) noteLayerPropertyChanged(TransformChanged); } -void GraphicsLayerCA::setChildrenTransform(const TransformationMatrix& t) +void GraphicsLayerMac::setChildrenTransform(const TransformationMatrix& t) { if (t == m_childrenTransform) return; @@ -534,7 +534,7 @@ void GraphicsLayerCA::setChildrenTransform(const TransformationMatrix& t) noteLayerPropertyChanged(ChildrenTransformChanged); } -void GraphicsLayerCA::moveOrCopyLayerAnimation(MoveOrCopy operation, const String& animationIdentifier, CALayer *fromLayer, CALayer *toLayer) +void GraphicsLayerMac::moveOrCopyLayerAnimation(MoveOrCopy operation, const String& animationIdentifier, CALayer *fromLayer, CALayer *toLayer) { NSString *animationID = animationIdentifier; CAAnimation *anim = [fromLayer animationForKey:animationID]; @@ -555,7 +555,7 @@ void GraphicsLayerCA::moveOrCopyLayerAnimation(MoveOrCopy operation, const Strin } } -void GraphicsLayerCA::moveOrCopyAnimationsForProperty(MoveOrCopy operation, AnimatedPropertyID property, CALayer *fromLayer, CALayer *toLayer) +void GraphicsLayerMac::moveOrCopyAnimationsForProperty(MoveOrCopy operation, AnimatedPropertyID property, CALayer *fromLayer, CALayer *toLayer) { // Look for running animations affecting this property. AnimationsMap::const_iterator end = m_runningAnimations.end(); @@ -570,7 +570,7 @@ void GraphicsLayerCA::moveOrCopyAnimationsForProperty(MoveOrCopy operation, Anim } } -void GraphicsLayerCA::setPreserves3D(bool preserves3D) +void GraphicsLayerMac::setPreserves3D(bool preserves3D) { if (preserves3D == m_preserves3D) return; @@ -579,7 +579,7 @@ void GraphicsLayerCA::setPreserves3D(bool preserves3D) noteLayerPropertyChanged(Preserves3DChanged); } -void GraphicsLayerCA::setMasksToBounds(bool masksToBounds) +void GraphicsLayerMac::setMasksToBounds(bool masksToBounds) { if (masksToBounds == m_masksToBounds) return; @@ -588,7 +588,7 @@ void GraphicsLayerCA::setMasksToBounds(bool masksToBounds) noteLayerPropertyChanged(MasksToBoundsChanged); } -void GraphicsLayerCA::setDrawsContent(bool drawsContent) +void GraphicsLayerMac::setDrawsContent(bool drawsContent) { if (drawsContent == m_drawsContent) return; @@ -597,7 +597,7 @@ void GraphicsLayerCA::setDrawsContent(bool drawsContent) noteLayerPropertyChanged(DrawsContentChanged); } -void GraphicsLayerCA::setBackgroundColor(const Color& color) +void GraphicsLayerMac::setBackgroundColor(const Color& color) { if (m_backgroundColorSet && m_backgroundColor == color) return; @@ -608,7 +608,7 @@ void GraphicsLayerCA::setBackgroundColor(const Color& color) noteLayerPropertyChanged(BackgroundColorChanged); } -void GraphicsLayerCA::clearBackgroundColor() +void GraphicsLayerMac::clearBackgroundColor() { if (!m_backgroundColorSet) return; @@ -618,7 +618,7 @@ void GraphicsLayerCA::clearBackgroundColor() noteLayerPropertyChanged(BackgroundColorChanged); } -void GraphicsLayerCA::setContentsOpaque(bool opaque) +void GraphicsLayerMac::setContentsOpaque(bool opaque) { if (m_contentsOpaque == opaque) return; @@ -627,7 +627,7 @@ void GraphicsLayerCA::setContentsOpaque(bool opaque) noteLayerPropertyChanged(ContentsOpaqueChanged); } -void GraphicsLayerCA::setBackfaceVisibility(bool visible) +void GraphicsLayerMac::setBackfaceVisibility(bool visible) { if (m_backfaceVisibility == visible) return; @@ -636,7 +636,7 @@ void GraphicsLayerCA::setBackfaceVisibility(bool visible) noteLayerPropertyChanged(BackfaceVisibilityChanged); } -void GraphicsLayerCA::setOpacity(float opacity) +void GraphicsLayerMac::setOpacity(float opacity) { float clampedOpacity = max(0.0f, min(opacity, 1.0f)); @@ -647,7 +647,7 @@ void GraphicsLayerCA::setOpacity(float opacity) noteLayerPropertyChanged(OpacityChanged); } -void GraphicsLayerCA::setNeedsDisplay() +void GraphicsLayerMac::setNeedsDisplay() { FloatRect hugeRect(-numeric_limits<float>::max() / 2, -numeric_limits<float>::max() / 2, numeric_limits<float>::max(), numeric_limits<float>::max()); @@ -655,7 +655,7 @@ void GraphicsLayerCA::setNeedsDisplay() setNeedsDisplayInRect(hugeRect); } -void GraphicsLayerCA::setNeedsDisplayInRect(const FloatRect& rect) +void GraphicsLayerMac::setNeedsDisplayInRect(const FloatRect& rect) { if (!drawsContent()) return; @@ -675,12 +675,12 @@ void GraphicsLayerCA::setNeedsDisplayInRect(const FloatRect& rect) noteLayerPropertyChanged(DirtyRectsChanged); } -void GraphicsLayerCA::setContentsNeedsDisplay() +void GraphicsLayerMac::setContentsNeedsDisplay() { noteLayerPropertyChanged(ContentsNeedsDisplay); } -void GraphicsLayerCA::setContentsRect(const IntRect& rect) +void GraphicsLayerMac::setContentsRect(const IntRect& rect) { if (rect == m_contentsRect) return; @@ -689,7 +689,7 @@ void GraphicsLayerCA::setContentsRect(const IntRect& rect) noteLayerPropertyChanged(ContentsRectChanged); } -bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& animationName, double timeOffset) +bool GraphicsLayerMac::addAnimation(const KeyframeValueList& valueList, const IntSize& boxSize, const Animation* anim, const String& animationName, double timeOffset) { ASSERT(!animationName.isEmpty()); @@ -720,7 +720,7 @@ bool GraphicsLayerCA::addAnimation(const KeyframeValueList& valueList, const Int return createdAnimations; } -void GraphicsLayerCA::pauseAnimation(const String& animationName, double timeOffset) +void GraphicsLayerMac::pauseAnimation(const String& animationName, double timeOffset) { if (!animationIsRunning(animationName)) return; @@ -737,7 +737,7 @@ void GraphicsLayerCA::pauseAnimation(const String& animationName, double timeOff noteLayerPropertyChanged(AnimationChanged); } -void GraphicsLayerCA::removeAnimation(const String& animationName) +void GraphicsLayerMac::removeAnimation(const String& animationName) { if (!animationIsRunning(animationName)) return; @@ -746,7 +746,7 @@ void GraphicsLayerCA::removeAnimation(const String& animationName) noteLayerPropertyChanged(AnimationChanged); } -void GraphicsLayerCA::animationDidStart(CAAnimation* caAnimation) +void GraphicsLayerMac::animationDidStart(CAAnimation* caAnimation) { bool hadNonZeroBeginTime = [[caAnimation valueForKey:WebKitAnimationBeginTimeSetKey] boolValue]; @@ -762,7 +762,7 @@ void GraphicsLayerCA::animationDidStart(CAAnimation* caAnimation) m_client->notifyAnimationStarted(this, startTime); } -void GraphicsLayerCA::setContentsToImage(Image* image) +void GraphicsLayerMac::setContentsToImage(Image* image) { if (image) { CGImageRef newImage = image->nativeImageForCurrentFrame(); @@ -799,7 +799,7 @@ void GraphicsLayerCA::setContentsToImage(Image* image) noteLayerPropertyChanged(ContentsImageChanged); } -void GraphicsLayerCA::setContentsToMedia(PlatformLayer* mediaLayer) +void GraphicsLayerMac::setContentsToMedia(PlatformLayer* mediaLayer) { if (mediaLayer == m_contentsLayer) return; @@ -811,7 +811,7 @@ void GraphicsLayerCA::setContentsToMedia(PlatformLayer* mediaLayer) noteLayerPropertyChanged(ContentsMediaLayerChanged); } -void GraphicsLayerCA::didDisplay(PlatformLayer* layer) +void GraphicsLayerMac::didDisplay(PlatformLayer* layer) { CALayer* sourceLayer; LayerMap* layerCloneMap; @@ -840,41 +840,41 @@ void GraphicsLayerCA::didDisplay(PlatformLayer* layer) } } -void GraphicsLayerCA::syncCompositingState() +void GraphicsLayerMac::syncCompositingState() { recursiveCommitChanges(); } -void GraphicsLayerCA::syncCompositingStateForThisLayerOnly() +void GraphicsLayerMac::syncCompositingStateForThisLayerOnly() { commitLayerChangesBeforeSublayers(); commitLayerChangesAfterSublayers(); } -void GraphicsLayerCA::recursiveCommitChanges() +void GraphicsLayerMac::recursiveCommitChanges() { commitLayerChangesBeforeSublayers(); if (m_maskLayer) - static_cast<GraphicsLayerCA*>(m_maskLayer)->commitLayerChangesBeforeSublayers(); + static_cast<GraphicsLayerMac*>(m_maskLayer)->commitLayerChangesBeforeSublayers(); const Vector<GraphicsLayer*>& childLayers = children(); size_t numChildren = childLayers.size(); for (size_t i = 0; i < numChildren; ++i) { - GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]); + GraphicsLayerMac* curChild = static_cast<GraphicsLayerMac*>(childLayers[i]); curChild->recursiveCommitChanges(); } if (m_replicaLayer) - static_cast<GraphicsLayerCA*>(m_replicaLayer)->recursiveCommitChanges(); + static_cast<GraphicsLayerMac*>(m_replicaLayer)->recursiveCommitChanges(); if (m_maskLayer) - static_cast<GraphicsLayerCA*>(m_maskLayer)->commitLayerChangesAfterSublayers(); + static_cast<GraphicsLayerMac*>(m_maskLayer)->commitLayerChangesAfterSublayers(); commitLayerChangesAfterSublayers(); } -void GraphicsLayerCA::commitLayerChangesBeforeSublayers() +void GraphicsLayerMac::commitLayerChangesBeforeSublayers() { if (!m_uncommittedChanges) return; @@ -951,7 +951,7 @@ void GraphicsLayerCA::commitLayerChangesBeforeSublayers() END_BLOCK_OBJC_EXCEPTIONS } -void GraphicsLayerCA::commitLayerChangesAfterSublayers() +void GraphicsLayerMac::commitLayerChangesAfterSublayers() { if (!m_uncommittedChanges) return; @@ -965,7 +965,7 @@ void GraphicsLayerCA::commitLayerChangesAfterSublayers() END_BLOCK_OBJC_EXCEPTIONS } -void GraphicsLayerCA::updateLayerNames() +void GraphicsLayerMac::updateLayerNames() { switch (structuralLayerPurpose()) { case StructuralLayerForPreserves3D: @@ -980,7 +980,7 @@ void GraphicsLayerCA::updateLayerNames() [m_layer.get() setName:name()]; } -void GraphicsLayerCA::updateSublayerList() +void GraphicsLayerMac::updateSublayerList() { NSMutableArray* newSublayers = nil; @@ -992,7 +992,7 @@ void GraphicsLayerCA::updateSublayerList() if (m_structuralLayer) { // Add the replica layer first. if (m_replicaLayer) - [newSublayers addObject:static_cast<GraphicsLayerCA*>(m_replicaLayer)->primaryLayer()]; + [newSublayers addObject:static_cast<GraphicsLayerMac*>(m_replicaLayer)->primaryLayer()]; // Add the primary layer. Even if we have negative z-order children, the primary layer always comes behind. [newSublayers addObject:m_layer.get()]; } else if (m_contentsLayer) { @@ -1004,7 +1004,7 @@ void GraphicsLayerCA::updateSublayerList() size_t numChildren = childLayers.size(); for (size_t i = 0; i < numChildren; ++i) { - GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]); + GraphicsLayerMac* curChild = static_cast<GraphicsLayerMac*>(childLayers[i]); CALayer *childLayer = curChild->layerForSuperlayer(); [newSublayers addObject:childLayer]; } @@ -1027,7 +1027,7 @@ void GraphicsLayerCA::updateSublayerList() [newSublayers release]; } -void GraphicsLayerCA::updateLayerPosition() +void GraphicsLayerMac::updateLayerPosition() { FloatSize usedSize = m_usingTiledLayer ? constrainedSize() : m_size; @@ -1052,7 +1052,7 @@ void GraphicsLayerCA::updateLayerPosition() } } -void GraphicsLayerCA::updateLayerSize() +void GraphicsLayerMac::updateLayerSize() { CGRect rect = CGRectMake(0, 0, m_size.width(), m_size.height()); if (m_structuralLayer) { @@ -1101,7 +1101,7 @@ void GraphicsLayerCA::updateLayerSize() updateLayerPosition(); } -void GraphicsLayerCA::updateAnchorPoint() +void GraphicsLayerMac::updateAnchorPoint() { [primaryLayer() setAnchorPoint:FloatPoint(m_anchorPoint.x(), m_anchorPoint.y())]; #if HAVE_MODERN_QUARTZCORE @@ -1122,7 +1122,7 @@ void GraphicsLayerCA::updateAnchorPoint() updateLayerPosition(); } -void GraphicsLayerCA::updateTransform() +void GraphicsLayerMac::updateTransform() { CATransform3D transform; copyTransform(transform, m_transform); @@ -1142,7 +1142,7 @@ void GraphicsLayerCA::updateTransform() } } -void GraphicsLayerCA::updateChildrenTransform() +void GraphicsLayerMac::updateChildrenTransform() { CATransform3D transform; copyTransform(transform, m_childrenTransform); @@ -1157,7 +1157,7 @@ void GraphicsLayerCA::updateChildrenTransform() } } -void GraphicsLayerCA::updateMasksToBounds() +void GraphicsLayerMac::updateMasksToBounds() { [m_layer.get() setMasksToBounds:m_masksToBounds]; @@ -1172,7 +1172,7 @@ void GraphicsLayerCA::updateMasksToBounds() updateDebugIndicators(); } -void GraphicsLayerCA::updateContentsOpaque() +void GraphicsLayerMac::updateContentsOpaque() { [m_layer.get() setOpaque:m_contentsOpaque]; @@ -1185,7 +1185,7 @@ void GraphicsLayerCA::updateContentsOpaque() } } -void GraphicsLayerCA::updateBackfaceVisibility() +void GraphicsLayerMac::updateBackfaceVisibility() { if (m_structuralLayer && structuralLayerPurpose() == StructuralLayerForReplicaFlattening) { [m_structuralLayer.get() setDoubleSided:m_backfaceVisibility]; @@ -1210,12 +1210,12 @@ void GraphicsLayerCA::updateBackfaceVisibility() } } -void GraphicsLayerCA::updateStructuralLayer() +void GraphicsLayerMac::updateStructuralLayer() { ensureStructuralLayer(structuralLayerPurpose()); } -void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose) +void GraphicsLayerMac::ensureStructuralLayer(StructuralLayerPurpose purpose) { if (purpose == NoStructuralLayer) { if (m_structuralLayer) { @@ -1300,7 +1300,7 @@ void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose) updateOpacityOnLayer(); } -GraphicsLayerCA::StructuralLayerPurpose GraphicsLayerCA::structuralLayerPurpose() const +GraphicsLayerMac::StructuralLayerPurpose GraphicsLayerMac::structuralLayerPurpose() const { if (preserves3D()) return StructuralLayerForPreserves3D; @@ -1311,7 +1311,7 @@ GraphicsLayerCA::StructuralLayerPurpose GraphicsLayerCA::structuralLayerPurpose( return NoStructuralLayer; } -void GraphicsLayerCA::updateLayerDrawsContent() +void GraphicsLayerMac::updateLayerDrawsContent() { bool needTiledLayer = requiresTiledLayer(m_size); if (needTiledLayer != m_usingTiledLayer) @@ -1325,7 +1325,7 @@ void GraphicsLayerCA::updateLayerDrawsContent() updateDebugIndicators(); } -void GraphicsLayerCA::updateLayerBackgroundColor() +void GraphicsLayerMac::updateLayerBackgroundColor() { if (!m_contentsLayer) return; @@ -1337,7 +1337,7 @@ void GraphicsLayerCA::updateLayerBackgroundColor() clearLayerBackgroundColor(m_contentsLayer.get()); } -void GraphicsLayerCA::updateContentsImage() +void GraphicsLayerMac::updateContentsImage() { if (m_pendingContentsImage) { if (!m_contentsLayer.get()) { @@ -1372,7 +1372,7 @@ void GraphicsLayerCA::updateContentsImage() } } -void GraphicsLayerCA::updateContentsMediaLayer() +void GraphicsLayerMac::updateContentsMediaLayer() { // Video layer was set as m_contentsLayer, and will get parented in updateSublayerList(). if (m_contentsLayer) { @@ -1381,7 +1381,7 @@ void GraphicsLayerCA::updateContentsMediaLayer() } } -void GraphicsLayerCA::updateContentsCanvasLayer() +void GraphicsLayerMac::updateContentsCanvasLayer() { // CanvasLayer was set as m_contentsLayer, and will get parented in updateSublayerList(). if (m_contentsLayer) { @@ -1391,7 +1391,7 @@ void GraphicsLayerCA::updateContentsCanvasLayer() } } -void GraphicsLayerCA::updateContentsRect() +void GraphicsLayerMac::updateContentsRect() { if (!m_contentsLayer) return; @@ -1416,12 +1416,12 @@ void GraphicsLayerCA::updateContentsRect() } } -void GraphicsLayerCA::updateMaskLayer() +void GraphicsLayerMac::updateMaskLayer() { CALayer *maskCALayer = m_maskLayer ? m_maskLayer->platformLayer() : 0; [m_layer.get() setMask:maskCALayer]; - LayerMap* maskLayerCloneMap = m_maskLayer ? static_cast<GraphicsLayerCA*>(m_maskLayer)->primaryLayerClones() : 0; + LayerMap* maskLayerCloneMap = m_maskLayer ? static_cast<GraphicsLayerMac*>(m_maskLayer)->primaryLayerClones() : 0; if (LayerMap* layerCloneMap = m_layerClones.get()) { LayerMap::const_iterator end = layerCloneMap->end(); @@ -1434,7 +1434,7 @@ void GraphicsLayerCA::updateMaskLayer() } } -void GraphicsLayerCA::updateReplicatedLayers() +void GraphicsLayerMac::updateReplicatedLayers() { // Clone the descendants of the replicated layer, and parent under us. ReplicaState replicaState(ReplicaState::ReplicaBranch); @@ -1450,7 +1450,7 @@ void GraphicsLayerCA::updateReplicatedLayers() } // For now, this assumes that layers only ever have one replica, so replicaIndices contains only 0 and 1. -GraphicsLayerCA::CloneID GraphicsLayerCA::ReplicaState::cloneID() const +GraphicsLayerMac::CloneID GraphicsLayerMac::ReplicaState::cloneID() const { size_t depth = m_replicaBranches.size(); @@ -1470,13 +1470,13 @@ GraphicsLayerCA::CloneID GraphicsLayerCA::ReplicaState::cloneID() const return String::adopt(result); } -CALayer *GraphicsLayerCA::replicatedLayerRoot(ReplicaState& replicaState) +CALayer *GraphicsLayerMac::replicatedLayerRoot(ReplicaState& replicaState) { // Limit replica nesting, to avoid 2^N explosion of replica layers. if (!m_replicatedLayer || replicaState.replicaDepth() == ReplicaState::maxReplicaDepth) return nil; - GraphicsLayerCA* replicatedLayer = static_cast<GraphicsLayerCA*>(m_replicatedLayer); + GraphicsLayerMac* replicatedLayer = static_cast<GraphicsLayerMac*>(m_replicatedLayer); CALayer *clonedLayerRoot = replicatedLayer->fetchCloneLayers(this, replicaState, RootCloneLevel); FloatPoint cloneRootPosition = replicatedLayer->positionForCloneRootLayer(); @@ -1488,7 +1488,7 @@ CALayer *GraphicsLayerCA::replicatedLayerRoot(ReplicaState& replicaState) return clonedLayerRoot; } -void GraphicsLayerCA::updateLayerAnimations() +void GraphicsLayerMac::updateLayerAnimations() { if (m_animationsToProcess.size()) { AnimationsToProcessMap::const_iterator end = m_animationsToProcess.end(); @@ -1540,7 +1540,7 @@ void GraphicsLayerCA::updateLayerAnimations() } } -void GraphicsLayerCA::setCAAnimationOnLayer(CAPropertyAnimation* caAnim, AnimatedPropertyID property, const String& animationName, int index, double timeOffset) +void GraphicsLayerMac::setCAAnimationOnLayer(CAPropertyAnimation* caAnim, AnimatedPropertyID property, const String& animationName, int index, double timeOffset) { PlatformLayer* layer = animatedLayer(property); @@ -1582,7 +1582,7 @@ static void bug7311367Workaround(CALayer* transformLayer, const TransformationMa [transformLayer setTransform:caTransform]; } -bool GraphicsLayerCA::removeCAAnimationFromLayer(AnimatedPropertyID property, const String& animationName, int index) +bool GraphicsLayerMac::removeCAAnimationFromLayer(AnimatedPropertyID property, const String& animationName, int index) { PlatformLayer* layer = animatedLayer(property); @@ -1627,7 +1627,7 @@ static void copyAnimationProperties(CAPropertyAnimation* from, CAPropertyAnimati [to setValue:object forKey:WebKitAnimationBeginTimeSetKey]; } -void GraphicsLayerCA::pauseCAAnimationOnLayer(AnimatedPropertyID property, const String& animationName, int index, double timeOffset) +void GraphicsLayerMac::pauseCAAnimationOnLayer(AnimatedPropertyID property, const String& animationName, int index, double timeOffset) { PlatformLayer* layer = animatedLayer(property); @@ -1675,7 +1675,7 @@ void GraphicsLayerCA::pauseCAAnimationOnLayer(AnimatedPropertyID property, const } } -void GraphicsLayerCA::setContentsToCanvas(PlatformLayer* canvasLayer) +void GraphicsLayerMac::setContentsToCanvas(PlatformLayer* canvasLayer) { if (canvasLayer == m_contentsLayer) return; @@ -1690,7 +1690,7 @@ void GraphicsLayerCA::setContentsToCanvas(PlatformLayer* canvasLayer) noteLayerPropertyChanged(ContentsCanvasLayerChanged); } -void GraphicsLayerCA::repaintLayerDirtyRects() +void GraphicsLayerMac::repaintLayerDirtyRects() { if (!m_dirtyRects.size()) return; @@ -1701,13 +1701,13 @@ void GraphicsLayerCA::repaintLayerDirtyRects() m_dirtyRects.clear(); } -void GraphicsLayerCA::updateContentsNeedsDisplay() +void GraphicsLayerMac::updateContentsNeedsDisplay() { if (m_contentsLayer) [m_contentsLayer.get() setNeedsDisplay]; } -bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset) +bool GraphicsLayerMac::createAnimationFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset) { ASSERT(valueList.property() != AnimatedPropertyWebkitTransform); @@ -1740,7 +1740,7 @@ bool GraphicsLayerCA::createAnimationFromKeyframes(const KeyframeValueList& valu return true; } -bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset, const IntSize& boxSize) +bool GraphicsLayerMac::createTransformAnimationsFromKeyframes(const KeyframeValueList& valueList, const Animation* animation, const String& animationName, double timeOffset, const IntSize& boxSize) { ASSERT(valueList.property() == AnimatedPropertyWebkitTransform); @@ -1799,21 +1799,21 @@ bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValue return validMatrices; } -CABasicAnimation* GraphicsLayerCA::createBasicAnimation(const Animation* anim, AnimatedPropertyID property, bool additive) +CABasicAnimation* GraphicsLayerMac::createBasicAnimation(const Animation* anim, AnimatedPropertyID property, bool additive) { CABasicAnimation* basicAnim = [CABasicAnimation animationWithKeyPath:propertyIdToString(property)]; setupAnimation(basicAnim, anim, additive); return basicAnim; } -CAKeyframeAnimation* GraphicsLayerCA::createKeyframeAnimation(const Animation* anim, AnimatedPropertyID property, bool additive) +CAKeyframeAnimation* GraphicsLayerMac::createKeyframeAnimation(const Animation* anim, AnimatedPropertyID property, bool additive) { CAKeyframeAnimation* keyframeAnim = [CAKeyframeAnimation animationWithKeyPath:propertyIdToString(property)]; setupAnimation(keyframeAnim, anim, additive); return keyframeAnim; } -void GraphicsLayerCA::setupAnimation(CAPropertyAnimation* propertyAnim, const Animation* anim, bool additive) +void GraphicsLayerMac::setupAnimation(CAPropertyAnimation* propertyAnim, const Animation* anim, bool additive) { double duration = anim->duration(); if (duration <= 0) @@ -1851,7 +1851,7 @@ void GraphicsLayerCA::setupAnimation(CAPropertyAnimation* propertyAnim, const An [propertyAnim setDelegate:m_animationDelegate.get()]; } -CAMediaTimingFunction* GraphicsLayerCA::timingFunctionForAnimationValue(const AnimationValue* animValue, const Animation* anim) +CAMediaTimingFunction* GraphicsLayerMac::timingFunctionForAnimationValue(const AnimationValue* animValue, const Animation* anim) { const TimingFunction* tf = 0; if (animValue->timingFunction()) @@ -1862,7 +1862,7 @@ CAMediaTimingFunction* GraphicsLayerCA::timingFunctionForAnimationValue(const An return getCAMediaTimingFunction(tf ? tf : CubicBezierTimingFunction::create().get()); } -bool GraphicsLayerCA::setAnimationEndpoints(const KeyframeValueList& valueList, const Animation* anim, CABasicAnimation* basicAnim) +bool GraphicsLayerMac::setAnimationEndpoints(const KeyframeValueList& valueList, const Animation* anim, CABasicAnimation* basicAnim) { id fromValue = nil; id toValue = nil; @@ -1891,7 +1891,7 @@ bool GraphicsLayerCA::setAnimationEndpoints(const KeyframeValueList& valueList, return true; } -bool GraphicsLayerCA::setAnimationKeyframes(const KeyframeValueList& valueList, const Animation* anim, CAKeyframeAnimation* keyframeAnim) +bool GraphicsLayerMac::setAnimationKeyframes(const KeyframeValueList& valueList, const Animation* anim, CAKeyframeAnimation* keyframeAnim) { RetainPtr<NSMutableArray> keyTimes(AdoptNS, [[NSMutableArray alloc] init]); RetainPtr<NSMutableArray> values(AdoptNS, [[NSMutableArray alloc] init]); @@ -1926,7 +1926,7 @@ bool GraphicsLayerCA::setAnimationKeyframes(const KeyframeValueList& valueList, return true; } -bool GraphicsLayerCA::setTransformAnimationEndpoints(const KeyframeValueList& valueList, const Animation* anim, CABasicAnimation* basicAnim, int functionIndex, TransformOperation::OperationType transformOp, bool isMatrixAnimation, const IntSize& boxSize) +bool GraphicsLayerMac::setTransformAnimationEndpoints(const KeyframeValueList& valueList, const Animation* anim, CABasicAnimation* basicAnim, int functionIndex, TransformOperation::OperationType transformOp, bool isMatrixAnimation, const IntSize& boxSize) { id fromValue; id toValue; @@ -1971,7 +1971,7 @@ bool GraphicsLayerCA::setTransformAnimationEndpoints(const KeyframeValueList& va return true; } -bool GraphicsLayerCA::setTransformAnimationKeyframes(const KeyframeValueList& valueList, const Animation* animation, CAKeyframeAnimation* keyframeAnim, int functionIndex, TransformOperation::OperationType transformOpType, bool isMatrixAnimation, const IntSize& boxSize) +bool GraphicsLayerMac::setTransformAnimationKeyframes(const KeyframeValueList& valueList, const Animation* animation, CAKeyframeAnimation* keyframeAnim, int functionIndex, TransformOperation::OperationType transformOpType, bool isMatrixAnimation, const IntSize& boxSize) { RetainPtr<NSMutableArray> keyTimes(AdoptNS, [[NSMutableArray alloc] init]); RetainPtr<NSMutableArray> values(AdoptNS, [[NSMutableArray alloc] init]); @@ -2015,7 +2015,7 @@ bool GraphicsLayerCA::setTransformAnimationKeyframes(const KeyframeValueList& va return true; } -void GraphicsLayerCA::suspendAnimations(double time) +void GraphicsLayerMac::suspendAnimations(double time) { double t = currentTimeToMediaTime(time ? time : currentTime()); [primaryLayer() setSpeed:0]; @@ -2032,7 +2032,7 @@ void GraphicsLayerCA::suspendAnimations(double time) } } -void GraphicsLayerCA::resumeAnimations() +void GraphicsLayerMac::resumeAnimations() { [primaryLayer() setSpeed:1]; [primaryLayer() setTimeOffset:0]; @@ -2048,32 +2048,32 @@ void GraphicsLayerCA::resumeAnimations() } } -CALayer* GraphicsLayerCA::hostLayerForSublayers() const +CALayer* GraphicsLayerMac::hostLayerForSublayers() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); } -CALayer* GraphicsLayerCA::layerForSuperlayer() const +CALayer* GraphicsLayerMac::layerForSuperlayer() const { return m_structuralLayer ? m_structuralLayer.get() : m_layer.get(); } -CALayer* GraphicsLayerCA::animatedLayer(AnimatedPropertyID property) const +CALayer* GraphicsLayerMac::animatedLayer(AnimatedPropertyID property) const { return (property == AnimatedPropertyBackgroundColor) ? m_contentsLayer.get() : primaryLayer(); } -GraphicsLayerCA::LayerMap* GraphicsLayerCA::animatedLayerClones(AnimatedPropertyID property) const +GraphicsLayerMac::LayerMap* GraphicsLayerMac::animatedLayerClones(AnimatedPropertyID property) const { return (property == AnimatedPropertyBackgroundColor) ? m_contentsLayerClones.get() : primaryLayerClones(); } -PlatformLayer* GraphicsLayerCA::platformLayer() const +PlatformLayer* GraphicsLayerMac::platformLayer() const { return primaryLayer(); } -void GraphicsLayerCA::setDebugBackgroundColor(const Color& color) +void GraphicsLayerMac::setDebugBackgroundColor(const Color& color) { BEGIN_BLOCK_OBJC_EXCEPTIONS @@ -2085,7 +2085,7 @@ void GraphicsLayerCA::setDebugBackgroundColor(const Color& color) END_BLOCK_OBJC_EXCEPTIONS } -void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth) +void GraphicsLayerMac::setDebugBorder(const Color& color, float borderWidth) { BEGIN_BLOCK_OBJC_EXCEPTIONS @@ -2100,7 +2100,7 @@ void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth) END_BLOCK_OBJC_EXCEPTIONS } -FloatSize GraphicsLayerCA::constrainedSize() const +FloatSize GraphicsLayerMac::constrainedSize() const { float tileColumns = ceilf(m_size.width() / cTiledLayerTileSize); float tileRows = ceilf(m_size.height() / cTiledLayerTileSize); @@ -2123,7 +2123,7 @@ FloatSize GraphicsLayerCA::constrainedSize() const return constrainedSize; } -bool GraphicsLayerCA::requiresTiledLayer(const FloatSize& size) const +bool GraphicsLayerMac::requiresTiledLayer(const FloatSize& size) const { if (!m_drawsContent) return false; @@ -2132,7 +2132,7 @@ bool GraphicsLayerCA::requiresTiledLayer(const FloatSize& size) const return size.width() > cMaxPixelDimension || size.height() > cMaxPixelDimension; } -void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer) +void GraphicsLayerMac::swapFromOrToTiledLayer(bool useTiledLayer) { if (useTiledLayer == m_usingTiledLayer) return; @@ -2198,7 +2198,7 @@ void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer) updateDebugIndicators(); } -GraphicsLayer::CompositingCoordinatesOrientation GraphicsLayerCA::defaultContentsOrientation() const +GraphicsLayer::CompositingCoordinatesOrientation GraphicsLayerMac::defaultContentsOrientation() const { #if !HAVE_MODERN_QUARTZCORE // Older QuartzCore does not support -geometryFlipped, so we manually flip the root @@ -2210,7 +2210,7 @@ GraphicsLayer::CompositingCoordinatesOrientation GraphicsLayerCA::defaultContent #endif } -void GraphicsLayerCA::updateContentsTransform() +void GraphicsLayerMac::updateContentsTransform() { #if !HAVE_MODERN_QUARTZCORE if (contentsOrientation() == CompositingCoordinatesBottomUp) { @@ -2221,7 +2221,7 @@ void GraphicsLayerCA::updateContentsTransform() #endif } -void GraphicsLayerCA::setupContentsLayer(CALayer* contentsLayer) +void GraphicsLayerMac::setupContentsLayer(CALayer* contentsLayer) { // Turn off implicit animations on the inner layer. [contentsLayer setStyle:[NSDictionary dictionaryWithObject:nullActionsDictionary() forKey:@"actions"]]; @@ -2244,7 +2244,7 @@ void GraphicsLayerCA::setupContentsLayer(CALayer* contentsLayer) } } -CALayer *GraphicsLayerCA::findOrMakeClone(CloneID cloneID, CALayer *sourceLayer, LayerMap* clones, CloneLevel cloneLevel) +CALayer *GraphicsLayerMac::findOrMakeClone(CloneID cloneID, CALayer *sourceLayer, LayerMap* clones, CloneLevel cloneLevel) { if (!sourceLayer) return 0; @@ -2269,7 +2269,7 @@ CALayer *GraphicsLayerCA::findOrMakeClone(CloneID cloneID, CALayer *sourceLayer, return resultLayer; } -void GraphicsLayerCA::ensureCloneLayers(CloneID cloneID, CALayer *& primaryLayer, CALayer *& structuralLayer, CALayer *& contentsLayer, CloneLevel cloneLevel) +void GraphicsLayerMac::ensureCloneLayers(CloneID cloneID, CALayer *& primaryLayer, CALayer *& structuralLayer, CALayer *& contentsLayer, CloneLevel cloneLevel) { structuralLayer = nil; contentsLayer = nil; @@ -2288,14 +2288,14 @@ void GraphicsLayerCA::ensureCloneLayers(CloneID cloneID, CALayer *& primaryLayer contentsLayer = findOrMakeClone(cloneID, m_contentsLayer.get(), m_contentsLayerClones.get(), cloneLevel); } -void GraphicsLayerCA::removeCloneLayers() +void GraphicsLayerMac::removeCloneLayers() { m_layerClones = 0; m_structuralLayerClones = 0; m_contentsLayerClones = 0; } -FloatPoint GraphicsLayerCA::positionForCloneRootLayer() const +FloatPoint GraphicsLayerMac::positionForCloneRootLayer() const { // This can get called during a sync when we've just removed the m_replicaLayer. if (!m_replicaLayer) @@ -2306,19 +2306,19 @@ FloatPoint GraphicsLayerCA::positionForCloneRootLayer() const replicaPosition.y() + m_anchorPoint.y() * m_size.height()); } -void GraphicsLayerCA::propagateLayerChangeToReplicas() +void GraphicsLayerMac::propagateLayerChangeToReplicas() { for (GraphicsLayer* currLayer = this; currLayer; currLayer = currLayer->parent()) { - GraphicsLayerCA* currLayerCA = static_cast<GraphicsLayerCA*>(currLayer); + GraphicsLayerMac* currLayerCA = static_cast<GraphicsLayerMac*>(currLayer); if (!currLayerCA->hasCloneLayers()) break; if (currLayerCA->replicaLayer()) - static_cast<GraphicsLayerCA*>(currLayerCA->replicaLayer())->noteLayerPropertyChanged(ReplicatedLayerChanged); + static_cast<GraphicsLayerMac*>(currLayerCA->replicaLayer())->noteLayerPropertyChanged(ReplicatedLayerChanged); } } -CALayer *GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaState& replicaState, CloneLevel cloneLevel) +CALayer *GraphicsLayerMac::fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaState& replicaState, CloneLevel cloneLevel) { CALayer *primaryLayer; CALayer *structuralLayer; @@ -2326,7 +2326,7 @@ CALayer *GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaSt ensureCloneLayers(replicaState.cloneID(), primaryLayer, structuralLayer, contentsLayer, cloneLevel); if (m_maskLayer) { - CALayer *maskClone = static_cast<GraphicsLayerCA*>(m_maskLayer)->fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel); + CALayer *maskClone = static_cast<GraphicsLayerMac*>(m_maskLayer)->fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel); [primaryLayer setMask:maskClone]; } @@ -2352,7 +2352,7 @@ CALayer *GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaSt if (m_replicaLayer && m_replicaLayer != replicaRoot) { // We have nested replicas. Ask the replica layer for a clone of its contents. replicaState.setBranchType(ReplicaState::ReplicaBranch); - replicaLayer = static_cast<GraphicsLayerCA*>(m_replicaLayer)->fetchCloneLayers(replicaRoot, replicaState, RootCloneLevel); + replicaLayer = static_cast<GraphicsLayerMac*>(m_replicaLayer)->fetchCloneLayers(replicaRoot, replicaState, RootCloneLevel); replicaState.setBranchType(ReplicaState::ChildBranch); } @@ -2377,7 +2377,7 @@ CALayer *GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaSt size_t numChildren = childLayers.size(); for (size_t i = 0; i < numChildren; ++i) { - GraphicsLayerCA* curChild = static_cast<GraphicsLayerCA*>(childLayers[i]); + GraphicsLayerMac* curChild = static_cast<GraphicsLayerMac*>(childLayers[i]); CALayer *childLayer = curChild->fetchCloneLayers(replicaRoot, replicaState, IntermediateCloneLevel); if (childLayer) @@ -2410,7 +2410,7 @@ CALayer *GraphicsLayerCA::fetchCloneLayers(GraphicsLayer* replicaRoot, ReplicaSt return result; } -CALayer *GraphicsLayerCA::cloneLayer(CALayer *layer, CloneLevel cloneLevel) +CALayer *GraphicsLayerMac::cloneLayer(CALayer *layer, CloneLevel cloneLevel) { static Class transformLayerClass = NSClassFromString(@"CATransformLayer"); CALayer *newLayer = nil; @@ -2449,7 +2449,7 @@ CALayer *GraphicsLayerCA::cloneLayer(CALayer *layer, CloneLevel cloneLevel) return newLayer; } -void GraphicsLayerCA::setOpacityInternal(float accumulatedOpacity) +void GraphicsLayerMac::setOpacityInternal(float accumulatedOpacity) { LayerMap* layerCloneMap = 0; @@ -2472,7 +2472,7 @@ void GraphicsLayerCA::setOpacityInternal(float accumulatedOpacity) } } -void GraphicsLayerCA::updateOpacityOnLayer() +void GraphicsLayerMac::updateOpacityOnLayer() { #if !HAVE_MODERN_QUARTZCORE // Distribute opacity either to our own layer or to our children. We pass in the @@ -2495,13 +2495,13 @@ void GraphicsLayerCA::updateOpacityOnLayer() #endif } -void GraphicsLayerCA::noteSublayersChanged() +void GraphicsLayerMac::noteSublayersChanged() { noteLayerPropertyChanged(ChildrenChanged); propagateLayerChangeToReplicas(); } -void GraphicsLayerCA::noteLayerPropertyChanged(LayerChangeFlags flags) +void GraphicsLayerMac::noteLayerPropertyChanged(LayerChangeFlags flags) { if (!m_uncommittedChanges && m_client) m_client->notifySyncRequired(this); diff --git a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h index 876bc16..95ab456 100644 --- a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h +++ b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.h @@ -55,7 +55,7 @@ class WebCoreMovieObserver; namespace WebCore { -class MediaPlayerPrivate : public MediaPlayerPrivateInterface { +class MediaPlayerPrivateQTKit : public MediaPlayerPrivateInterface { public: static void registerMediaEngine(MediaEngineRegistrar); @@ -67,8 +67,8 @@ public: void didEnd(); private: - MediaPlayerPrivate(MediaPlayer*); - ~MediaPlayerPrivate(); + MediaPlayerPrivateQTKit(MediaPlayer*); + ~MediaPlayerPrivateQTKit(); // engine support static MediaPlayerPrivateInterface* create(MediaPlayer* player); @@ -163,7 +163,7 @@ private: void updateStates(); void doSeek(); void cancelSeek(); - void seekTimerFired(Timer<MediaPlayerPrivate>*); + void seekTimerFired(Timer<MediaPlayerPrivateQTKit>*); float maxTimeLoaded() const; void disableUnsupportedTracks(); @@ -175,6 +175,8 @@ private: virtual float mediaTimeForTimeValue(float) const; + virtual double maximumDurationToCacheMediaTime() const { return 5; } + MediaPlayer* m_player; RetainPtr<QTMovie> m_qtMovie; RetainPtr<QTMovieView> m_qtMovieView; @@ -182,7 +184,7 @@ private: RetainPtr<WebCoreMovieObserver> m_objcObserver; String m_movieURL; float m_seekTo; - Timer<MediaPlayerPrivate> m_seekTimer; + Timer<MediaPlayerPrivateQTKit> m_seekTimer; MediaPlayer::NetworkState m_networkState; MediaPlayer::ReadyState m_readyState; IntRect m_rect; diff --git a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index 06c7924..a2325da 100644 --- a/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -164,11 +164,11 @@ using namespace std; @interface WebCoreMovieObserver : NSObject { - MediaPlayerPrivate* m_callback; + MediaPlayerPrivateQTKit* m_callback; NSView* m_view; BOOL m_delayCallbacks; } --(id)initWithCallback:(MediaPlayerPrivate*)callback; +-(id)initWithCallback:(MediaPlayerPrivateQTKit*)callback; -(void)disconnect; -(void)setView:(NSView*)view; -(void)repaint; @@ -192,22 +192,22 @@ static const long minimumQuickTimeVersion = 0x07300000; // 7.3 #endif -MediaPlayerPrivateInterface* MediaPlayerPrivate::create(MediaPlayer* player) +MediaPlayerPrivateInterface* MediaPlayerPrivateQTKit::create(MediaPlayer* player) { - return new MediaPlayerPrivate(player); + return new MediaPlayerPrivateQTKit(player); } -void MediaPlayerPrivate::registerMediaEngine(MediaEngineRegistrar registrar) +void MediaPlayerPrivateQTKit::registerMediaEngine(MediaEngineRegistrar registrar) { if (isAvailable()) registrar(create, getSupportedTypes, supportsType); } -MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) +MediaPlayerPrivateQTKit::MediaPlayerPrivateQTKit(MediaPlayer* player) : m_player(player) , m_objcObserver(AdoptNS, [[WebCoreMovieObserver alloc] initWithCallback:this]) , m_seekTo(-1) - , m_seekTimer(this, &MediaPlayerPrivate::seekTimerFired) + , m_seekTimer(this, &MediaPlayerPrivateQTKit::seekTimerFired) , m_networkState(MediaPlayer::Empty) , m_readyState(MediaPlayer::HaveNothing) , m_rect() @@ -232,7 +232,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) { } -MediaPlayerPrivate::~MediaPlayerPrivate() +MediaPlayerPrivateQTKit::~MediaPlayerPrivateQTKit() { tearDownVideoRendering(); @@ -240,24 +240,52 @@ MediaPlayerPrivate::~MediaPlayerPrivate() [m_objcObserver.get() disconnect]; } -void MediaPlayerPrivate::createQTMovie(const String& url) +void MediaPlayerPrivateQTKit::createQTMovie(const String& url) { NSURL *cocoaURL = KURL(ParsedURLString, url); - NSDictionary *movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + NSMutableDictionary *movieAttributes = [NSMutableDictionary dictionaryWithObjectsAndKeys: cocoaURL, QTMovieURLAttribute, [NSNumber numberWithBool:m_player->preservesPitch()], QTMovieRateChangesPreservePitchAttribute, [NSNumber numberWithBool:YES], QTMoviePreventExternalURLLinksAttribute, [NSNumber numberWithBool:YES], QTSecurityPolicyNoCrossSiteAttribute, [NSNumber numberWithBool:NO], QTMovieAskUnresolvedDataRefsAttribute, [NSNumber numberWithBool:NO], QTMovieLoopsAttribute, -#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) - [NSNumber numberWithBool:YES], @"QTMovieOpenForPlaybackAttribute", -#endif #ifndef BUILDING_ON_TIGER QTMovieApertureModeClean, QTMovieApertureModeAttribute, #endif nil]; +#if defined(BUILDING_ON_SNOW_LEOPARD) + CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings(); + CFArrayRef proxiesForURL = CFNetworkCopyProxiesForURL((CFURLRef)cocoaURL, proxySettings); + BOOL willUseProxy = YES; + + if (!proxiesForURL || !CFArrayGetCount(proxiesForURL)) + willUseProxy = NO; + + if (CFArrayGetCount(proxiesForURL) == 1) { + CFDictionaryRef proxy = (CFDictionaryRef)CFArrayGetValueAtIndex(proxiesForURL, 0); + ASSERT(CFGetTypeID(proxy) == CFDictionaryGetTypeID()); + + CFStringRef proxyType = (CFStringRef)CFDictionaryGetValue(proxy, kCFProxyTypeKey); + ASSERT(CFGetTypeID(proxyType) == CFStringGetTypeID()); + + if (CFStringCompare(proxyType, kCFProxyTypeNone, 0) == kCFCompareEqualTo) + willUseProxy = NO; + } + + if (!willUseProxy) { + // Only pass the QTMovieOpenForPlaybackAttribute flag if there are no proxy servers, due + // to rdar://problem/7531776. + [movieAttributes setObject:[NSNumber numberWithBool:YES] forKey:@"QTMovieOpenForPlaybackAttribute"]; + } + + if (proxiesForURL) + CFRelease(proxiesForURL); + if (proxySettings) + CFRelease(proxySettings); +#endif + createQTMovie(cocoaURL, movieAttributes); } @@ -292,7 +320,7 @@ static void disableComponentsOnce() wkQTMovieDisableComponent(componentsToDisable[i]); } -void MediaPlayerPrivate::createQTMovie(NSURL *url, NSDictionary *movieAttributes) +void MediaPlayerPrivateQTKit::createQTMovie(NSURL *url, NSDictionary *movieAttributes) { disableComponentsOnce(); @@ -375,7 +403,7 @@ static Class QTVideoRendererClass() return QTVideoRendererWebKitOnlyClass; } -void MediaPlayerPrivate::createQTMovieView() +void MediaPlayerPrivateQTKit::createQTMovieView() { detachQTMovieView(); @@ -420,7 +448,7 @@ void MediaPlayerPrivate::createQTMovieView() [m_objcObserver.get() setDelayCallbacks:NO]; } -void MediaPlayerPrivate::detachQTMovieView() +void MediaPlayerPrivateQTKit::detachQTMovieView() { if (m_qtMovieView) { [m_objcObserver.get() setView:nil]; @@ -435,7 +463,7 @@ void MediaPlayerPrivate::detachQTMovieView() } } -void MediaPlayerPrivate::createQTVideoRenderer(QTVideoRendererMode rendererMode) +void MediaPlayerPrivateQTKit::createQTVideoRenderer(QTVideoRendererMode rendererMode) { destroyQTVideoRenderer(); @@ -455,7 +483,7 @@ void MediaPlayerPrivate::createQTVideoRenderer(QTVideoRendererMode rendererMode) } } -void MediaPlayerPrivate::destroyQTVideoRenderer() +void MediaPlayerPrivateQTKit::destroyQTVideoRenderer() { if (!m_qtVideoRenderer) return; @@ -471,7 +499,7 @@ void MediaPlayerPrivate::destroyQTVideoRenderer() m_qtVideoRenderer = nil; } -void MediaPlayerPrivate::createQTMovieLayer() +void MediaPlayerPrivateQTKit::createQTMovieLayer() { #if USE(ACCELERATED_COMPOSITING) if (!m_qtMovie) @@ -493,7 +521,7 @@ void MediaPlayerPrivate::createQTMovieLayer() #endif } -void MediaPlayerPrivate::destroyQTMovieLayer() +void MediaPlayerPrivateQTKit::destroyQTMovieLayer() { #if USE(ACCELERATED_COMPOSITING) if (!m_qtVideoLayer) @@ -505,7 +533,7 @@ void MediaPlayerPrivate::destroyQTMovieLayer() #endif } -MediaPlayerPrivate::MediaRenderingMode MediaPlayerPrivate::currentRenderingMode() const +MediaPlayerPrivateQTKit::MediaRenderingMode MediaPlayerPrivateQTKit::currentRenderingMode() const { if (m_qtMovieView) return MediaRenderingMovieView; @@ -519,7 +547,7 @@ MediaPlayerPrivate::MediaRenderingMode MediaPlayerPrivate::currentRenderingMode( return MediaRenderingNone; } -MediaPlayerPrivate::MediaRenderingMode MediaPlayerPrivate::preferredRenderingMode() const +MediaPlayerPrivateQTKit::MediaRenderingMode MediaPlayerPrivateQTKit::preferredRenderingMode() const { if (!m_player->frameView() || !m_qtMovie) return MediaRenderingNone; @@ -535,7 +563,7 @@ MediaPlayerPrivate::MediaRenderingMode MediaPlayerPrivate::preferredRenderingMod return MediaRenderingSoftwareRenderer; } -void MediaPlayerPrivate::setUpVideoRendering() +void MediaPlayerPrivateQTKit::setUpVideoRendering() { if (!isReadyForVideoSetup()) return; @@ -566,7 +594,7 @@ void MediaPlayerPrivate::setUpVideoRendering() m_player->mediaPlayerClient()->mediaPlayerRenderingModeChanged(m_player); } -void MediaPlayerPrivate::tearDownVideoRendering() +void MediaPlayerPrivateQTKit::tearDownVideoRendering() { if (m_qtMovieView) detachQTMovieView(); @@ -576,14 +604,14 @@ void MediaPlayerPrivate::tearDownVideoRendering() destroyQTMovieLayer(); } -bool MediaPlayerPrivate::hasSetUpVideoRendering() const +bool MediaPlayerPrivateQTKit::hasSetUpVideoRendering() const { return m_qtMovieView || m_qtVideoLayer || m_qtVideoRenderer; } -QTTime MediaPlayerPrivate::createQTTime(float time) const +QTTime MediaPlayerPrivateQTKit::createQTTime(float time) const { if (!metaDataAvailable()) return QTMakeTime(0, 600); @@ -591,7 +619,7 @@ QTTime MediaPlayerPrivate::createQTTime(float time) const return QTMakeTime(time * timeScale, timeScale); } -void MediaPlayerPrivate::resumeLoad() +void MediaPlayerPrivateQTKit::resumeLoad() { m_delayingLoad = false; @@ -599,7 +627,7 @@ void MediaPlayerPrivate::resumeLoad() loadInternal(m_movieURL); } -void MediaPlayerPrivate::load(const String& url) +void MediaPlayerPrivateQTKit::load(const String& url) { m_movieURL = url; @@ -613,7 +641,7 @@ void MediaPlayerPrivate::load(const String& url) loadInternal(url); } -void MediaPlayerPrivate::loadInternal(const String& url) +void MediaPlayerPrivateQTKit::loadInternal(const String& url) { if (m_networkState != MediaPlayer::Loading) { m_networkState = MediaPlayer::Loading; @@ -634,13 +662,13 @@ void MediaPlayerPrivate::loadInternal(const String& url) [m_objcObserver.get() setDelayCallbacks:NO]; } -void MediaPlayerPrivate::prepareToPlay() +void MediaPlayerPrivateQTKit::prepareToPlay() { if (!m_qtMovie || m_delayingLoad) resumeLoad(); } -PlatformMedia MediaPlayerPrivate::platformMedia() const +PlatformMedia MediaPlayerPrivateQTKit::platformMedia() const { PlatformMedia pm; pm.type = PlatformMedia::QTMovieType; @@ -649,13 +677,13 @@ PlatformMedia MediaPlayerPrivate::platformMedia() const } #if USE(ACCELERATED_COMPOSITING) -PlatformLayer* MediaPlayerPrivate::platformLayer() const +PlatformLayer* MediaPlayerPrivateQTKit::platformLayer() const { return m_qtVideoLayer.get(); } #endif -void MediaPlayerPrivate::play() +void MediaPlayerPrivateQTKit::play() { if (!metaDataAvailable()) return; @@ -668,7 +696,7 @@ void MediaPlayerPrivate::play() [m_objcObserver.get() setDelayCallbacks:NO]; } -void MediaPlayerPrivate::pause() +void MediaPlayerPrivateQTKit::pause() { if (!metaDataAvailable()) return; @@ -681,7 +709,7 @@ void MediaPlayerPrivate::pause() [m_objcObserver.get() setDelayCallbacks:NO]; } -float MediaPlayerPrivate::duration() const +float MediaPlayerPrivateQTKit::duration() const { if (!metaDataAvailable()) return 0; @@ -695,7 +723,7 @@ float MediaPlayerPrivate::duration() const return static_cast<float>(time.timeValue) / time.timeScale; } -float MediaPlayerPrivate::currentTime() const +float MediaPlayerPrivateQTKit::currentTime() const { if (!metaDataAvailable()) return 0; @@ -703,7 +731,7 @@ float MediaPlayerPrivate::currentTime() const return static_cast<float>(time.timeValue) / time.timeScale; } -void MediaPlayerPrivate::seek(float time) +void MediaPlayerPrivateQTKit::seek(float time) { // Nothing to do if we are already in the middle of a seek to the same time. if (time == m_seekTo) @@ -724,7 +752,7 @@ void MediaPlayerPrivate::seek(float time) m_seekTimer.start(0, 0.5f); } -void MediaPlayerPrivate::doSeek() +void MediaPlayerPrivateQTKit::doSeek() { QTTime qttime = createQTTime(m_seekTo); // setCurrentTime generates several event callbacks, update afterwards @@ -744,13 +772,13 @@ void MediaPlayerPrivate::doSeek() [m_objcObserver.get() setDelayCallbacks:NO]; } -void MediaPlayerPrivate::cancelSeek() +void MediaPlayerPrivateQTKit::cancelSeek() { m_seekTo = -1; m_seekTimer.stop(); } -void MediaPlayerPrivate::seekTimerFired(Timer<MediaPlayerPrivate>*) +void MediaPlayerPrivateQTKit::seekTimerFired(Timer<MediaPlayerPrivateQTKit>*) { if (!metaDataAvailable()|| !seeking() || currentTime() == m_seekTo) { cancelSeek(); @@ -771,21 +799,21 @@ void MediaPlayerPrivate::seekTimerFired(Timer<MediaPlayerPrivate>*) } } -bool MediaPlayerPrivate::paused() const +bool MediaPlayerPrivateQTKit::paused() const { if (!metaDataAvailable()) return true; return [m_qtMovie.get() rate] == 0; } -bool MediaPlayerPrivate::seeking() const +bool MediaPlayerPrivateQTKit::seeking() const { if (!metaDataAvailable()) return false; return m_seekTo >= 0; } -IntSize MediaPlayerPrivate::naturalSize() const +IntSize MediaPlayerPrivateQTKit::naturalSize() const { if (!metaDataAvailable()) return IntSize(); @@ -801,21 +829,21 @@ IntSize MediaPlayerPrivate::naturalSize() const return IntSize(naturalSize.width * m_scaleFactor.width(), naturalSize.height * m_scaleFactor.height()); } -bool MediaPlayerPrivate::hasVideo() const +bool MediaPlayerPrivateQTKit::hasVideo() const { if (!metaDataAvailable()) return false; return [[m_qtMovie.get() attributeForKey:QTMovieHasVideoAttribute] boolValue]; } -bool MediaPlayerPrivate::hasAudio() const +bool MediaPlayerPrivateQTKit::hasAudio() const { if (!m_qtMovie) return false; return [[m_qtMovie.get() attributeForKey:QTMovieHasAudioAttribute] boolValue]; } -bool MediaPlayerPrivate::supportsFullscreen() const +bool MediaPlayerPrivateQTKit::supportsFullscreen() const { #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) return true; @@ -825,20 +853,20 @@ bool MediaPlayerPrivate::supportsFullscreen() const #endif } -void MediaPlayerPrivate::setVolume(float volume) +void MediaPlayerPrivateQTKit::setVolume(float volume) { if (m_qtMovie) [m_qtMovie.get() setVolume:volume]; } -bool MediaPlayerPrivate::hasClosedCaptions() const +bool MediaPlayerPrivateQTKit::hasClosedCaptions() const { if (!metaDataAvailable()) return false; return wkQTMovieHasClosedCaptions(m_qtMovie.get()); } -void MediaPlayerPrivate::setClosedCaptionsVisible(bool closedCaptionsVisible) +void MediaPlayerPrivateQTKit::setClosedCaptionsVisible(bool closedCaptionsVisible) { if (metaDataAvailable()) { wkQTMovieSetShowClosedCaptions(m_qtMovie.get(), closedCaptionsVisible); @@ -852,13 +880,13 @@ void MediaPlayerPrivate::setClosedCaptionsVisible(bool closedCaptionsVisible) } } -void MediaPlayerPrivate::setRate(float rate) +void MediaPlayerPrivateQTKit::setRate(float rate) { if (m_qtMovie) [m_qtMovie.get() setRate:rate]; } -void MediaPlayerPrivate::setPreservesPitch(bool preservesPitch) +void MediaPlayerPrivateQTKit::setPreservesPitch(bool preservesPitch) { if (!m_qtMovie) return; @@ -876,7 +904,7 @@ void MediaPlayerPrivate::setPreservesPitch(bool preservesPitch) createQTMovie([movieAttributes valueForKey:QTMovieURLAttribute], movieAttributes); } -PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const +PassRefPtr<TimeRanges> MediaPlayerPrivateQTKit::buffered() const { RefPtr<TimeRanges> timeRanges = TimeRanges::create(); float loaded = maxTimeLoaded(); @@ -885,7 +913,7 @@ PassRefPtr<TimeRanges> MediaPlayerPrivate::buffered() const return timeRanges.release(); } -float MediaPlayerPrivate::maxTimeSeekable() const +float MediaPlayerPrivateQTKit::maxTimeSeekable() const { if (!metaDataAvailable()) return 0; @@ -897,14 +925,14 @@ float MediaPlayerPrivate::maxTimeSeekable() const return wkQTMovieMaxTimeSeekable(m_qtMovie.get()); } -float MediaPlayerPrivate::maxTimeLoaded() const +float MediaPlayerPrivateQTKit::maxTimeLoaded() const { if (!metaDataAvailable()) return 0; return wkQTMovieMaxTimeLoaded(m_qtMovie.get()); } -unsigned MediaPlayerPrivate::bytesLoaded() const +unsigned MediaPlayerPrivateQTKit::bytesLoaded() const { float dur = duration(); if (!dur) @@ -912,14 +940,14 @@ unsigned MediaPlayerPrivate::bytesLoaded() const return totalBytes() * maxTimeLoaded() / dur; } -unsigned MediaPlayerPrivate::totalBytes() const +unsigned MediaPlayerPrivateQTKit::totalBytes() const { if (!metaDataAvailable()) return 0; return [[m_qtMovie.get() attributeForKey:QTMovieDataSizeAttribute] intValue]; } -void MediaPlayerPrivate::cancelLoad() +void MediaPlayerPrivateQTKit::cancelLoad() { // FIXME: Is there a better way to check for this? if (m_networkState < MediaPlayer::Loading || m_networkState == MediaPlayer::Loaded) @@ -931,7 +959,7 @@ void MediaPlayerPrivate::cancelLoad() updateStates(); } -void MediaPlayerPrivate::cacheMovieScale() +void MediaPlayerPrivateQTKit::cacheMovieScale() { NSSize initialSize = NSZeroSize; NSSize naturalSize = [[m_qtMovie.get() attributeForKey:QTMovieNaturalSizeAttribute] sizeValue]; @@ -956,12 +984,12 @@ void MediaPlayerPrivate::cacheMovieScale() m_scaleFactor.setHeight(initialSize.height / naturalSize.height); } -bool MediaPlayerPrivate::isReadyForVideoSetup() const +bool MediaPlayerPrivateQTKit::isReadyForVideoSetup() const { return m_readyState >= MediaPlayer::HaveMetadata && m_player->visible(); } -void MediaPlayerPrivate::prepareForRendering() +void MediaPlayerPrivateQTKit::prepareForRendering() { if (m_isAllowedToRender) return; @@ -976,7 +1004,7 @@ void MediaPlayerPrivate::prepareForRendering() m_player->mediaPlayerClient()->mediaPlayerRenderingModeChanged(m_player); } -void MediaPlayerPrivate::updateStates() +void MediaPlayerPrivateQTKit::updateStates() { MediaPlayer::NetworkState oldNetworkState = m_networkState; MediaPlayer::ReadyState oldReadyState = m_readyState; @@ -1091,13 +1119,13 @@ void MediaPlayerPrivate::updateStates() } } -void MediaPlayerPrivate::loadStateChanged() +void MediaPlayerPrivateQTKit::loadStateChanged() { if (!m_hasUnsupportedTracks) updateStates(); } -void MediaPlayerPrivate::rateChanged() +void MediaPlayerPrivateQTKit::rateChanged() { if (m_hasUnsupportedTracks) return; @@ -1106,13 +1134,13 @@ void MediaPlayerPrivate::rateChanged() m_player->rateChanged(); } -void MediaPlayerPrivate::sizeChanged() +void MediaPlayerPrivateQTKit::sizeChanged() { if (!m_hasUnsupportedTracks) m_player->sizeChanged(); } -void MediaPlayerPrivate::timeChanged() +void MediaPlayerPrivateQTKit::timeChanged() { if (m_hasUnsupportedTracks) return; @@ -1128,7 +1156,7 @@ void MediaPlayerPrivate::timeChanged() m_player->timeChanged(); } -void MediaPlayerPrivate::didEnd() +void MediaPlayerPrivateQTKit::didEnd() { if (m_hasUnsupportedTracks) return; @@ -1150,7 +1178,7 @@ void MediaPlayerPrivate::didEnd() m_player->timeChanged(); } -void MediaPlayerPrivate::setSize(const IntSize&) +void MediaPlayerPrivateQTKit::setSize(const IntSize&) { // Don't resize the view now because [view setFrame] also resizes the movie itself, and because // the renderer calls this function immediately when we report a size change (QTMovieSizeDidChangeNotification) @@ -1161,7 +1189,7 @@ void MediaPlayerPrivate::setSize(const IntSize&) // <rdar://problem/6336092> REGRESSION: rtsp movie does not resize correctly } -void MediaPlayerPrivate::setVisible(bool b) +void MediaPlayerPrivateQTKit::setVisible(bool b) { if (m_visible != b) { m_visible = b; @@ -1172,7 +1200,7 @@ void MediaPlayerPrivate::setVisible(bool b) } } -bool MediaPlayerPrivate::hasAvailableVideoFrame() const +bool MediaPlayerPrivateQTKit::hasAvailableVideoFrame() const { // When using a QTMovieLayer return true as soon as the movie reaches QTMovieLoadStatePlayable // because although we don't *know* when the first frame has decoded, by the time we get and @@ -1186,7 +1214,7 @@ bool MediaPlayerPrivate::hasAvailableVideoFrame() const return m_videoFrameHasDrawn; } -void MediaPlayerPrivate::repaint() +void MediaPlayerPrivateQTKit::repaint() { if (m_hasUnsupportedTracks) return; @@ -1204,7 +1232,7 @@ void MediaPlayerPrivate::repaint() m_player->repaint(); } -void MediaPlayerPrivate::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& r) +void MediaPlayerPrivateQTKit::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& r) { id qtVideoRenderer = m_qtVideoRenderer.get(); if (!qtVideoRenderer && currentRenderingMode() == MediaRenderingMovieLayer) { @@ -1218,7 +1246,7 @@ void MediaPlayerPrivate::paintCurrentFrameInContext(GraphicsContext* context, co paint(context, r); } -void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& r) +void MediaPlayerPrivateQTKit::paint(GraphicsContext* context, const IntRect& r) { if (context->paintingDisabled() || m_hasUnsupportedTracks) return; @@ -1355,7 +1383,7 @@ static HashSet<String> mimeModernTypesCache() return cache; } -void MediaPlayerPrivate::getSupportedTypes(HashSet<String>& supportedTypes) +void MediaPlayerPrivateQTKit::getSupportedTypes(HashSet<String>& supportedTypes) { supportedTypes = mimeModernTypesCache(); @@ -1368,7 +1396,7 @@ void MediaPlayerPrivate::getSupportedTypes(HashSet<String>& supportedTypes) supportedTypes.add(*it); } -MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs) +MediaPlayer::SupportsType MediaPlayerPrivateQTKit::supportsType(const String& type, const String& codecs) { // Only return "IsSupported" if there is no codecs parameter for now as there is no way to ask QT if it supports an // extended MIME type yet. @@ -1380,7 +1408,7 @@ MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, c return MediaPlayer::IsNotSupported; } -bool MediaPlayerPrivate::isAvailable() +bool MediaPlayerPrivateQTKit::isAvailable() { #ifdef BUILDING_ON_TIGER SInt32 version; @@ -1401,7 +1429,7 @@ bool MediaPlayerPrivate::isAvailable() #endif } -void MediaPlayerPrivate::disableUnsupportedTracks() +void MediaPlayerPrivateQTKit::disableUnsupportedTracks() { if (!m_qtMovie) { m_enabledTrackCount = 0; @@ -1491,35 +1519,35 @@ void MediaPlayerPrivate::disableUnsupportedTracks() } } -void MediaPlayerPrivate::sawUnsupportedTracks() +void MediaPlayerPrivateQTKit::sawUnsupportedTracks() { m_hasUnsupportedTracks = true; m_player->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_player); } #if USE(ACCELERATED_COMPOSITING) -bool MediaPlayerPrivate::supportsAcceleratedRendering() const +bool MediaPlayerPrivateQTKit::supportsAcceleratedRendering() const { // Also don't claim to support accelerated rendering when in the media document, as we will then render // via QTMovieView which is already accelerated. return isReadyForVideoSetup() && getQTMovieLayerClass() != Nil && !m_player->inMediaDocument(); } -void MediaPlayerPrivate::acceleratedRenderingStateChanged() +void MediaPlayerPrivateQTKit::acceleratedRenderingStateChanged() { // Set up or change the rendering path if necessary. setUpVideoRendering(); } #endif -bool MediaPlayerPrivate::hasSingleSecurityOrigin() const +bool MediaPlayerPrivateQTKit::hasSingleSecurityOrigin() const { // We tell quicktime to disallow resources that come from different origins // so we know all media is single origin. return true; } -MediaPlayer::MovieLoadType MediaPlayerPrivate::movieLoadType() const +MediaPlayer::MovieLoadType MediaPlayerPrivateQTKit::movieLoadType() const { if (!m_qtMovie) return MediaPlayer::Unknown; @@ -1533,14 +1561,14 @@ MediaPlayer::MovieLoadType MediaPlayerPrivate::movieLoadType() const return movieType; } -void MediaPlayerPrivate::setPreload(MediaPlayer::Preload preload) +void MediaPlayerPrivateQTKit::setPreload(MediaPlayer::Preload preload) { m_preload = preload; if (m_delayingLoad && m_preload != MediaPlayer::None) resumeLoad(); } -float MediaPlayerPrivate::mediaTimeForTimeValue(float timeValue) const +float MediaPlayerPrivateQTKit::mediaTimeForTimeValue(float timeValue) const { if (!metaDataAvailable()) return timeValue; @@ -1553,7 +1581,7 @@ float MediaPlayerPrivate::mediaTimeForTimeValue(float timeValue) const @implementation WebCoreMovieObserver -- (id)initWithCallback:(MediaPlayerPrivate*)callback +- (id)initWithCallback:(MediaPlayerPrivateQTKit*)callback { m_callback = callback; return [super init]; diff --git a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp index 01d75ee..db6de49 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp +++ b/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp @@ -47,7 +47,7 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese if (!addResult.second) return attributesDictionary.get(); - bool allowLigatures = platformData().allowsLigatures() || (typesettingFeatures & Ligatures); + bool allowLigatures = (orientation() == Horizontal && platformData().allowsLigatures()) || (typesettingFeatures & Ligatures); static const int ligaturesNotAllowedValue = 0; static CFNumberRef ligaturesNotAllowed = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &ligaturesNotAllowedValue); @@ -60,14 +60,14 @@ CFDictionaryRef SimpleFontData::getCFStringAttributes(TypesettingFeatures typese static CFNumberRef kerningAdjustment = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &kerningAdjustmentValue); static const void* keysWithKerningDisabled[] = { kCTFontAttributeName, kCTKernAttributeName, kCTLigatureAttributeName, kCTVerticalFormsAttributeName }; const void* valuesWithKerningDisabled[] = { platformData().ctFont(), kerningAdjustment, allowLigatures - ? ligaturesAllowed : ligaturesNotAllowed, platformData().orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; + ? ligaturesAllowed : ligaturesNotAllowed, orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningDisabled, valuesWithKerningDisabled, sizeof(keysWithKerningDisabled) / sizeof(*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, platformData().orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; + const void* valuesWithKerningEnabled[] = { platformData().ctFont(), allowLigatures ? ligaturesAllowed : ligaturesNotAllowed, orientation() == Vertical ? kCFBooleanTrue : kCFBooleanFalse }; attributesDictionary.adoptCF(CFDictionaryCreate(0, keysWithKerningEnabled, valuesWithKerningEnabled, sizeof(keysWithKerningEnabled) / sizeof(*keysWithKerningEnabled), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index fd57630..e1d3f43 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -260,6 +260,24 @@ void SimpleFontData::platformInit() m_descent = 3; } + if (m_orientation == Vertical) { + // Ignore vertical orientation when the font doesn't support vertical metrics. + // The check doesn't look neat but this is what AppKit does for vertical writing... + RetainPtr<CFArrayRef> tableTags(AdoptCF, CTFontCopyAvailableTables(m_platformData.ctFont(), kCTFontTableOptionExcludeSynthetic)); + CFIndex numTables = CFArrayGetCount(tableTags.get()); + bool found = false; + for (CFIndex index = 0; index < numTables; ++index) { + CTFontTableTag tag = (CTFontTableTag)(uintptr_t)CFArrayGetValueAtIndex(tableTags.get(), index); + if (tag == kCTFontTableVhea || tag == kCTFontTableVORG) { + found = true; + break; + } + } + + if (found == false) + m_orientation = Horizontal; + } + // Measure the actual character "x", because AppKit synthesizes X height rather than getting it from the font. // Unfortunately, NSFont will round this for us so we don't quite get the right value. GlyphPage* glyphPageZero = GlyphPageTreeNode::getRootChild(this, 0)->page(); @@ -339,6 +357,11 @@ void SimpleFontData::platformCharWidthInit() void SimpleFontData::platformDestroy() { + if (m_smallCapsFontData && !isCustomFont()) { + fontCache()->releaseFontData(m_smallCapsFontData); + m_smallCapsFontData = 0; + } + #ifdef BUILDING_ON_TIGER if (m_styleGroup) wkReleaseStyleGroup(m_styleGroup); @@ -359,8 +382,8 @@ SimpleFontData* SimpleFontData::smallCapsFontData(const FontDescription& fontDes m_smallCapsFontData = new SimpleFontData(smallCapsFontData, true, false); } else { BEGIN_BLOCK_OBJC_EXCEPTIONS; - float size = [m_platformData.font() pointSize] * smallCapsFontSizeMultiplier; - FontPlatformData smallCapsFont([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size]); + float size = m_platformData.size() * smallCapsFontSizeMultiplier; + FontPlatformData smallCapsFont([[NSFontManager sharedFontManager] convertFont:m_platformData.font() toSize:size], size); // AppKit resets the type information (screen/printer) when you convert a font to a different size. // We have to fix up the font that we're handed back. @@ -423,7 +446,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const FloatRect boundingBox; #ifndef BUILDING_ON_TIGER boundingBox = CTFontGetBoundingRectsForGlyphs(m_platformData.ctFont(), - m_platformData.orientation() == Vertical ? kCTFontVerticalOrientation : kCTFontHorizontalOrientation, &glyph, 0, 1); + orientation() == Vertical ? kCTFontVerticalOrientation : kCTFontHorizontalOrientation, &glyph, 0, 1); boundingBox.setY(-boundingBox.bottom()); #else // FIXME: Custom fonts don't have NSFonts, so this function doesn't compute correct bounds for these on Tiger. @@ -441,7 +464,7 @@ FloatRect SimpleFontData::platformBoundsForGlyph(Glyph glyph) const float SimpleFontData::platformWidthForGlyph(Glyph glyph) const { CGSize advance; - if (m_platformData.orientation() == Horizontal) { + if (orientation() == Horizontal || m_isBrokenIdeographFont) { NSFont* font = platformData().font(); float pointSize = platformData().m_size; CGAffineTransform m = CGAffineTransformMakeScale(pointSize, pointSize); |