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

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
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..be4e8497bd77a93e9e48251f826a5efbbbb7fa51 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"
@@ -944,6 +945,33 @@ void WebPluginContainerImpl::issuePaintInvalidations()
m_pendingInvalidationRect = IntRect();
}
+void WebPluginContainerImpl::computeClipRectsForPlugin(const HTMLFrameOwnerElement* ownerElement, IntRect& clippedAbsoluteRect, IntRect* unclippedIntAbsoluteRect) const
+{
+ ASSERT(ownerElement);
+
+ if (!ownerElement->layoutObject() || !ownerElement->layoutObject()->enclosingLayer()) {
+ clippedAbsoluteRect = IntRect();
chrishtr 2015/11/03 19:22:55 I changed the code to just return an empty rect in
tommycli 2015/11/03 20:10:22 Acknowledged.
+ if (unclippedIntAbsoluteRect)
+ *unclippedIntAbsoluteRect = IntRect();
+
+ return;
+ }
+
+ LayoutView* rootView = m_element->document().view()->layoutView();
+ while (rootView->frame()->ownerLayoutObject())
+ rootView = rootView->frame()->ownerLayoutObject()->view();
+
+ const PaintLayer* enclosingLayer = ownerElement->layoutObject()->enclosingLayer();
+ LayoutRect unclippedAbsoluteRect = enclosingLayer->physicalBoundingBox(LayoutPoint());
+ enclosingLayer->layoutObject()->mapRectToPaintInvalidationBacking(rootView, unclippedAbsoluteRect, nullptr);
chrishtr 2015/11/03 19:22:55 What this does: maps the box rect for the plugin c
+
+ clippedAbsoluteRect = enclosingIntRect(unclippedAbsoluteRect);
+ clippedAbsoluteRect.intersect(rootView->frameView()->visibleContentRect());
+
+ if (unclippedIntAbsoluteRect)
tommycli 2015/11/03 20:10:22 nit: Seems like you're doing the enclosingIntRect
chrishtr 2015/11/03 21:24:56 Done.
+ *unclippedIntAbsoluteRect = enclosingIntRect(unclippedAbsoluteRect);
+}
+
void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& clipRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects)
{
windowRect = toFrameView(parent())->contentsToRootFrame(frameRect());
@@ -958,10 +986,11 @@ void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli
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);
+ IntRect unclippedAbsoluteRect;
+ IntRect clippedAbsoluteRect;
+ computeClipRectsForPlugin(m_element, clippedAbsoluteRect, &unclippedAbsoluteRect);
+ clipRect.intersect(clippedAbsoluteRect);
+ unobscuredRect.intersect(unclippedAbsoluteRect);
}
clipRect.move(-windowRect.x(), -windowRect.y());

Powered by Google App Engine
This is Rietveld 408576698