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

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

Issue 2127213002: Avoid lossy effects of rounding by using contentBoxRect directly for plugin bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp » ('j') | 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 e143f82c3b2cb286e6c726780332bc6684822dee..0c43d08a067f6d4009692e1c4e8881240b2c3f35 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -903,10 +903,9 @@ void WebPluginContainerImpl::computeClipRectsForPlugin(
LayoutBox* box = toLayoutBox(ownerElement->layoutObject());
- // Plugin frameRects are in absolute space within their frame.
- FloatRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(frameRect()), UseTransforms).boundingBox();
-
- LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace);
+ // Note: frameRect() for this plugin is equal to contentBoxRect, mapped to the containing view space, and rounded off.
+ // See LayoutPart.cpp::updateWidgetGeometryInternal. To remove the lossy effect of rounding off, use contentBoxRect directly.
+ LayoutRect unclippedAbsoluteRect(box->contentBoxRect());
box->mapToVisualRectInAncestorSpace(rootView, unclippedAbsoluteRect);
// The frameRect is already in absolute space of the local frame to the plugin.
@@ -923,10 +922,10 @@ void WebPluginContainerImpl::computeClipRectsForPlugin(
layoutClippedLocalRect.intersect(LayoutRect(rootView->frameView()->visibleContentRect()));
// TODO(chrishtr): intentionally ignore transform, because the positioning of frameRect() does also. This is probably wrong.
Xianzhu 2016/07/07 18:49:57 Nit: Remove the TODO.
chrishtr 2016/07/07 20:02:14 Done.
- unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedLayoutLocalRect), TraverseDocumentBoundaries).enclosingBoundingBox();
+ unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedLayoutLocalRect), TraverseDocumentBoundaries | UseTransforms).enclosingBoundingBox();
// As a performance optimization, map the clipped rect separately if is different than the unclipped rect.
if (layoutClippedLocalRect != unclippedLayoutLocalRect)
- clippedLocalRect = box->absoluteToLocalQuad(FloatRect(layoutClippedLocalRect), TraverseDocumentBoundaries).enclosingBoundingBox();
+ clippedLocalRect = box->absoluteToLocalQuad(FloatRect(layoutClippedLocalRect), TraverseDocumentBoundaries | UseTransforms).enclosingBoundingBox();
else
clippedLocalRect = unclippedIntLocalRect;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698