| OLD | NEW |
| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 unclippedIntLocalRect = IntRect(); | 961 unclippedIntLocalRect = IntRect(); |
| 962 return; | 962 return; |
| 963 } | 963 } |
| 964 | 964 |
| 965 LayoutView* rootView = m_element->document().view()->layoutView(); | 965 LayoutView* rootView = m_element->document().view()->layoutView(); |
| 966 while (rootView->frame()->ownerLayoutObject()) | 966 while (rootView->frame()->ownerLayoutObject()) |
| 967 rootView = rootView->frame()->ownerLayoutObject()->view(); | 967 rootView = rootView->frame()->ownerLayoutObject()->view(); |
| 968 | 968 |
| 969 LayoutBox* box = toLayoutBox(ownerElement->layoutObject()); | 969 LayoutBox* box = toLayoutBox(ownerElement->layoutObject()); |
| 970 | 970 |
| 971 // Plugin frameRects are in absolute screen space. | 971 // Plugin frameRects are in absolute space within their frame. |
| 972 IntRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(fr
ameRect()), UseTransforms).enclosingBoundingBox(); | 972 IntRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(fr
ameRect()), UseTransforms).enclosingBoundingBox(); |
| 973 | 973 |
| 974 LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace); | 974 LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace); |
| 975 box->mapRectToPaintInvalidationBacking(rootView, unclippedAbsoluteRect, null
ptr); | 975 box->mapRectToPaintInvalidationBacking(rootView, unclippedAbsoluteRect, null
ptr); |
| 976 | 976 |
| 977 // The frameRect is already in absolute space of the local frame to the plug
in. | 977 // The frameRect is already in absolute space of the local frame to the plug
in. |
| 978 windowRect = frameRect(); | 978 windowRect = frameRect(); |
| 979 // Map up to the root frame. | 979 // Map up to the root frame. |
| 980 windowRect = enclosingIntRect(m_element->document().view()->layoutView()->lo
calToAbsoluteQuad(FloatQuad(FloatRect(frameRect())), TraverseDocumentBoundaries)
.boundingBox()); | 980 windowRect = enclosingIntRect(m_element->document().view()->layoutView()->lo
calToAbsoluteQuad(FloatQuad(FloatRect(frameRect())), TraverseDocumentBoundaries)
.boundingBox()); |
| 981 // Finally, adjust for scrolling of the root frame, which the above does not
take into account. | 981 // Finally, adjust for scrolling of the root frame, which the above does not
take into account. |
| 982 windowRect.moveBy(roundedIntPoint(-rootView->viewRect().location())); | 982 windowRect.moveBy(roundedIntPoint(-rootView->viewRect().location())); |
| 983 | 983 |
| 984 clippedLocalRect = enclosingIntRect(unclippedAbsoluteRect); | 984 clippedLocalRect = enclosingIntRect(unclippedAbsoluteRect); |
| 985 unclippedIntLocalRect = clippedLocalRect; | 985 unclippedIntLocalRect = clippedLocalRect; |
| 986 clippedLocalRect.intersect(rootView->frameView()->visibleContentRect()); | 986 clippedLocalRect.intersect(rootView->frameView()->visibleContentRect()); |
| 987 | 987 |
| 988 // TODO(chrishtr): intentionally ignore transform, because the positioning o
f frameRect() does also. This is probably wrong. | 988 // TODO(chrishtr): intentionally ignore transform, because the positioning o
f frameRect() does also. This is probably wrong. |
| 989 unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedIntLocal
Rect)).enclosingBoundingBox(); | 989 unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedIntLocal
Rect), TraverseDocumentBoundaries).enclosingBoundingBox(); |
| 990 clippedLocalRect = box->absoluteToLocalQuad(FloatRect(clippedLocalRect)).enc
losingBoundingBox(); | 990 clippedLocalRect = box->absoluteToLocalQuad(FloatRect(clippedLocalRect), Tra
verseDocumentBoundaries).enclosingBoundingBox(); |
| 991 } | 991 } |
| 992 | 992 |
| 993 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli
pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) | 993 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli
pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) |
| 994 { | 994 { |
| 995 // document().layoutView() can be null when we receive messages from the | 995 // document().layoutView() can be null when we receive messages from the |
| 996 // plugins while we are destroying a frame. | 996 // plugins while we are destroying a frame. |
| 997 // FIXME: Can we just check m_element->document().isActive() ? | 997 // FIXME: Can we just check m_element->document().isActive() ? |
| 998 if (m_element->layoutObject()->document().layoutView()) { | 998 if (m_element->layoutObject()->document().layoutView()) { |
| 999 // Take our element and get the clip rect from the enclosing layer and | 999 // Take our element and get the clip rect from the enclosing layer and |
| 1000 // frame view. | 1000 // frame view. |
| 1001 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 1001 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
| 1002 } | 1002 } |
| 1003 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 1003 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 1004 // Convert to the plugin position. | 1004 // Convert to the plugin position. |
| 1005 for (size_t i = 0; i < cutOutRects.size(); i++) | 1005 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 1006 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 1006 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 } // namespace blinkf | 1009 } // namespace blink |
| OLD | NEW |