Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 #include "core/frame/EventHandlerRegistry.h" | 48 #include "core/frame/EventHandlerRegistry.h" |
| 49 #include "core/frame/FrameView.h" | 49 #include "core/frame/FrameView.h" |
| 50 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
| 51 #include "core/frame/csp/ContentSecurityPolicy.h" | 51 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 52 #include "core/html/HTMLFormElement.h" | 52 #include "core/html/HTMLFormElement.h" |
| 53 #include "core/html/HTMLPlugInElement.h" | 53 #include "core/html/HTMLPlugInElement.h" |
| 54 #include "core/input/EventHandler.h" | 54 #include "core/input/EventHandler.h" |
| 55 #include "core/layout/HitTestResult.h" | 55 #include "core/layout/HitTestResult.h" |
| 56 #include "core/layout/LayoutBox.h" | 56 #include "core/layout/LayoutBox.h" |
| 57 #include "core/layout/LayoutPart.h" | 57 #include "core/layout/LayoutPart.h" |
| 58 #include "core/layout/LayoutView.h" | |
| 58 #include "core/loader/FrameLoadRequest.h" | 59 #include "core/loader/FrameLoadRequest.h" |
| 59 #include "core/page/FocusController.h" | 60 #include "core/page/FocusController.h" |
| 60 #include "core/page/Page.h" | 61 #include "core/page/Page.h" |
| 61 #include "core/page/scrolling/ScrollingCoordinator.h" | 62 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 62 #include "core/paint/LayoutObjectDrawingRecorder.h" | 63 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 63 #include "core/paint/PaintLayer.h" | 64 #include "core/paint/PaintLayer.h" |
| 64 #include "modules/plugins/PluginOcclusionSupport.h" | 65 #include "modules/plugins/PluginOcclusionSupport.h" |
| 65 #include "platform/HostWindow.h" | 66 #include "platform/HostWindow.h" |
| 66 #include "platform/KeyboardCodes.h" | 67 #include "platform/KeyboardCodes.h" |
| 67 #include "platform/PlatformGestureEvent.h" | 68 #include "platform/PlatformGestureEvent.h" |
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 937 return; | 938 return; |
| 938 | 939 |
| 939 LayoutBox* layoutObject = toLayoutBox(m_element->layoutObject()); | 940 LayoutBox* layoutObject = toLayoutBox(m_element->layoutObject()); |
| 940 if (!layoutObject) | 941 if (!layoutObject) |
| 941 return; | 942 return; |
| 942 | 943 |
| 943 layoutObject->invalidatePaintRectangle(LayoutRect(m_pendingInvalidationRect) ); | 944 layoutObject->invalidatePaintRectangle(LayoutRect(m_pendingInvalidationRect) ); |
| 944 m_pendingInvalidationRect = IntRect(); | 945 m_pendingInvalidationRect = IntRect(); |
| 945 } | 946 } |
| 946 | 947 |
| 948 void WebPluginContainerImpl::computeClipRectsForPlugin(const HTMLFrameOwnerEleme nt* ownerElement, IntRect& clippedAbsoluteRect, IntRect* unclippedIntAbsoluteRec t) const | |
| 949 { | |
| 950 ASSERT(ownerElement); | |
| 951 | |
| 952 if (!ownerElement->layoutObject() || !ownerElement->layoutObject()->enclosin gLayer()) { | |
| 953 clippedAbsoluteRect = IntRect(); | |
|
chrishtr
2015/11/03 19:22:55
I changed the code to just return an empty rect in
tommycli
2015/11/03 20:10:22
Acknowledged.
| |
| 954 if (unclippedIntAbsoluteRect) | |
| 955 *unclippedIntAbsoluteRect = IntRect(); | |
| 956 | |
| 957 return; | |
| 958 } | |
| 959 | |
| 960 LayoutView* rootView = m_element->document().view()->layoutView(); | |
| 961 while (rootView->frame()->ownerLayoutObject()) | |
| 962 rootView = rootView->frame()->ownerLayoutObject()->view(); | |
| 963 | |
| 964 const PaintLayer* enclosingLayer = ownerElement->layoutObject()->enclosingLa yer(); | |
| 965 LayoutRect unclippedAbsoluteRect = enclosingLayer->physicalBoundingBox(Layou tPoint()); | |
| 966 enclosingLayer->layoutObject()->mapRectToPaintInvalidationBacking(rootView, unclippedAbsoluteRect, nullptr); | |
|
chrishtr
2015/11/03 19:22:55
What this does: maps the box rect for the plugin c
| |
| 967 | |
| 968 clippedAbsoluteRect = enclosingIntRect(unclippedAbsoluteRect); | |
| 969 clippedAbsoluteRect.intersect(rootView->frameView()->visibleContentRect()); | |
| 970 | |
| 971 if (unclippedIntAbsoluteRect) | |
|
tommycli
2015/11/03 20:10:22
nit: Seems like you're doing the enclosingIntRect
chrishtr
2015/11/03 21:24:56
Done.
| |
| 972 *unclippedIntAbsoluteRect = enclosingIntRect(unclippedAbsoluteRect); | |
| 973 } | |
| 974 | |
| 947 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) | 975 void WebPluginContainerImpl::calculateGeometry(IntRect& windowRect, IntRect& cli pRect, IntRect& unobscuredRect, Vector<IntRect>& cutOutRects) |
| 948 { | 976 { |
| 949 windowRect = toFrameView(parent())->contentsToRootFrame(frameRect()); | 977 windowRect = toFrameView(parent())->contentsToRootFrame(frameRect()); |
| 950 | 978 |
| 951 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 979 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. |
| 952 clipRect = convertToContainingWindow(IntRect(0, 0, width(), height())); | 980 clipRect = convertToContainingWindow(IntRect(0, 0, width(), height())); |
| 953 unobscuredRect = clipRect; | 981 unobscuredRect = clipRect; |
| 954 | 982 |
| 955 // document().layoutView() can be 0 when we receive messages from the | 983 // document().layoutView() can be 0 when we receive messages from the |
| 956 // plugins while we are destroying a frame. | 984 // plugins while we are destroying a frame. |
| 957 // FIXME: Can we just check m_element->document().isActive() ? | 985 // FIXME: Can we just check m_element->document().isActive() ? |
| 958 if (m_element->layoutObject()->document().layoutView()) { | 986 if (m_element->layoutObject()->document().layoutView()) { |
| 959 // Take our element and get the clip rect from the enclosing layer and | 987 // Take our element and get the clip rect from the enclosing layer and |
| 960 // frame view. | 988 // frame view. |
| 961 IntRect elementUnobscuredRect; | 989 IntRect unclippedAbsoluteRect; |
| 962 IntRect elementWindowClipRect = m_element->document().view()->clipRectsF orFrameOwner(m_element, &elementUnobscuredRect); | 990 IntRect clippedAbsoluteRect; |
| 963 clipRect.intersect(elementWindowClipRect); | 991 computeClipRectsForPlugin(m_element, clippedAbsoluteRect, &unclippedAbso luteRect); |
| 964 unobscuredRect.intersect(elementUnobscuredRect); | 992 clipRect.intersect(clippedAbsoluteRect); |
| 993 unobscuredRect.intersect(unclippedAbsoluteRect); | |
| 965 } | 994 } |
| 966 | 995 |
| 967 clipRect.move(-windowRect.x(), -windowRect.y()); | 996 clipRect.move(-windowRect.x(), -windowRect.y()); |
| 968 unobscuredRect.move(-windowRect.x(), -windowRect.y()); | 997 unobscuredRect.move(-windowRect.x(), -windowRect.y()); |
| 969 | 998 |
| 970 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); | 999 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); |
| 971 // Convert to the plugin position. | 1000 // Convert to the plugin position. |
| 972 for (size_t i = 0; i < cutOutRects.size(); i++) | 1001 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 973 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); | 1002 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); |
| 974 } | 1003 } |
| 975 | 1004 |
| 976 } // namespace blink | 1005 } // namespace blink |
| OLD | NEW |