Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2068)

Unified Diff: Source/web/WebPluginContainerImpl.cpp

Issue 1033603007: Blink: Pass 'unobscured' rect to WebPlugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebPluginContainerImpl.cpp
diff --git a/Source/web/WebPluginContainerImpl.cpp b/Source/web/WebPluginContainerImpl.cpp
index 14d27e068f4994274304e987336c351fd898f4cd..f9c12df34baba04c10edbb456742f7f06a9829d0 100644
--- a/Source/web/WebPluginContainerImpl.cpp
+++ b/Source/web/WebPluginContainerImpl.cpp
@@ -407,10 +407,13 @@ void WebPluginContainerImpl::reportGeometry()
if (!parent() || !m_element->layoutObject())
return;
- IntRect windowRect, clipRect;
+ IntRect windowRect, clipRect, unobscuredRect;
Vector<IntRect> cutOutRects;
- calculateGeometry(frameRect(), windowRect, clipRect, cutOutRects);
+ calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects);
+ m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects, isVisible());
+
+ // TODO(tommycli): Remove this deprecated call once embedders implements the new interface.
m_webPlugin->updateGeometry(windowRect, clipRect, cutOutRects, isVisible());
if (m_scrollbarGroup) {
@@ -965,28 +968,13 @@ void WebPluginContainerImpl::focusPlugin()
containingFrame.document()->setFocusedElement(m_element);
}
-void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect,
- IntRect& windowRect,
- IntRect& clipRect,
- Vector<IntRect>& cutOutRects)
+void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& clipRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects)
{
- windowRect = toFrameView(parent())->contentsToRootFrame(frameRect);
+ windowRect = toFrameView(parent())->contentsToRootFrame(frameRect());
// Calculate a clip-rect so that we don't overlap the scrollbars, etc.
- clipRect = windowClipRect();
- clipRect.move(-windowRect.x(), -windowRect.y());
-
- getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects);
- // Convert to the plugin position.
- for (size_t i = 0; i < cutOutRects.size(); i++)
- cutOutRects[i].move(-frameRect.x(), -frameRect.y());
-}
-
-IntRect WebPluginContainerImpl::windowClipRect() const
-{
- // Start by clipping to our bounds.
- IntRect clipRect =
- convertToContainingWindow(IntRect(0, 0, width(), height()));
+ clipRect = convertToContainingWindow(IntRect(0, 0, width(), height()));
+ unobscuredRect = clipRect;
// document().layoutView() can be 0 when we receive messages from the
// plugins while we are destroying a frame.
@@ -994,11 +982,17 @@ IntRect WebPluginContainerImpl::windowClipRect() const
if (m_element->layoutObject()->document().layoutView()) {
// Take our element and get the clip rect from the enclosing layer and
// frame view.
- clipRect.intersect(
- m_element->document().view()->windowClipRectForFrameOwner(m_element));
+ clipRect.intersect(m_element->document().view()->windowClipRectForFrameOwner(m_element));
+ unobscuredRect.intersect(m_element->document().view()->unobscuredRectForFrameOwner(m_element));
}
- return clipRect;
+ clipRect.move(-windowRect.x(), -windowRect.y());
+ unobscuredRect.move(-windowRect.x(), -windowRect.y());
+
+ getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
+ // Convert to the plugin position.
+ for (size_t i = 0; i < cutOutRects.size(); i++)
+ cutOutRects[i].move(-frameRect().x(), -frameRect().y());
}
bool WebPluginContainerImpl::pluginShouldPersist() const

Powered by Google App Engine
This is Rietveld 408576698