[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jer.noble at apple.com jer.noble at apple.com
Wed Dec 22 13:19:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8d32741e73720400aa7e49c295d78b01ebc072ac
Author: jer.noble at apple.com <jer.noble at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 11 06:24:36 2010 +0000

    2010-09-10  Jer Noble  <jer.noble at apple.com>
    
            Reviewed by Simon Fraser.
    
            Movies with track or movie matrices don't display in <video> elements (Safari 5/Windows)
            https://bugs.webkit.org/show_bug.cgi?id=45333
    
            The rootChild layer must be set as flipped, otherwise transformed movies will appear
            incorrectly rotated.
    
            * FullscreenVideoController.cpp:
            (FullscreenVideoController::enterFullscreen):
    2010-09-10  Dan Bernstein  <mitz at apple.com>
    
            Reviewed by Darin Adler.
    
            <rdar://problem/8414282> Can’t dynamically change first-letter to/from floating
    
            Test: fast/dynamic/first-letter-display-change.html
    
            * rendering/RenderBlock.cpp:
            (WebCore::styleForFirstLetter): Factored this helper function out.
            (WebCore::RenderBlock::updateFirstLetter): Renamed variables so that the
            “update style” and “create new” branches use the same terminology. In the
            update case, if the style change requires a new renderer, handle it.
            * rendering/RenderTextFragment.h:
            (WebCore::toRenderTextFragment): Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67285 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index afa54bf..653cc6e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -155,6 +155,45 @@
 
 2010-09-10  Jer Noble  <jer.noble at apple.com>
 
+        Reviewed by Simon Fraser.
+
+        Movies with track or movie matrices don't display in <video> elements (Safari 5/Windows)
+        https://bugs.webkit.org/show_bug.cgi?id=45333
+        rdar://problem/81333126
+        
+        QuickTime will refuse to decode video frames for movies whose movie and track matrices 
+        are non-identity.  To work around this problem, extract the movie and track matrices 
+        from the movie, and set that matrix on the video layer instead.
+
+        * WebCore.vcproj/QTMovieWin.vcproj:
+        * platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp:
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayoutClient::LayoutClient): Added.
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayoutClient::layoutSublayersOfLayer):
+            Layout the video layer according to its superlayer's size.
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualContext):
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::platformLayer):
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::naturalSize):
+            Apply the m_movieTransform to the size reported by QTMovie.
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::retrieveAndResetMovieTransform):
+            Calculate m_movieTransform and reset the movie and track matrices in the movie.
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::createLayerForMovie):
+            Create two nested layers instead of one.
+        (WebCore::MediaPlayerPrivateQuickTimeVisualContext::destroyLayerForMovie):
+            Make sure to remove m_qtVideoLayer from any superlayer before dereferencing it.
+        * platform/graphics/win/QTMovie.cpp:
+        (QTMovie::videoTracks): Added.
+        (QTMovie::getTransform): Added.
+        (QTMovie::setTransform): Added.
+        (QTMovie::resetTransform): Added.
+        * platform/graphics/win/QTMovie.h:
+        * platform/graphics/win/QTTrack.cpp: Added.
+        * platform/graphics/win/QTTrack.h: Added.
+        * platform/graphics/win/WKCACFLayer.cpp:
+        (WebCore::WKCACFLayer::setBounds): Call setNeedsLayout() if a layoutClient is present.
+        (WebCore::WKCACFLayer::setFrame): Call setNeedsLayout() if a layoutClient is present.
+
+2010-09-10  Jer Noble  <jer.noble at apple.com>
+
         No review; build fix only.
 
         Touch mediaControlsQuickTime in order to trigger the UserAgentStyleSheet.h to be rebuilt.
