| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // Don't paint anything if the plugin doesn't intersect the damage rect. | 112 // Don't paint anything if the plugin doesn't intersect the damage rect. |
| 113 if (!frameRect().intersects(damageRect)) | 113 if (!frameRect().intersects(damageRect)) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 gc->save(); | 116 gc->save(); |
| 117 | 117 |
| 118 ASSERT(parent()->isFrameView()); | 118 ASSERT(parent()->isFrameView()); |
| 119 FrameView* view = toFrameView(parent()); | 119 FrameView* view = toFrameView(parent()); |
| 120 | 120 |
| 121 // The plugin is positioned in window coordinates, so it needs to be painted | 121 // The plugin is positioned in the root frame's coordinates, so it needs to |
| 122 // in window coordinates. | 122 // be painted in them too. |
| 123 IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); | 123 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); |
| 124 gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-origin.y(
))); | 124 gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-origin.y(
))); |
| 125 | 125 |
| 126 WebCanvas* canvas = gc->canvas(); | 126 WebCanvas* canvas = gc->canvas(); |
| 127 | 127 |
| 128 IntRect windowRect = view->contentsToWindow(damageRect); | 128 IntRect windowRect = view->contentsToRootFrame(damageRect); |
| 129 m_webPlugin->paint(canvas, windowRect); | 129 m_webPlugin->paint(canvas, windowRect); |
| 130 | 130 |
| 131 gc->restore(); | 131 gc->restore(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void WebPluginContainerImpl::invalidateRect(const IntRect& rect) | 134 void WebPluginContainerImpl::invalidateRect(const IntRect& rect) |
| 135 { | 135 { |
| 136 if (!parent()) | 136 if (!parent()) |
| 137 return; | 137 return; |
| 138 | 138 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 return; | 539 return; |
| 540 m_wantsWheelEvents = wantsWheelEvents; | 540 m_wantsWheelEvents = wantsWheelEvents; |
| 541 if (Page* page = m_element->document().page()) { | 541 if (Page* page = m_element->document().page()) { |
| 542 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { | 542 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { |
| 543 if (parent() && parent()->isFrameView()) | 543 if (parent() && parent()->isFrameView()) |
| 544 scrollingCoordinator->notifyLayoutUpdated(); | 544 scrollingCoordinator->notifyLayoutUpdated(); |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 } | 547 } |
| 548 | 548 |
| 549 WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) | 549 WebPoint WebPluginContainerImpl::rootFrameToLocalPoint(const WebPoint& pointInRo
otFrame) |
| 550 { | 550 { |
| 551 FrameView* view = toFrameView(parent()); | 551 FrameView* view = toFrameView(parent()); |
| 552 if (!view) | 552 if (!view) |
| 553 return point; | 553 return pointInRootFrame; |
| 554 WebPoint windowPoint = view->windowToContents(point); | 554 WebPoint pointInContent = view->rootFrameToContents(pointInRootFrame); |
| 555 return roundedIntPoint(m_element->renderer()->absoluteToLocal(FloatPoint(win
dowPoint), UseTransforms)); | 555 return roundedIntPoint(m_element->renderer()->absoluteToLocal(FloatPoint(poi
ntInContent), UseTransforms)); |
| 556 } | 556 } |
| 557 | 557 |
| 558 WebPoint WebPluginContainerImpl::localToWindowPoint(const WebPoint& point) | 558 WebPoint WebPluginContainerImpl::localToRootFramePoint(const WebPoint& pointInLo
cal) |
| 559 { | 559 { |
| 560 FrameView* view = toFrameView(parent()); | 560 FrameView* view = toFrameView(parent()); |
| 561 if (!view) | 561 if (!view) |
| 562 return point; | 562 return pointInLocal; |
| 563 IntPoint absolutePoint = roundedIntPoint(m_element->renderer()->localToAbsol
ute(FloatPoint(point), UseTransforms)); | 563 IntPoint absolutePoint = roundedIntPoint(m_element->renderer()->localToAbsol
ute(FloatPoint(pointInLocal), UseTransforms)); |
| 564 return view->contentsToWindow(absolutePoint); | 564 return view->contentsToRootFrame(absolutePoint); |
| 565 } | 565 } |
| 566 | 566 |
| 567 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) | 567 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) |
| 568 { | 568 { |
| 569 // Make sure that the plugin receives window geometry before data, or else | 569 // Make sure that the plugin receives window geometry before data, or else |
| 570 // plugins misbehave. | 570 // plugins misbehave. |
| 571 frameRectsChanged(); | 571 frameRectsChanged(); |
| 572 | 572 |
| 573 WrappedResourceResponse urlResponse(response); | 573 WrappedResourceResponse urlResponse(response); |
| 574 m_webPlugin->didReceiveResponse(urlResponse); | 574 m_webPlugin->didReceiveResponse(urlResponse); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); | 958 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); |
| 959 else | 959 else |
| 960 containingFrame.document()->setFocusedElement(m_element); | 960 containingFrame.document()->setFocusedElement(m_element); |
| 961 } | 961 } |
| 962 | 962 |
| 963 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, | 963 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, |
| 964 IntRect& windowRect, | 964 IntRect& windowRect, |
| 965 IntRect& clipRect, | 965 IntRect& clipRect, |
| 966 Vector<IntRect>& cutOutRects) | 966 Vector<IntRect>& cutOutRects) |
| 967 { | 967 { |
| 968 windowRect = toFrameView(parent())->contentsToWindow(frameRect); | 968 windowRect = toFrameView(parent())->contentsToRootFrame(frameRect); |
| 969 | 969 |
| 970 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 970 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. |
| 971 clipRect = windowClipRect(); | 971 clipRect = windowClipRect(); |
| 972 clipRect.move(-windowRect.x(), -windowRect.y()); | 972 clipRect.move(-windowRect.x(), -windowRect.y()); |
| 973 | 973 |
| 974 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | 974 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); |
| 975 // Convert to the plugin position. | 975 // Convert to the plugin position. |
| 976 for (size_t i = 0; i < cutOutRects.size(); i++) | 976 for (size_t i = 0; i < cutOutRects.size(); i++) |
| 977 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | 977 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); |
| 978 } | 978 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 995 | 995 |
| 996 return clipRect; | 996 return clipRect; |
| 997 } | 997 } |
| 998 | 998 |
| 999 bool WebPluginContainerImpl::pluginShouldPersist() const | 999 bool WebPluginContainerImpl::pluginShouldPersist() const |
| 1000 { | 1000 { |
| 1001 return m_webPlugin->shouldPersist(); | 1001 return m_webPlugin->shouldPersist(); |
| 1002 } | 1002 } |
| 1003 | 1003 |
| 1004 } // namespace blink | 1004 } // namespace blink |
| OLD | NEW |