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

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
« no previous file with comments | « Source/web/WebPluginContainerImpl.h ('k') | Source/web/tests/FakeWebPlugin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebPluginContainerImpl.cpp
diff --git a/Source/web/WebPluginContainerImpl.cpp b/Source/web/WebPluginContainerImpl.cpp
index 87d1b1307076c89a9763040033ca8744915063c9..d1535af7164b7e38fb3675dd0c508d9d09a57dbc 100644
--- a/Source/web/WebPluginContainerImpl.cpp
+++ b/Source/web/WebPluginContainerImpl.cpp
@@ -407,11 +407,11 @@ 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, cutOutRects, isVisible());
+ m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects, isVisible());
if (m_scrollbarGroup) {
m_scrollbarGroup->scrollAnimator()->contentsResized();
@@ -965,28 +965,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 +979,19 @@ 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));
+ IntRect elementUnobscuredRect;
+ IntRect elementWindowClipRect = m_element->document().view()->clipRectsForFrameOwner(m_element, &elementUnobscuredRect);
+ clipRect.intersect(elementWindowClipRect);
+ unobscuredRect.intersect(elementUnobscuredRect);
}
- 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
« no previous file with comments | « Source/web/WebPluginContainerImpl.h ('k') | Source/web/tests/FakeWebPlugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698