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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 #include "core/rendering/RenderLayer.h" | 61 #include "core/rendering/RenderLayer.h" |
62 #include "core/rendering/RenderPart.h" | 62 #include "core/rendering/RenderPart.h" |
63 #include "platform/HostWindow.h" | 63 #include "platform/HostWindow.h" |
64 #include "platform/KeyboardCodes.h" | 64 #include "platform/KeyboardCodes.h" |
65 #include "platform/PlatformGestureEvent.h" | 65 #include "platform/PlatformGestureEvent.h" |
66 #include "platform/UserGestureIndicator.h" | 66 #include "platform/UserGestureIndicator.h" |
67 #include "platform/exported/WrappedResourceResponse.h" | 67 #include "platform/exported/WrappedResourceResponse.h" |
68 #include "platform/graphics/GraphicsContext.h" | 68 #include "platform/graphics/GraphicsContext.h" |
69 #include "platform/graphics/GraphicsLayer.h" | 69 #include "platform/graphics/GraphicsLayer.h" |
70 #include "platform/scroll/ScrollAnimator.h" | 70 #include "platform/scroll/ScrollAnimator.h" |
71 #include "platform/scroll/ScrollView.h" | |
72 #include "platform/scroll/ScrollbarTheme.h" | 71 #include "platform/scroll/ScrollbarTheme.h" |
73 #include "public/platform/Platform.h" | 72 #include "public/platform/Platform.h" |
74 #include "public/platform/WebClipboard.h" | 73 #include "public/platform/WebClipboard.h" |
75 #include "public/platform/WebCompositorSupport.h" | 74 #include "public/platform/WebCompositorSupport.h" |
76 #include "public/platform/WebCursorInfo.h" | 75 #include "public/platform/WebCursorInfo.h" |
77 #include "public/platform/WebDragData.h" | 76 #include "public/platform/WebDragData.h" |
78 #include "public/platform/WebExternalTextureLayer.h" | 77 #include "public/platform/WebExternalTextureLayer.h" |
79 #include "public/platform/WebRect.h" | 78 #include "public/platform/WebRect.h" |
80 #include "public/platform/WebString.h" | 79 #include "public/platform/WebString.h" |
81 #include "public/platform/WebURL.h" | 80 #include "public/platform/WebURL.h" |
(...skipping 27 matching lines...) Expand all Loading... |
109 if (!parent()) | 108 if (!parent()) |
110 return; | 109 return; |
111 | 110 |
112 // Don't paint anything if the plugin doesn't intersect the damage rect. | 111 // Don't paint anything if the plugin doesn't intersect the damage rect. |
113 if (!frameRect().intersects(damageRect)) | 112 if (!frameRect().intersects(damageRect)) |
114 return; | 113 return; |
115 | 114 |
116 gc->save(); | 115 gc->save(); |
117 | 116 |
118 ASSERT(parent()->isFrameView()); | 117 ASSERT(parent()->isFrameView()); |
119 ScrollView* view = toScrollView(parent()); | 118 FrameView* view = toFrameView(parent()); |
120 | 119 |
121 // The plugin is positioned in window coordinates, so it needs to be painted | 120 // The plugin is positioned in window coordinates, so it needs to be painted |
122 // in window coordinates. | 121 // in window coordinates. |
123 IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); | 122 IntPoint origin = view->contentsToWindow(IntPoint(0, 0)); |
124 gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-origin.y(
))); | 123 gc->translate(static_cast<float>(-origin.x()), static_cast<float>(-origin.y(
))); |
125 | 124 |
126 WebCanvas* canvas = gc->canvas(); | 125 WebCanvas* canvas = gc->canvas(); |
127 | 126 |
128 IntRect windowRect = view->contentsToWindow(damageRect); | 127 IntRect windowRect = view->contentsToWindow(damageRect); |
129 m_webPlugin->paint(canvas, windowRect); | 128 m_webPlugin->paint(canvas, windowRect); |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 if (Page* page = m_element->document().page()) { | 535 if (Page* page = m_element->document().page()) { |
537 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { | 536 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina
tor()) { |
538 if (parent() && parent()->isFrameView()) | 537 if (parent() && parent()->isFrameView()) |
539 scrollingCoordinator->notifyLayoutUpdated(); | 538 scrollingCoordinator->notifyLayoutUpdated(); |
540 } | 539 } |
541 } | 540 } |
542 } | 541 } |
543 | 542 |
544 WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) | 543 WebPoint WebPluginContainerImpl::windowToLocalPoint(const WebPoint& point) |
545 { | 544 { |
546 ScrollView* view = toScrollView(parent()); | 545 FrameView* view = toFrameView(parent()); |
547 if (!view) | 546 if (!view) |
548 return point; | 547 return point; |
549 WebPoint windowPoint = view->windowToContents(point); | 548 WebPoint windowPoint = view->windowToContents(point); |
550 return roundedIntPoint(m_element->renderer()->absoluteToLocal(LayoutPoint(wi
ndowPoint), UseTransforms)); | 549 return roundedIntPoint(m_element->renderer()->absoluteToLocal(LayoutPoint(wi
ndowPoint), UseTransforms)); |
551 } | 550 } |
552 | 551 |
553 WebPoint WebPluginContainerImpl::localToWindowPoint(const WebPoint& point) | 552 WebPoint WebPluginContainerImpl::localToWindowPoint(const WebPoint& point) |
554 { | 553 { |
555 ScrollView* view = toScrollView(parent()); | 554 FrameView* view = toFrameView(parent()); |
556 if (!view) | 555 if (!view) |
557 return point; | 556 return point; |
558 IntPoint absolutePoint = roundedIntPoint(m_element->renderer()->localToAbsol
ute(LayoutPoint(point), UseTransforms)); | 557 IntPoint absolutePoint = roundedIntPoint(m_element->renderer()->localToAbsol
ute(LayoutPoint(point), UseTransforms)); |
559 return view->contentsToWindow(absolutePoint); | 558 return view->contentsToWindow(absolutePoint); |
560 } | 559 } |
561 | 560 |
562 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) | 561 void WebPluginContainerImpl::didReceiveResponse(const ResourceResponse& response
) |
563 { | 562 { |
564 // Make sure that the plugin receives window geometry before data, or else | 563 // Make sure that the plugin receives window geometry before data, or else |
565 // plugins misbehave. | 564 // plugins misbehave. |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
925 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); | 924 currentPage->focusController().setFocusedElement(m_element, &containingF
rame); |
926 else | 925 else |
927 containingFrame.document()->setFocusedElement(m_element); | 926 containingFrame.document()->setFocusedElement(m_element); |
928 } | 927 } |
929 | 928 |
930 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, | 929 void WebPluginContainerImpl::calculateGeometry(const IntRect& frameRect, |
931 IntRect& windowRect, | 930 IntRect& windowRect, |
932 IntRect& clipRect, | 931 IntRect& clipRect, |
933 Vector<IntRect>& cutOutRects) | 932 Vector<IntRect>& cutOutRects) |
934 { | 933 { |
935 windowRect = toScrollView(parent())->contentsToWindow(frameRect); | 934 windowRect = toFrameView(parent())->contentsToWindow(frameRect); |
936 | 935 |
937 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. | 936 // Calculate a clip-rect so that we don't overlap the scrollbars, etc. |
938 clipRect = windowClipRect(); | 937 clipRect = windowClipRect(); |
939 clipRect.move(-windowRect.x(), -windowRect.y()); | 938 clipRect.move(-windowRect.x(), -windowRect.y()); |
940 | 939 |
941 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); | 940 getPluginOcclusions(m_element, this->parent(), frameRect, cutOutRects); |
942 // Convert to the plugin position. | 941 // Convert to the plugin position. |
943 for (size_t i = 0; i < cutOutRects.size(); i++) | 942 for (size_t i = 0; i < cutOutRects.size(); i++) |
944 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); | 943 cutOutRects[i].move(-frameRect.x(), -frameRect.y()); |
945 } | 944 } |
(...skipping 16 matching lines...) Expand all Loading... |
962 | 961 |
963 return clipRect; | 962 return clipRect; |
964 } | 963 } |
965 | 964 |
966 bool WebPluginContainerImpl::pluginShouldPersist() const | 965 bool WebPluginContainerImpl::pluginShouldPersist() const |
967 { | 966 { |
968 return m_webPlugin->shouldPersist(); | 967 return m_webPlugin->shouldPersist(); |
969 } | 968 } |
970 | 969 |
971 } // namespace blink | 970 } // namespace blink |
OLD | NEW |