Chromium Code Reviews| 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()); |