Commit 26617960 authored by cmarrin@apple.com's avatar cmarrin@apple.com

Fixed changed virtual function in GraphicsLayerCACF and call order issues

        https://bugs.webkit.org/show_bug.cgi?id=34348
        
        The correct virtual function in GraphicsLayerCACF is now being
        called. We also fixed an issue in QTMovieWin where the size
        of the movie was not being set correctly because the call order
        was changed.
        
        I also changed the order of a couple of calls in QTMovieWin to account
        for changed calling order from the logic above.



git-svn-id: svn://svn.chromium.org/blink/trunk@54455 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 698585e8
2010-02-05 Chris Marrin <cmarrin@apple.com>
Reviewed by Simon Fraser.
Fixed changed virtual function in GraphicsLayerCACF and call order issues
https://bugs.webkit.org/show_bug.cgi?id=34348
The correct virtual function in GraphicsLayerCACF is now being
called. We also fixed an issue in QTMovieWin where the size
of the movie was not being set correctly because the call order
was changed.
I also changed the order of a couple of calls in QTMovieWin to account
for changed calling order from the logic above.
* platform/graphics/win/GraphicsLayerCACF.cpp:Update to new virtual function API
(WebCore::GraphicsLayerCACF::setContentsToMedia):
(WebCore::GraphicsLayerCACF::updateContentsMedia):
* platform/graphics/win/GraphicsLayerCACF.h:Update to new virtual function API
(WebCore::GraphicsLayerCACF::):
* platform/graphics/win/QTMovieWin.cpp:
(QTMovieWinPrivate::cacheMovieScale):Fix a bug where ratio was computed wrong because it was using integer math
(QTMovieWinPrivate::task):Compute movie scale before computing movie size so values are correct
(QTMovieWinPrivate::setSize):Move movie size update to updateMovieSize()
(QTMovieWinPrivate::updateMovieSize):Wrap size update in a new call so it can be used from multiple places
2010-02-05 Enrica Casucci <enrica@apple.com>
Reviewed by Simon Fraser.
......
......@@ -364,21 +364,18 @@ void GraphicsLayerCACF::setContentsToImage(Image* image)
updateSublayerList();
}
void GraphicsLayerCACF::setContentsToVideo(PlatformLayer* videoLayer)
void GraphicsLayerCACF::setContentsToMedia(PlatformLayer* mediaLayer)
{
bool childrenChanged = false;
if (videoLayer != m_contentsLayer.get())
childrenChanged = true;
if (mediaLayer == m_contentsLayer)
return;
m_contentsLayer = videoLayer;
m_contentsLayerPurpose = videoLayer ? ContentsLayerForVideo : NoContentsLayer;
m_contentsLayer = mediaLayer;
m_contentsLayerPurpose = mediaLayer ? ContentsLayerForMedia : NoContentsLayer;
updateContentsVideo();
updateContentsMedia();
// This has to happen after updateContentsVideo
if (childrenChanged)
updateSublayerList();
// This has to happen after updateContentsMedia
updateSublayerList();
}
void GraphicsLayerCACF::setGeometryOrientation(CompositingCoordinatesOrientation orientation)
......@@ -633,9 +630,9 @@ void GraphicsLayerCACF::updateContentsImage()
}
}
void GraphicsLayerCACF::updateContentsVideo()
void GraphicsLayerCACF::updateContentsMedia()
{
// Video layer was set as m_contentsLayer, and will get parented in updateSublayerList().
// Media layer was set as m_contentsLayer, and will get parented in updateSublayerList().
if (m_contentsLayer) {
setupContentsLayer(m_contentsLayer.get());
updateContentsRect();
......
......@@ -82,7 +82,7 @@ public:
virtual void setContentsRect(const IntRect&);
virtual void setContentsToImage(Image*);
virtual void setContentsToVideo(PlatformLayer*);
virtual void setContentsToMedia(PlatformLayer*);
virtual PlatformLayer* platformLayer() const;
......@@ -115,7 +115,7 @@ private:
void updateLayerBackgroundColor();
void updateContentsImage();
void updateContentsVideo();
void updateContentsMedia();
void updateContentsRect();
void updateGeometryOrientation();
......@@ -129,7 +129,7 @@ private:
enum ContentsLayerPurpose {
NoContentsLayer = 0,
ContentsLayerForImage,
ContentsLayerForVideo
ContentsLayerForMedia
};
ContentsLayerPurpose m_contentsLayerPurpose;
......
......@@ -99,6 +99,7 @@ public:
void deleteGWorld();
void clearGWorld();
void cacheMovieScale();
void updateMovieSize();
void setSize(int, int);
......@@ -226,8 +227,8 @@ void QTMovieWinPrivate::cacheMovieScale()
GetMovieNaturalBoundsRect(m_movie, &naturalRect);
GetMovieBox(m_movie, &initialRect);
int naturalWidth = naturalRect.right - naturalRect.left;
int naturalHeight = naturalRect.bottom - naturalRect.top;
float naturalWidth = naturalRect.right - naturalRect.left;
float naturalHeight = naturalRect.bottom - naturalRect.top;
if (naturalWidth)
m_widthScaleFactor = (initialRect.right - initialRect.left) / naturalWidth;
......@@ -259,14 +260,16 @@ void QTMovieWinPrivate::task()
// we only need to erase the movie gworld when the load state changes to loaded while it
// is visible as the gworld is destroyed/created when visibility changes
bool shouldRestorePlaybackState = false;
if (loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded) {
bool movieNewlyPlayable = loadState >= QTMovieLoadStateLoaded && m_loadState < QTMovieLoadStateLoaded;
m_loadState = loadState;
if (movieNewlyPlayable) {
cacheMovieScale();
updateMovieSize();
if (m_visible)
clearGWorld();
cacheMovieScale();
shouldRestorePlaybackState = true;
}
m_loadState = loadState;
if (!m_movieController && m_loadState >= QTMovieLoadStateLoaded)
createMovieController();
m_client->movieLoadStateChanged(m_movieWin);
......@@ -403,7 +406,6 @@ void QTMovieWinPrivate::clearGWorld()
MacSetPort(savePort);
}
void QTMovieWinPrivate::setSize(int width, int height)
{
if (m_width == width && m_height == height)
......@@ -421,17 +423,26 @@ void QTMovieWinPrivate::setSize(int width, int height)
ASSERT(m_scaleCached);
#endif
updateMovieSize();
}
void QTMovieWinPrivate::updateMovieSize()
{
if (!m_movie || m_loadState < QTMovieLoadStateLoaded)
return;
Rect bounds;
bounds.top = 0;
bounds.left = 0;
bounds.right = width;
bounds.bottom = height;
bounds.right = m_width;
bounds.bottom = m_height;
if (m_movieController)
MCSetControllerBoundsRect(m_movieController, &bounds);
SetMovieBox(m_movie, &bounds);
updateGWorld();
}
void QTMovieWinPrivate::deleteGWorld()
{
ASSERT(m_gWorld);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment