| 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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 // Plugin frameRects are in absolute space within their frame. | 903 // Plugin frameRects are in absolute space within their frame. |
| 904 FloatRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(
frameRect()), UseTransforms).boundingBox(); | 904 FloatRect frameRectInOwnerElementSpace = box->absoluteToLocalQuad(FloatRect(
frameRect()), UseTransforms).boundingBox(); |
| 905 | 905 |
| 906 LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace); | 906 LayoutRect unclippedAbsoluteRect(frameRectInOwnerElementSpace); |
| 907 box->mapToVisualRectInAncestorSpace(rootView, unclippedAbsoluteRect); | 907 box->mapToVisualRectInAncestorSpace(rootView, unclippedAbsoluteRect); |
| 908 | 908 |
| 909 // The frameRect is already in absolute space of the local frame to the plug
in. | 909 // The frameRect is already in absolute space of the local frame to the plug
in. |
| 910 windowRect = frameRect(); | 910 windowRect = frameRect(); |
| 911 // Map up to the root frame. | 911 // Map up to the root frame. |
| 912 LayoutRect layoutWindowRect = | 912 LayoutRect layoutWindowRect = |
| 913 LayoutRect(m_element->document().view()->layoutView()->localToAbsoluteQu
ad(FloatQuad(FloatRect(frameRect())), TraverseDocumentBoundaries).boundingBox())
; | 913 LayoutRect(m_element->document().view()->layoutViewItem().localToAbsolut
eQuad(FloatQuad(FloatRect(frameRect())), TraverseDocumentBoundaries).boundingBox
()); |
| 914 // Finally, adjust for scrolling of the root frame, which the above does not
take into account. | 914 // Finally, adjust for scrolling of the root frame, which the above does not
take into account. |
| 915 layoutWindowRect.moveBy(-rootView->viewRect().location()); | 915 layoutWindowRect.moveBy(-rootView->viewRect().location()); |
| 916 windowRect = pixelSnappedIntRect(layoutWindowRect); | 916 windowRect = pixelSnappedIntRect(layoutWindowRect); |
| 917 | 917 |
| 918 LayoutRect layoutClippedLocalRect = unclippedAbsoluteRect; | 918 LayoutRect layoutClippedLocalRect = unclippedAbsoluteRect; |
| 919 LayoutRect unclippedLayoutLocalRect = layoutClippedLocalRect; | 919 LayoutRect unclippedLayoutLocalRect = layoutClippedLocalRect; |
| 920 layoutClippedLocalRect.intersect(LayoutRect(rootView->frameView()->visibleCo
ntentRect())); | 920 layoutClippedLocalRect.intersect(LayoutRect(rootView->frameView()->visibleCo
ntentRect())); |
| 921 | 921 |
| 922 // TODO(chrishtr): intentionally ignore transform, because the positioning o
f frameRect() does also. This is probably wrong. | 922 // TODO(chrishtr): intentionally ignore transform, because the positioning o
f frameRect() does also. This is probably wrong. |
| 923 unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedLayoutLo
calRect), TraverseDocumentBoundaries).enclosingBoundingBox(); | 923 unclippedIntLocalRect = box->absoluteToLocalQuad(FloatRect(unclippedLayoutLo
calRect), TraverseDocumentBoundaries).enclosingBoundingBox(); |
| 924 // As a performance optimization, map the clipped rect separately if is diff
erent than the unclipped rect. | 924 // As a performance optimization, map the clipped rect separately if is diff
erent than the unclipped rect. |
| 925 if (layoutClippedLocalRect != unclippedLayoutLocalRect) | 925 if (layoutClippedLocalRect != unclippedLayoutLocalRect) |
| 926 clippedLocalRect = box->absoluteToLocalQuad(FloatRect(layoutClippedLocal
Rect), TraverseDocumentBoundaries).enclosingBoundingBox(); | 926 clippedLocalRect = box->absoluteToLocalQuad(FloatRect(layoutClippedLocal
Rect), TraverseDocumentBoundaries).enclosingBoundingBox(); |
| 927 else | 927 else |
| 928 clippedLocalRect = unclippedIntLocalRect; | 928 clippedLocalRect = unclippedIntLocalRect; |
| 929 } | 929 } |
| 930 | 930 |
| 931 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli
pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) | 931 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli
pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) |
| 932 { | 932 { |
| 933 // document().layoutView() can be null when we receive messages from the | 933 // document().layoutView() can be null when we receive messages from the |
| 934 // plugins while we are destroying a frame. | 934 // plugins while we are destroying a frame. |
| 935 // FIXME: Can we just check m_element->document().isActive() ? | 935 // FIXME: Can we just check m_element->document().isActive() ? |
| 936 if (m_element->layoutObject()->document().layoutView()) { | 936 if (!m_element->layoutObject()->document().layoutViewItem().isNull()) { |
| 937 // Take our element and get the clip rect from the enclosing layer and | 937 // Take our element and get the clip rect from the enclosing layer and |
| 938 // frame view. | 938 // frame view. |
| 939 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); | 939 computeClipRectsForPlugin(m_element, windowRect, clipRect, unobscuredRec
t); |
| 940 } | 940 } |
| 941 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 941 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 942 // Convert to the plugin position. | 942 // Convert to the plugin position. |
| 943 for (size_t i = 0; i < cutOutRects.size(); i++) | 943 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 944 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 944 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 945 } | 945 } |
| 946 | 946 |
| 947 } // namespace blink | 947 } // namespace blink |
| OLD | NEW |