diff --git a/WebCore/WebCore.vcproj/QTMovieWin.vcproj b/WebCore/WebCore.vcproj/QTMovieWin.vcproj
index 04b360f..adda5e0 100644
--- a/WebCore/WebCore.vcproj/QTMovieWin.vcproj
+++ b/WebCore/WebCore.vcproj/QTMovieWin.vcproj
@@ -40,7 +40,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\QTInternalSDK\CIncludes&quot;;&quot;$(WebKitLibrariesDir)\QuickTime SDK\CIncludes&quot;;&quot;$(ProgramFiles)/QuickTime SDK/cincludes&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;"
-				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS"
+				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS;TARGET_OS_WIN32"
 				DisableSpecificWarnings="4819"
 			/>
 			<Tool
@@ -113,7 +113,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\QTInternalSDK\CIncludes&quot;;&quot;$(WebKitLibrariesDir)\QuickTime SDK\CIncludes&quot;;&quot;$(ProgramFiles)/QuickTime SDK/cincludes&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;"
-				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS"
+				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS;TARGET_OS_WIN32"
 				DisableSpecificWarnings="4819"
 			/>
 			<Tool
@@ -185,7 +185,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\QTInternalSDK\CIncludes&quot;;&quot;$(WebKitLibrariesDir)\QuickTime SDK\CIncludes&quot;;&quot;$(ProgramFiles)/QuickTime SDK/cincludes&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;"
-				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS"
+				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS;TARGET_OS_WIN32"
 				DisableSpecificWarnings="4819"
 			/>
 			<Tool
@@ -257,7 +257,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				AdditionalIncludeDirectories="&quot;$(ProjectDir)..\&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\QTInternalSDK\CIncludes&quot;;&quot;$(WebKitLibrariesDir)\QuickTime SDK\CIncludes&quot;;&quot;$(ProgramFiles)/QuickTime SDK/cincludes&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;"
-				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS"
+				PreprocessorDefinitions="_USRDLL;QTMOVIEWIN_EXPORTS;TARGET_OS_WIN32"
 				DisableSpecificWarnings="4819"
 			/>
 			<Tool
@@ -341,6 +341,10 @@
 				RelativePath="..\platform\graphics\win\QTPixelBuffer.cpp"
 				>
 			</File>
+			<File
+				RelativePath="..\platform\graphics\win\QTTrack.cpp"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Header Files"
@@ -375,6 +379,10 @@
 				RelativePath="..\platform\graphics\win\QTPixelBuffer.h"
 				>
 			</File>
+			<File
+				RelativePath="..\platform\graphics\win\QTTrack.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Resource Files"
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
index 9bc68d1..4c25dce 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.cpp
@@ -47,6 +47,7 @@
 #include "Timer.h"
 #include <AssertMacros.h>
 #include <CoreGraphics/CGContext.h>
+#include <CoreGraphics/CGFloat.h>
 #include <Wininet.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/HashSet.h>
@@ -97,6 +98,39 @@ public:
 private:
     MediaPlayerPrivateQuickTimeVisualContext* m_parent;
 };
