OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "web/RemoteFrameClientImpl.h" | 6 #include "web/RemoteFrameClientImpl.h" |
7 | 7 |
8 #include "core/events/KeyboardEvent.h" | 8 #include "core/events/KeyboardEvent.h" |
9 #include "core/events/MouseEvent.h" | 9 #include "core/events/MouseEvent.h" |
10 #include "core/events/WheelEvent.h" | 10 #include "core/events/WheelEvent.h" |
11 #include "core/frame/RemoteFrame.h" | 11 #include "core/frame/RemoteFrame.h" |
12 #include "core/frame/RemoteFrameView.h" | 12 #include "core/frame/RemoteFrameView.h" |
13 #include "core/layout/LayoutPart.h" | 13 #include "core/layout/LayoutPart.h" |
14 #include "platform/exported/WrappedResourceRequest.h" | 14 #include "platform/exported/WrappedResourceRequest.h" |
15 #include "platform/weborigin/SecurityOrigin.h" | 15 #include "platform/weborigin/SecurityOrigin.h" |
16 #include "platform/weborigin/SecurityPolicy.h" | 16 #include "platform/weborigin/SecurityPolicy.h" |
17 #include "public/web/WebRemoteFrameClient.h" | 17 #include "public/web/WebRemoteFrameClient.h" |
18 #include "web/WebInputEventConversion.h" | 18 #include "web/WebInputEventConversion.h" |
19 #include "web/WebLocalFrameImpl.h" | 19 #include "web/WebLocalFrameImpl.h" |
20 #include "web/WebRemoteFrameImpl.h" | 20 #include "web/WebRemoteFrameImpl.h" |
21 | 21 |
22 namespace blink { | 22 namespace blink { |
23 | 23 |
24 namespace { | |
25 | |
26 Frame* toCoreFrame(WebFrame* frame) | |
27 { | |
28 return frame ? frame->toImplBase()->frame() : nullptr; | |
29 } | |
30 | |
31 } // namespace | |
32 | |
24 RemoteFrameClientImpl::RemoteFrameClientImpl(WebRemoteFrameImpl* webFrame) | 33 RemoteFrameClientImpl::RemoteFrameClientImpl(WebRemoteFrameImpl* webFrame) |
25 : m_webFrame(webFrame) | 34 : m_webFrame(webFrame) |
26 { | 35 { |
27 } | 36 } |
28 | 37 |
29 PassOwnPtrWillBeRawPtr<RemoteFrameClientImpl> RemoteFrameClientImpl::create(WebR emoteFrameImpl* webFrame) | 38 PassOwnPtrWillBeRawPtr<RemoteFrameClientImpl> RemoteFrameClientImpl::create(WebR emoteFrameImpl* webFrame) |
30 { | 39 { |
31 return adoptPtrWillBeNoop(new RemoteFrameClientImpl(webFrame)); | 40 return adoptPtrWillBeNoop(new RemoteFrameClientImpl(webFrame)); |
32 } | 41 } |
33 | 42 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 // It is possible for a platform event to cause the remote iframe element | 149 // It is possible for a platform event to cause the remote iframe element |
141 // to be hidden, which destroys the layout object (for instance, a mouse | 150 // to be hidden, which destroys the layout object (for instance, a mouse |
142 // event that moves between elements will trigger a mouseout on the old | 151 // event that moves between elements will trigger a mouseout on the old |
143 // element, which might hide the new element). In that case we do not | 152 // element, which might hide the new element). In that case we do not |
144 // forward. This is divergent behavior from local frames, where the | 153 // forward. This is divergent behavior from local frames, where the |
145 // content of the frame can receive events even after the frame is hidden. | 154 // content of the frame can receive events even after the frame is hidden. |
146 // We might need to revisit this after browser hit testing is fully | 155 // We might need to revisit this after browser hit testing is fully |
147 // implemented, since this code path will need to be removed or refactored | 156 // implemented, since this code path will need to be removed or refactored |
148 // anyway. | 157 // anyway. |
149 // See https://crbug.com/520705. | 158 // See https://crbug.com/520705. |
150 if (!toCoreFrame(m_webFrame)->ownerLayoutObject()) | 159 if (!m_webFrame->toImplBase()->frame()->ownerLayoutObject()) |
dcheng
2015/11/23 09:00:17
Note that these changed, since this should never b
| |
151 return; | 160 return; |
152 | 161 |
153 // This is only called when we have out-of-process iframes, which | 162 // This is only called when we have out-of-process iframes, which |
154 // need to forward input events across processes. | 163 // need to forward input events across processes. |
155 // FIXME: Add a check for out-of-process iframes enabled. | 164 // FIXME: Add a check for out-of-process iframes enabled. |
156 OwnPtr<WebInputEvent> webEvent; | 165 OwnPtr<WebInputEvent> webEvent; |
157 if (event->isKeyboardEvent()) | 166 if (event->isKeyboardEvent()) |
158 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event))); | 167 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event))); |
159 else if (event->isMouseEvent()) | 168 else if (event->isMouseEvent()) |
160 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<MouseEvent*>(event) )); | 169 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , m_webFrame->toImplBase()->frame()->ownerLayoutObject(), *static_cast<MouseEven t*>(event))); |
161 else if (event->isWheelEvent()) | 170 else if (event->isWheelEvent()) |
162 webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->v iew(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<WheelEvent*>(e vent))); | 171 webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->v iew(), m_webFrame->toImplBase()->frame()->ownerLayoutObject(), *static_cast<Whee lEvent*>(event))); |
163 | 172 |
164 // Other or internal Blink events should not be forwarded. | 173 // Other or internal Blink events should not be forwarded. |
165 if (!webEvent || webEvent->type == WebInputEvent::Undefined) | 174 if (!webEvent || webEvent->type == WebInputEvent::Undefined) |
166 return; | 175 return; |
167 | 176 |
168 m_webFrame->client()->forwardInputEvent(webEvent.get()); | 177 m_webFrame->client()->forwardInputEvent(webEvent.get()); |
169 } | 178 } |
170 | 179 |
171 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) | 180 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) |
172 { | 181 { |
173 m_webFrame->client()->frameRectsChanged(frameRect); | 182 m_webFrame->client()->frameRectsChanged(frameRect); |
174 } | 183 } |
175 | 184 |
176 } // namespace blink | 185 } // namespace blink |
OLD | NEW |