diff options
author | Derek Sollenberger <djsollen@google.com> | 2011-03-02 13:03:09 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-02 13:03:09 -0800 |
commit | 77a54022da2cf1cc0daef87ce65f584248630079 (patch) | |
tree | 034e7c11fd30e7ae003e70e389efd7b99e63b619 /WebCore | |
parent | 70aaca960c4242b5fc70353230c4154087c6545f (diff) | |
parent | 06a6a5b3278850bdae8370474da78c119801b4e2 (diff) | |
download | external_webkit-77a54022da2cf1cc0daef87ce65f584248630079.zip external_webkit-77a54022da2cf1cc0daef87ce65f584248630079.tar.gz external_webkit-77a54022da2cf1cc0daef87ce65f584248630079.tar.bz2 |
Merge "Ensure plugin content does not shift when gaining focus."
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp | 14 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/MediaLayer.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/MediaLayer.h | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 48badf8..7963ae0 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -25,6 +25,7 @@ #include "GraphicsContext.h" #include "Image.h" #include "Length.h" +#include "MediaLayer.h" #include "PlatformBridge.h" #include "PlatformGraphicsContext.h" #include "RenderLayerBacking.h" @@ -321,6 +322,19 @@ void GraphicsLayerAndroid::setSize(const FloatSize& size) return; MLOG("(%x) setSize (%.2f,%.2f)", this, size.width(), size.height()); GraphicsLayer::setSize(size); + + // If it is a media layer the size may have changed as a result of the media + // element (e.g. plugin) gaining focus. Therefore, we must sync the size of + // the focus' outline so that our UI thread can draw accordingly. + if (m_contentLayer->isMedia() && m_client) { + RenderLayer* layer = renderLayerFromClient(m_client); + RenderBox* box = layer->renderBox(); + int outline = box->view()->maximalOutlineSize(); + static_cast<MediaLayer*>(m_contentLayer)->setOutlineSize(outline); + LOG("Media Outline: %d %p %p %p", outline, m_client, layer, box); + LOG("Media Size: %g,%g", size.width(), size.height()); + } + m_contentLayer->setSize(size.width(), size.height()); askForSync(); } diff --git a/WebCore/platform/graphics/android/MediaLayer.cpp b/WebCore/platform/graphics/android/MediaLayer.cpp index 9bc2a3e..fbcd494 100644 --- a/WebCore/platform/graphics/android/MediaLayer.cpp +++ b/WebCore/platform/graphics/android/MediaLayer.cpp @@ -49,6 +49,7 @@ MediaLayer::MediaLayer(jobject weakWebViewRef) : LayerAndroid(false) m_currentTextureInfo = 0; m_isContentInverted = false; + m_outlineSize = 0; XLOG("Creating Media Layer %p", this); } @@ -61,6 +62,7 @@ MediaLayer::MediaLayer(const MediaLayer& layer) : LayerAndroid(layer) m_currentTextureInfo = 0; m_isContentInverted = layer.m_isContentInverted; + m_outlineSize = layer.m_outlineSize; XLOG("Creating Media Layer Copy %p -> %p", &layer, this); } @@ -73,7 +75,13 @@ MediaLayer::~MediaLayer() bool MediaLayer::drawGL(SkMatrix& matrix) { - TilesManager::instance()->shader()->clip(drawClip()); + // when the plugin gains focus webkit applies an outline to the widget, + // which causes the layer to expand to accommodate the outline. Therefore, + // we shrink the clip by the outline's dimensions to ensure the plugin does + // not draw outside of its bounds. + FloatRect clip = drawClip(); + clip.inflate(-m_outlineSize); + TilesManager::instance()->shader()->clip(clip); // check to see if we need to create a video texture m_videoTexture->initNativeWindowIfNeeded(); diff --git a/WebCore/platform/graphics/android/MediaLayer.h b/WebCore/platform/graphics/android/MediaLayer.h index 15bd6d8..203ef93 100644 --- a/WebCore/platform/graphics/android/MediaLayer.h +++ b/WebCore/platform/graphics/android/MediaLayer.h @@ -49,6 +49,7 @@ public: TextureInfo* getCurrentTextureInfo() const { return m_currentTextureInfo; } void invertContents(bool invertContent) { m_isContentInverted = invertContent; } + void setOutlineSize(int size) { m_outlineSize = size; } // functions to manipulate secondary layers for video playback ANativeWindow* acquireNativeWindowForVideo(); @@ -62,6 +63,7 @@ private: TextureInfo* m_currentTextureInfo; bool m_isContentInverted; + int m_outlineSize; // Video texture variables VideoTexture* m_videoTexture; |