+
+class MediaPlayerPrivateQuickTimeVisualContext::LayoutClient : public WKCACFLayerLayoutClient {
+public:
+    LayoutClient(MediaPlayerPrivateQuickTimeVisualContext* parent) : m_parent(parent) {}
+    virtual void layoutSublayersOfLayer(WKCACFLayer*);
+private:
+    MediaPlayerPrivateQuickTimeVisualContext* m_parent;
+};
+
+void MediaPlayerPrivateQuickTimeVisualContext::LayoutClient::layoutSublayersOfLayer(WKCACFLayer* layer)
+{
+    ASSERT(m_parent);
+    ASSERT(m_parent->m_transformLayer->platformLayer() == layer);
+
+    CGSize parentSize = layer->bounds().size;
+    CGSize naturalSize = m_parent->naturalSize();
+
+    // Calculate the ratio of these two sizes and use that ratio to scale the qtVideoLayer:
+    CGSize ratio = CGSizeMake(parentSize.width / naturalSize.width, parentSize.height / naturalSize.height);
+
+    int videoWidth = 0;
+    int videoHeight = 0;
+    m_parent->m_movie->getNaturalSize(videoWidth, videoHeight);
+    CGRect videoBounds = CGRectMake(0, 0, videoWidth * ratio.width, videoHeight * ratio.height);
+    CGPoint videoAnchor = m_parent->m_qtVideoLayer->anchorPoint();
+
+    // Calculate the new position based on the parent's size:
+    CGPoint position = CGPointMake(parentSize.width * 0.5 - videoBounds.size.width * (0.5 - videoAnchor.x),
+        parentSize.height * 0.5 - videoBounds.size.height * (0.5 - videoAnchor.y)); 
+
+    m_parent->m_qtVideoLayer->setBounds(videoBounds);
+    m_parent->m_qtVideoLayer->setPosition(position);
+}
 #endif
 
 class MediaPlayerPrivateQuickTimeVisualContext::VisualContextClient : public QTMovieVisualContextClient {
@@ -137,8 +171,10 @@ MediaPlayerPrivateQuickTimeVisualContext::MediaPlayerPrivateQuickTimeVisualConte
     , m_movieClient(new MediaPlayerPrivateQuickTimeVisualContext::MovieClient(this))
 #if USE(ACCELERATED_COMPOSITING)
     , m_layerClient(new MediaPlayerPrivateQuickTimeVisualContext::LayerClient(this))
+    , m_layoutClient(new MediaPlayerPrivateQuickTimeVisualContext::LayoutClient(this))
 #endif
     , m_visualContextClient(new MediaPlayerPrivateQuickTimeVisualContext::VisualContextClient(this))
+    , m_movieTransform(CGAffineTransformIdentity)
 {
 }
 
@@ -169,7 +205,7 @@ PlatformMedia MediaPlayerPrivateQuickTimeVisualContext::platformMedia() const
 #if USE(ACCELERATED_COMPOSITING)
 PlatformLayer* MediaPlayerPrivateQuickTimeVisualContext::platformLayer() const
 {
-    return m_qtVideoLayer ? m_qtVideoLayer->platformLayer() : 0;
+    return m_transformLayer ? m_transformLayer->platformLayer() : 0;
 }
 #endif
 
@@ -404,7 +440,9 @@ IntSize MediaPlayerPrivateQuickTimeVisualContext::naturalSize() const
     int width;
     int height;
     m_movie->getNaturalSize(width, height);
-    return IntSize(width, height);
+    CGSize originalSize = {width, height};
+    CGSize transformedSize = CGSizeApplyAffineTransform(originalSize, m_movieTransform);
+    return IntSize(CGFAbs(transformedSize.width), CGFAbs(transformedSize.height));
 }
 
 bool MediaPlayerPrivateQuickTimeVisualContext::hasVideo() const
@@ -763,7 +801,7 @@ void MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage()
         if (!buffer.pixelBufferRef())
             return;
 
