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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 LayoutObjectDrawingRecorder drawingRecorder(context, *m_element->layoutObjec
t(), DisplayItem::Type::WebPlugin, rect); | 117 LayoutObjectDrawingRecorder drawingRecorder(context, *m_element->layoutObjec
t(), DisplayItem::Type::WebPlugin, rect); |
118 if (drawingRecorder.canUseCachedDrawing()) | 118 if (drawingRecorder.canUseCachedDrawing()) |
119 return; | 119 return; |
120 | 120 |
121 context->save(); | 121 context->save(); |
122 | 122 |
123 ASSERT(parent()->isFrameView()); | 123 ASSERT(parent()->isFrameView()); |
124 FrameView* view = toFrameView(parent()); | 124 FrameView* view = toFrameView(parent()); |
125 | 125 |
126 // The plugin is positioned in window coordinates, so it needs to be painted | 126 // The plugin is positioned in the root frame's coordinates, so it needs to |
127 // in window coordinates. | 127 // be painted in them too. |
128 IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); | 128 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); |
129 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig
in.y())); | 129 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig
in.y())); |
130 | 130 |
131 WebCanvas* canvas = context->canvas(); | 131 WebCanvas* canvas = context->canvas(); |
132 | 132 |
133 IntRect windowRect = view->contentsToWindow(rect); | 133 IntRect windowRect = view->contentsToRootFrame(rect); |
134 m_webPlugin->paint(canvas, windowRect); | 134 m_webPlugin->paint(canvas, windowRect); |
135 | 135 |
136 context->restore(); | 136 context->restore(); |
137 } | 137 } |
138 | 138 |
139 void WebPluginContainerImpl::invalidateRect(const IntRect& rect) | 139 void WebPluginContainerImpl::invalidateRect(const IntRect& rect) |
140 { | 140 { |
141 if (!parent()) | 141 if (!parent()) |
142 return; | 142 return; |
143 | 143 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 return; | 544 return; |
545 m_wantsWheelEvents = wantsWheelEvents; | 545 m_wantsWheelEvents = wantsWheelEvents; |
546 if (Page* page = m_element->document().page()) { | 546 if (Page* page = m_element->document().page()) { |
547 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { | 547 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { |
548 if (parent() && parent()->isFrameView()) | 548 if (parent() && parent()->isFrameView()) |
549 scrollingCoordinator->notifyLayoutUpdated(); | 549 scrollingCoordinator->notifyLayoutUpdated(); |
550 } | 550 } |
551 } | 551 } |
552 } | 552 } |
553 | 553 |
554 WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) | 554 WebPoint WebPluginContainerImpl::rootFrameToLocalPoint(const WebPoint& pointInRo
otFrame) |
555 { | 555 { |
556 FrameView* view = toFrameView(parent()); | 556 FrameView* view = toFrameView(parent()); |
557 if (!view) | 557 if (!view) |
558 return point; | 558 return pointInRootFrame; |
559 WebPoint windowPoint = view->windowToContents(point); | 559 WebPoint pointInContent = view->rootFrameToContents(pointInRootFrame); |
560 return roundedIntPoint(m_element->layoutObject()->absoluteToLocal(FloatPoint
(windowPoint), UseTransforms)); | 560 return roundedIntPoint(m_element->layoutObject()->absoluteToLocal(FloatPoint
(pointInContent), UseTransforms)); |
561 } | 561 } |
562 | 562 |
563 WebPoint WebPluginContainerImpl::localToWindowPoint(const WebPoint& point) | 563 WebPoint WebPluginContainerImpl::localToRootFramePoint(const WebPoint& pointInLo
cal) |
564 { | 564 { |
565 FrameView* view = toFrameView(parent()); | 565 FrameView* view = toFrameView(parent()); |
566 if (!view) | 566 if (!view) |
567 return point; | 567 return pointInLocal; |
568 IntPoint absolutePoint = roundedIntPoint(m_element->layoutObject()->localToA
bsolute(FloatPoint(point), UseTransforms)); | 568 IntPoint absolutePoint = roundedIntPoint(m_element->layoutObject()->localToA
bsolute(FloatPoint(pointInLocal), UseTransforms)); |
569 return view->contentsToWindow(absolutePoint); | 569 return view->contentsToRootFrame(absolutePoint); |
570 } | 570 } |
571 | 571 |
572 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) | 572 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) |
573 { | 573 { |
574 // Make sure that the plugin receives window geometry before data, or else | 574 // Make sure that the plugin receives window geometry before data, or else |
575 // plugins misbehave. | 575 // plugins misbehave. |
576 frameRectsChanged(); | 576 frameRectsChanged(); |
577 | 577 |
578 WrappedResourceResponse urlResponse(response); | 578 WrappedResourceResponse urlResponse(response); |
579 m_webPlugin->didReceiveResponse(urlResponse); | 579 m_webPlugin->didReceiveResponse(urlResponse); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); | 963 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); |
964 else | 964 else |
965 containingFrame.document()->setFocusedElement(m_element); | 965 containingFrame.document()->setFocusedElement(m_element); |
966 } | 966 } |
967 | 967 |
968 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, | 968 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, |
969 IntRect& windowRect, | 969 IntRect& windowRect, |
970 IntRect& clipRect, | 970 IntRect& clipRect, |
971 Vector<IntRect>& cutOutRects) | 971 Vector<IntRect>& cutOutRects) |
972 { | 972 { |
973 windowRect = toFrameView(parent())->contentsToWindow(frameRect); | 973 windowRect = toFrameView(parent())->contentsToRootFrame(frameRect); |
974 | 974 |
975 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 975 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. |
976 clipRect = windowClipRect(); | 976 clipRect = windowClipRect(); |
977 clipRect.move(-windowRect.x(), -windowRect.y()); | 977 clipRect.move(-windowRect.x(), -windowRect.y()); |
978 | 978 |
979 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | 979 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); |
980 // Convert to the plugin position. | 980 // Convert to the plugin position. |
981 for (size_t i = 0; i < cutOutRects.size(); i++) | 981 for (size_t i = 0; i < cutOutRects.size(); i++) |
982 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | 982 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); |
983 } | 983 } |
(...skipping 16 matching lines...) Expand all Loading... |
1000 | 1000 |
1001 return clipRect; | 1001 return clipRect; |
1002 } | 1002 } |
1003 | 1003 |
1004 bool WebPluginContainerImpl::pluginShouldPersist() const | 1004 bool WebPluginContainerImpl::pluginShouldPersist() const |
1005 { | 1005 { |
1006 return m_webPlugin->shouldPersist(); | 1006 return m_webPlugin->shouldPersist(); |
1007 } | 1007 } |
1008 | 1008 |
1009 } // namespace blink | 1009 } // namespace blink |
OLD | NEW |