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

Unified Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 1413523007: Simplify computation of the invalidation rect for a frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
index 7be53ac3319a576f79a2ce2916e262577e7501c0..5c9b8a403b1930817fedb81ea5f6ced5b60f6372 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -55,6 +55,7 @@
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutPart.h"
+#include "core/layout/LayoutView.h"
#include "core/loader/FrameLoadRequest.h"
#include "core/page/FocusController.h"
#include "core/page/Page.h"
@@ -420,7 +421,6 @@ void WebPluginContainerImpl::reportGeometry()
IntRect windowRect, clipRect, unobscuredRect;
Vector<IntRect> cutOutRects;
calculateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects);
-
m_webPlugin->updateGeometry(windowRect, clipRect, unobscuredRect, cutOutRects, isVisible());
}
@@ -944,33 +944,55 @@ void WebPluginContainerImpl::issuePaintInvalidations()
m_pendingInvalidationRect = IntRect();
}
-void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& clipRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects)
+void WebPluginContainerImpl::computeClipRectsForPlugin(
+ const HTMLFrameOwnerElement* ownerElement, IntRect& windowRect, IntRect& clippedLocalRect, IntRect& unclippedIntLocalRect) const
{
- windowRect = toFrameView(parent())->contentsToRootFrame(frameRect());
+ ASSERT(ownerElement);
+
+ if (!ownerElement->layoutObject()) {
+ clippedLocalRect = IntRect();
+ unclippedIntLocalRect = IntRect();
+ return;
+ }
+
+ LayoutView* rootView = m_element->document().view()->layoutView();
+ while (rootView->frame()->ownerLayoutObject())
+ rootView = rootView->frame()->ownerLayoutObject()->view();
+
+ LayoutBox* box = toLayoutBox(ownerElement->layoutObject());
+
+ // Plugin frameRects are in absolute screen space.
+ IntRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(frameRect()), UseTransforms).enclosingBoundingBox();
- // Calculate a clip-rect so that we don't overlap the scrollbars, etc.
- clipRect = convertToContainingWindow(IntRect(0, 0, width(), height()));
- unobscuredRect = clipRect;
+ LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace);
+ box->mapRectToPaintInvalidationBacking(rootView, unclippedAbsoluteRect, nullptr);
+ // The frameRect is already in absolute space.
+ windowRect = frameRect();
+
+ clippedLocalRect = enclosingIntRect(unclippedAbsoluteRect);
+ unclippedIntLocalRect = clippedLocalRect;
+ clippedLocalRect.intersect(rootView->frameView()->visibleContentRect());
+
+ // TODO(chrishtr): intentionally ignore transform, because the positioning of frameRect() does also. This is probably wrong.
+ unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedIntLocalRect)).enclosingBoundingBox();
+ clippedLocalRect = box->absoluteToLocalQuad(FloatRect(clippedLocalRect)).enclosingBoundingBox();
+}
+
+void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& clipRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects)
+{
// document().layoutView() can be 0 when we receive messages from the
// plugins while we are destroying a frame.
// FIXME: Can we just check m_element->document().isActive() ?
if (m_element->layoutObject()->document().layoutView()) {
// Take our element and get the clip rect from the enclosing layer and
// frame view.
- IntRect elementUnobscuredRect;
- IntRect elementWindowClipRect = m_element->document().view()->clipRectsForFrameOwner(m_element, &elementUnobscuredRect);
- clipRect.intersect(elementWindowClipRect);
- unobscuredRect.intersect(elementUnobscuredRect);
+ computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRect);
}
-
- 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());
}
-} // namespace blink
+} // namespace blinkf
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698