-        WKCACFLayer* layer = static_cast<WKCACFLayer*>(m_qtVideoLayer->platformLayer());
+        WKCACFLayer* layer = m_qtVideoLayer.get();
 
         if (!buffer.lockBaseAddress()) {
             if (requiredDllsAvailable()) {
@@ -1017,6 +1055,38 @@ bool MediaPlayerPrivateQuickTimeVisualContext::hasSetUpVideoRendering() const
 #endif
 }
 
+void MediaPlayerPrivateQuickTimeVisualContext::retrieveAndResetMovieTransform()
+{
+    // First things first, reset the total movie transform so that
+    // we can bail out early:
+    m_movieTransform = CGAffineTransformIdentity;
+
+    if (!m_movie || !m_movie->hasVideo())
+        return;
+
+    // This trick will only work on movies with a single video track,
+    // so bail out early if the video contains more than one (or zero)
+    // video tracks.
+    QTTrackArray videoTracks = m_movie->videoTracks();
+    if (videoTracks.size() != 1)
+        return;
+
+    QTTrack* track = videoTracks[0].get();
+    ASSERT(track);
+
+    CGAffineTransform movieTransform = m_movie->getTransform();
+    if (!CGAffineTransformEqualToTransform(movieTransform, CGAffineTransformIdentity))
+        m_movie->resetTransform();
+
+    CGAffineTransform trackTransform = track->getTransform();
+    if (!CGAffineTransformEqualToTransform(trackTransform, CGAffineTransformIdentity))
+        track->resetTransform();
+
+    // Multiply the two transforms together, taking care to 
+    // do so in the correct order, track * movie = final:
+    m_movieTransform = CGAffineTransformConcat(trackTransform, movieTransform);
+}
+
 void MediaPlayerPrivateQuickTimeVisualContext::createLayerForMovie()
 {
 #if USE(ACCELERATED_COMPOSITING)
@@ -1028,17 +1098,35 @@ void MediaPlayerPrivateQuickTimeVisualContext::createLayerForMovie()
     // Create a GraphicsLayer that won't be inserted directly into the render tree, but will used 
     // as a wrapper for a WKCACFLayer which gets inserted as the content layer of the video 
     // renderer's GraphicsLayer.
-    m_qtVideoLayer.set(new GraphicsLayerCACF(m_layerClient.get()));
-    if (!m_qtVideoLayer)
+    m_transformLayer.set(new GraphicsLayerCACF(m_layerClient.get()));
+    if (!m_transformLayer)
         return;
 
     // Mark the layer as drawing itself, anchored in the top left, and bottom-up.
-    m_qtVideoLayer->setDrawsContent(true);
-    m_qtVideoLayer->setAnchorPoint(FloatPoint3D());
-    m_qtVideoLayer->setContentsOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
+    m_transformLayer->setDrawsContent(false);
+    m_transformLayer->setAnchorPoint(FloatPoint3D());
+    m_transformLayer->setContentsOrientation(GraphicsLayer::CompositingCoordinatesBottomUp);
+    m_transformLayer->platformLayer()->setLayoutClient(m_layoutClient.get());
+
+    m_qtVideoLayer = WKCACFLayer::create(WKCACFLayer::Layer);
+    if (!m_qtVideoLayer)
+        return;
+
+    if (CGAffineTransformEqualToTransform(m_movieTransform, CGAffineTransformIdentity))
+        retrieveAndResetMovieTransform();
+    CGAffineTransform t = m_movieTransform;
+
+    // Remove the translation portion of the transform, since we will always rotate about
+    // the layer's center point.  In our limited use-case (a single video track), this is
+    // safe:
+    t.tx = t.ty = 0;
+    m_qtVideoLayer->setTransform(CATransform3DMakeAffineTransform(t));
+
 #ifndef NDEBUG
     m_qtVideoLayer->setName("Video layer");
 #endif
+    m_transformLayer->platformLayer()->addSublayer(m_qtVideoLayer.get());
+    m_transformLayer->platformLayer()->setNeedsLayout();
     // The layer will get hooked up via RenderLayerBacking::updateGraphicsLayerConfiguration().
 #endif
 
@@ -1052,8 +1140,13 @@ void MediaPlayerPrivateQuickTimeVisualContext::createLayerForMovie()
 void MediaPlayerPrivateQuickTimeVisualContext::destroyLayerForMovie()
 {
 #if USE(ACCELERATED_COMPOSITING)
-    if (m_qtVideoLayer)
+    if (m_qtVideoLayer) {
+        m_qtVideoLayer->removeFromSuperlayer();
         m_qtVideoLayer = 0;
+    }
+
+    if (m_transformLayer)
+        m_transformLayer = 0;
 
     if (m_imageQueue)
         m_imageQueue = 0;
diff --git a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
index 9c449dd..cc28e7b 100644
--- a/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
+++ b/WebCore/platform/graphics/win/MediaPlayerPrivateQuickTimeVisualContext.h
@@ -50,6 +50,7 @@ class IntSize;
 class IntRect;
 
 #if USE(ACCELERATED_COMPOSITING)
+class WKCACFLayer;
 class WKCAImageQueue;
 #endif
 
@@ -154,16 +155,23 @@ private:
     class LayerClient;
     friend class LayerClient;
     OwnPtr<LayerClient> m_layerClient;
+
+    class LayoutClient;
+    friend class LayoutClient;
+    OwnPtr<LayoutClient> m_layoutClient;
 #endif
 
     class VisualContextClient;
     friend class VisualContextClient;
     OwnPtr<VisualContextClient> m_visualContextClient;
 
+    void retrieveAndResetMovieTransform();
+
     MediaPlayer* m_player;
     RefPtr<QTMovie> m_movie;
 #if USE(ACCELERATED_COMPOSITING)
-    OwnPtr<GraphicsLayer> m_qtVideoLayer;
+    RefPtr<WKCACFLayer> m_qtVideoLayer;
+    OwnPtr<GraphicsLayer> m_transformLayer;
     OwnPtr<WKCAImageQueue> m_imageQueue;
 #endif
     RefPtr<QTMovieVisualContext> m_visualContext;
@@ -185,6 +193,8 @@ private:
     double m_timeStartedPlaying;
     double m_timeStoppedPlaying;
 #endif
+    CGAffineTransform m_movieTransform; 
+
 };
 
 }
diff --git a/WebCore/platform/graphics/win/QTMovie.cpp b/WebCore/platform/graphics/win/QTMovie.cpp
index cc1349a..f48ddc5 100644
--- a/WebCore/platform/graphics/win/QTMovie.cpp
+++ b/WebCore/platform/graphics/win/QTMovie.cpp
@@ -28,6 +28,7 @@
 
 #include "QTMovieTask.h"
 #include "QTMovieWinTimer.h"
+#include <FixMath.h>
 #include <GXMath.h>
 #include <Movies.h>
 #include <QTML.h>
@@ -696,6 +697,16 @@ bool QTMovie::hasAudio() const
     return (GetMovieIndTrackType(m_private->m_movie, 1, AudioMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly));
 }
 
