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

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: none 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
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..57fa80b75acfdc9c0a246970ba1f8f8abd20bbd2 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.
@@ -922,11 +921,10 @@ void WebPluginContainerImpl::computeClipRectsForPlugin(
LayoutRect unclippedLayoutLocalRect = layoutClippedLocalRect;
layoutClippedLocalRect.intersect(LayoutRect(rootView->frameView()->visibleContentRect()));
- // TODO(chrishtr): intentionally ignore transform, because the positioning of frameRect() does also. This is probably wrong.
- 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;
}

Powered by Google App Engine
This is Rietveld 408576698