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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 1567623007: Traverse into subdocuments when mapping plugin rects from absolute to local space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 unclippedIntLocalRect = IntRect(); 920 unclippedIntLocalRect = IntRect();
921 return; 921 return;
922 } 922 }
923 923
924 LayoutView* rootView = m_element->document().view()->layoutView(); 924 LayoutView* rootView = m_element->document().view()->layoutView();
925 while (rootView->frame()->ownerLayoutObject()) 925 while (rootView->frame()->ownerLayoutObject())
926 rootView = rootView->frame()->ownerLayoutObject()->view(); 926 rootView = rootView->frame()->ownerLayoutObject()->view();
927 927
928 LayoutBox* box = toLayoutBox(ownerElement->layoutObject()); 928 LayoutBox* box = toLayoutBox(ownerElement->layoutObject());
929 929
930 // Plugin frameRects are in absolute screen space. 930 // Plugin frameRects are in absolute space within their frame.
931 IntRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(fr ameRect()), UseTransforms).enclosingBoundingBox(); 931 IntRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(fr ameRect()), UseTransforms).enclosingBoundingBox();
932 932
933 LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace); 933 LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace);
934 box->mapToVisibleRectInAncestorSpace(rootView, unclippedAbsoluteRect, nullpt r); 934 box->mapToVisibleRectInAncestorSpace(rootView, unclippedAbsoluteRect, nullpt r);
935 935
936 // The frameRect is already in absolute space of the local frame to the plug in. 936 // The frameRect is already in absolute space of the local frame to the plug in.
937 windowRect = frameRect(); 937 windowRect = frameRect();
938 // Map up to the root frame. 938 // Map up to the root frame.
939 windowRect = enclosingIntRect(m_element->document().view()->layoutView()->lo calToAbsoluteQuad(FloatQuad(FloatRect(frameRect())), TraverseDocumentBoundaries) .boundingBox()); 939 windowRect = enclosingIntRect(m_element->document().view()->layoutView()->lo calToAbsoluteQuad(FloatQuad(FloatRect(frameRect())), TraverseDocumentBoundaries) .boundingBox());
940 // Finally, adjust for scrolling of the root frame, which the above does not take into account. 940 // Finally, adjust for scrolling of the root frame, which the above does not take into account.
941 windowRect.moveBy(roundedIntPoint(-rootView->viewRect().location())); 941 windowRect.moveBy(roundedIntPoint(-rootView->viewRect().location()));
942 942
943 clippedLocalRect = enclosingIntRect(unclippedAbsoluteRect); 943 clippedLocalRect = enclosingIntRect(unclippedAbsoluteRect);
944 unclippedIntLocalRect = clippedLocalRect; 944 unclippedIntLocalRect = clippedLocalRect;
945 clippedLocalRect.intersect(rootView->frameView()->visibleContentRect()); 945 clippedLocalRect.intersect(rootView->frameView()->visibleContentRect());
946 946
947 // TODO(chrishtr): intentionally ignore transform, because the positioning o f frameRect() does also. This is probably wrong. 947 // TODO(chrishtr): intentionally ignore transform, because the positioning o f frameRect() does also. This is probably wrong.
948 unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedIntLocal Rect)).enclosingBoundingBox(); 948 unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedIntLocal Rect), TraverseDocumentBoundaries).enclosingBoundingBox();
949 clippedLocalRect = box->absoluteToLocalQuad(FloatRect(clippedLocalRect)).enc losingBoundingBox(); 949 clippedLocalRect = box->absoluteToLocalQuad(FloatRect(clippedLocalRect), Tra verseDocumentBoundaries).enclosingBoundingBox();
950 } 950 }
951 951
952 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) 952 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects)
953 { 953 {
954 // document().layoutView() can be null when we receive messages from the 954 // document().layoutView() can be null when we receive messages from the
955 // plugins while we are destroying a frame. 955 // plugins while we are destroying a frame.
956 // FIXME: Can we just check m_element->document().isActive() ? 956 // FIXME: Can we just check m_element->document().isActive() ?
957 if (m_element->layoutObject()->document().layoutView()) { 957 if (m_element->layoutObject()->document().layoutView()) {
958 // Take our element and get the clip rect from the enclosing layer and 958 // Take our element and get the clip rect from the enclosing layer and
959 // frame view. 959 // frame view.
960 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t); 960 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec t);
961 } 961 }
962 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 962 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
963 // Convert to the plugin position. 963 // Convert to the plugin position.
964 for (size_t i = 0; i < cutOutRects.size(); i++) 964 for (size_t i = 0; i < cutOutRects.size(); i++)
965 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 965 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
966 } 966 }
967 967
968 } // namespace blinkf 968 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebPluginContainerImpl.h ('k') | third_party/WebKit/Source/web/tests/WebPluginContainerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698