+QTTrackArray QTMovie::videoTracks() const
+{
+    QTTrackArray tracks;
+    long trackIndex = 1;
+
+    while (Track theTrack = GetMovieIndTrackType(m_private->m_movie, trackIndex++, VisualMediaCharacteristic, movieTrackCharacteristic | movieTrackEnabledOnly))
+        tracks.append(QTTrack::create(theTrack));
+
+    return tracks;
+}
 
 bool QTMovie::hasClosedCaptions() const 
 {
@@ -830,6 +841,45 @@ void QTMovie::getSupportedType(unsigned index, const UChar*& str, unsigned& len)
     
 }
 
+CGAffineTransform QTMovie::getTransform() const
+{
+    ASSERT(m_private->m_movie);
+    MatrixRecord m = {0};
+    GetMovieMatrix(m_private->m_movie, &m);
+
+    ASSERT(!m.matrix[0][2]);
+    ASSERT(!m.matrix[1][2]);
+    CGAffineTransform transform = CGAffineTransformMake(
+        Fix2X(m.matrix[0][0]),
+        Fix2X(m.matrix[0][1]),
+        Fix2X(m.matrix[1][0]),
+        Fix2X(m.matrix[1][1]),
+        Fix2X(m.matrix[2][0]),
+        Fix2X(m.matrix[2][1]));
+    return transform;
+}
+
+void QTMovie::setTransform(CGAffineTransform t)
+{
+    ASSERT(m_private->m_movie);
+    MatrixRecord m = {{
+        {X2Fix(t.a), X2Fix(t.b), 0},
+        {X2Fix(t.c), X2Fix(t.d), 0},
+        {X2Fix(t.tx), X2Fix(t.ty), fract1},
+    }};
+
+    SetMovieMatrix(m_private->m_movie, &m);
+    m_private->cacheMovieScale();
+}
+
+void QTMovie::resetTransform()
+{
+    ASSERT(m_private->m_movie);
+    SetMovieMatrix(m_private->m_movie, 0);
+    m_private->cacheMovieScale();
+}
+
+
 bool QTMovie::initializeQuickTime() 
 {
     static bool initialized = false;
diff --git a/WebCore/platform/graphics/win/QTMovie.h b/WebCore/platform/graphics/win/QTMovie.h
index 8fa4b6e..470e0e9 100644
--- a/WebCore/platform/graphics/win/QTMovie.h
+++ b/WebCore/platform/graphics/win/QTMovie.h
@@ -26,9 +26,8 @@
 #ifndef QTMovie_h
 #define QTMovie_h
 
-#include <Unicode.h>
-#include <windows.h>
-#include <wtf/RefCounted.h>
+#include "QTTrack.h"
+#include <WTF/Vector.h>
 
 #ifdef QTMOVIEWIN_EXPORTS
 #define QTMOVIEWIN_API __declspec(dllexport)
@@ -39,6 +38,7 @@
 class QTMovie;
 class QTMoviePrivate;
 typedef struct MovieType** Movie;
+typedef Vector<RefPtr<QTTrack>> QTTrackArray;
 
 class QTMovieClient {
 public:
@@ -99,12 +99,18 @@ public:
     bool hasVideo() const;
     bool hasAudio() const;
 
+    QTTrackArray videoTracks() const;
+
     bool hasClosedCaptions() const;
     void setClosedCaptionsVisible(bool);
 
     static unsigned countSupportedTypes();
     static void getSupportedType(unsigned index, const UChar*& str, unsigned& len);
 
+    CGAffineTransform getTransform() const;
+    void setTransform(CGAffineTransform);
+    void resetTransform();
+
     Movie getMovieHandle() const;
 
 private:
diff --git a/WebCore/platform/graphics/win/QTTrack.cpp b/WebCore/platform/graphics/win/QTTrack.cpp
new file mode 100644
index 0000000..09142bc
--- /dev/null
+++ b/WebCore/platform/graphics/win/QTTrack.cpp
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2007, 2008, 2009, 2010 Apple, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+#include "config.h"
+
+#include "QTTrack.h"
+
+#include <Movies.h>
+#include <QTML.h>
+
+using namespace std;
+
+class QTTrackPrivate : public Noncopyable {
+public:
+    QTTrackPrivate();
+    ~QTTrackPrivate();
+
+    QTTrack* m_track;
+    Track m_trackHandle;
+};
+
+QTTrackPrivate::QTTrackPrivate()
+    : m_track(0)
+    , m_trackHandle(0)
+{
+}
+
+QTTrackPrivate::~QTTrackPrivate()
+{
+    m_trackHandle = 0;
+}
+
+PassRefPtr<QTTrack> QTTrack::create(Track trackHandle)
+{
+    return adoptRef(new QTTrack(trackHandle));
+}
+
+QTTrack::QTTrack(Track trackHandle)
+    : m_private(new QTTrackPrivate())
+{
+    m_private->m_track = this;
+    m_private->m_trackHandle = trackHandle;
+}
+
+QTTrack::~QTTrack()
+{
+    delete m_private;
+}
+
+bool QTTrack::isEnabled() const
+{
+    ASSERT(m_private->m_track);
+    return GetTrackEnabled(m_private->m_trackHandle);
+}
+
+void QTTrack::setEnabled(bool enabled)
+{
+    ASSERT(m_private->m_trackHandle);
+    SetTrackEnabled(m_private->m_trackHandle, enabled);
+}
+
+CGAffineTransform QTTrack::getTransform() const
+{
+    ASSERT(m_private->m_trackHandle);
+    MatrixRecord m = {0};
+    GetTrackMatrix(m_private->m_trackHandle, &m);
+
+    ASSERT(!m.matrix[0][2]);
+    ASSERT(!m.matrix[1][2]);
+    CGAffineTransform transform = CGAffineTransformMake(
+        Fix2X(m.matrix[0][0]),
+        Fix2X(m.matrix[0][1]),
+        Fix2X(m.matrix[1][0]),
+        Fix2X(m.matrix[1][1]),
+        Fix2X(m.matrix[2][0]),
+        Fix2X(m.matrix[2][1]));
+
+    return transform;
+}
+
+void QTTrack::setTransform(CGAffineTransform t)
+{
+    ASSERT(m_private->m_trackHandle);
+    MatrixRecord m = {{
+        {X2Fix(t.a), X2Fix(t.b), 0},
+        {X2Fix(t.c), X2Fix(t.d), 0},
+        {X2Fix(t.tx), X2Fix(t.ty), fract1},
+    }};
+
+    SetTrackMatrix(m_private->m_trackHandle, &m);
+}
+
+void QTTrack::resetTransform()
+{
+    ASSERT(m_private->m_trackHandle);
+    SetTrackMatrix(m_private->m_trackHandle, 0);
+}
+
diff --git a/WebCore/platform/graphics/win/QTTrack.h b/WebCore/platform/graphics/win/QTTrack.h
new file mode 100644
index 0000000..bda5644
--- /dev/null
+++ b/WebCore/platform/graphics/win/QTTrack.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2007, 2008, 2009, 2010 Apple, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef QTTrack_h
+#define QTTrack_h
+
+#include <Unicode.h>
+#include <windows.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+// We must include this after <Unicode.h>, or the definition of OSErr will change:
+#include <CoreGraphics/CGAffineTransform.h>
+
+#ifdef QTMOVIEWIN_EXPORTS
+#define QTMOVIEWIN_API __declspec(dllexport)
+#else
+#define QTMOVIEWIN_API __declspec(dllimport)
+#endif
+
+class QTTrack;
+class QTTrackPrivate;
+typedef struct TrackType** Track;
+
+class QTMOVIEWIN_API QTTrack : public RefCounted<QTTrack> {
+public:
+    static PassRefPtr<QTTrack> create(Track);
+    ~QTTrack();
+
+    CGAffineTransform getTransform() const;
+    void setTransform(CGAffineTransform);
+    void resetTransform();
+
+    bool isEnabled() const;
+    void setEnabled(bool);
+
+    Track getTrackHandle() const;
+private:
+    QTTrack(Track);
+    QTTrackPrivate* m_private;
+    friend class QTTrackPrivate;
+};
+
+#endif
diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp
index bbe5883..bf47925 100644
--- a/WebCore/platform/graphics/win/WKCACFLayer.cpp
+++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp
@@ -355,6 +355,9 @@ void WKCACFLayer::setBounds(const CGRect& rect)
 
     if (m_needsDisplayOnBoundsChange)
         setNeedsDisplay();
+
+    if (m_layoutClient)
+        setNeedsLayout();
 }
 
 void WKCACFLayer::setFrame(const CGRect& rect)
@@ -368,6 +371,9 @@ void WKCACFLayer::setFrame(const CGRect& rect)
 
     if (m_needsDisplayOnBoundsChange && !CGSizeEqualToSize(rect.size, oldFrame.size))
         setNeedsDisplay();
+
+    if (m_layoutClient)
+        setNeedsLayout();
 }
 
 void WKCACFLayer::setContentsGravity(ContentsGravityType type)
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 817827a..4b974f7 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-10  Jer Noble  <jer.noble at apple.com>
+
+        Reviewed by Simon Fraser.
+
+        Movies with track or movie matrices don't display in <video> elements (Safari 5/Windows)
+        https://bugs.webkit.org/show_bug.cgi?id=45333
+        
+        The rootChild layer must be set as flipped, otherwise transformed movies will appear
+        incorrectly rotated.
+
+        * FullscreenVideoController.cpp:
+        (FullscreenVideoController::enterFullscreen):
+
 2010-09-10  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebKit/win/FullscreenVideoController.cpp b/WebKit/win/FullscreenVideoController.cpp
index 4b50889..696aaa5 100644
--- a/WebKit/win/FullscreenVideoController.cpp
+++ b/WebKit/win/FullscreenVideoController.cpp
@@ -273,9 +273,10 @@ void FullscreenVideoController::enterFullscreen()
 #if USE(ACCELERATED_COMPOSITING)
     m_fullscreenWindow->setRootChildLayer(m_rootChild);
 
-    WKCACFLayer* videoLayer = m_mediaElement->player()->platformLayer();
+    WKCACFLayer* videoLayer = m_mediaElement->platformLayer();
     m_rootChild->addSublayer(videoLayer);
     m_rootChild->setNeedsLayout();
+    m_rootChild->setGeometryFlipped(1);
 #endif
 
     RECT windowRect;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list