Chromium Code Reviews| 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" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 // session history length. For now, return static value for the initial | 116 // session history length. For now, return static value for the initial |
| 117 // navigation and the subsequent one moving the frame out-of-process. | 117 // navigation and the subsequent one moving the frame out-of-process. |
| 118 // See https://crbug.com/501116. | 118 // See https://crbug.com/501116. |
| 119 return 2; | 119 return 2; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // FIXME: Remove this code once we have input routing in the browser | 122 // FIXME: Remove this code once we have input routing in the browser |
| 123 // process. See http://crbug.com/339659. | 123 // process. See http://crbug.com/339659. |
| 124 void RemoteFrameClientImpl::forwardInputEvent(Event* event) | 124 void RemoteFrameClientImpl::forwardInputEvent(Event* event) |
| 125 { | 125 { |
| 126 // It is possible for an event to cause the remote iframe element to be | |
|
dcheng
2015/08/19 16:28:10
an event => a platform event
kenrb
2015/08/19 20:34:11
Done.
| |
| 127 // hidden, which destroys the layout object (for instance, a MouseOver | |
|
dcheng
2015/08/19 16:28:10
for instance, a mouse event that moves between ele
kenrb
2015/08/19 20:34:11
Done.
| |
| 128 // event on the iframe can trigger a MouseOut handler on another element | |
| 129 // that hides the iframe). In that case we do not forward. | |
| 130 // This is divergent behavior from local frames, where the content of the | |
| 131 // frame can receive events even after the frame is hidden. We might | |
| 132 // need to revisit this after browser hit testing is fully implemented, | |
| 133 // since this code path will need to be removed or refactored anyway. | |
| 134 // See https://crbug.com/520705. | |
| 135 if (!toCoreFrame(m_webFrame)->ownerLayoutObject()) | |
| 136 return; | |
| 137 | |
| 126 // This is only called when we have out-of-process iframes, which | 138 // This is only called when we have out-of-process iframes, which |
| 127 // need to forward input events across processes. | 139 // need to forward input events across processes. |
| 128 // FIXME: Add a check for out-of-process iframes enabled. | 140 // FIXME: Add a check for out-of-process iframes enabled. |
| 129 OwnPtr<WebInputEvent> webEvent; | 141 OwnPtr<WebInputEvent> webEvent; |
| 130 if (event->isKeyboardEvent()) | 142 if (event->isKeyboardEvent()) |
| 131 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event))); | 143 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event))); |
| 132 else if (event->isMouseEvent()) | 144 else if (event->isMouseEvent()) |
| 133 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<MouseEvent*>(event) )); | 145 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<MouseEvent*>(event) )); |
| 134 else if (event->isWheelEvent()) | 146 else if (event->isWheelEvent()) |
| 135 webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->v iew(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<WheelEvent*>(e vent))); | 147 webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->v iew(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<WheelEvent*>(e vent))); |
| 136 | 148 |
| 137 // Other or internal Blink events should not be forwarded. | 149 // Other or internal Blink events should not be forwarded. |
| 138 if (!webEvent || webEvent->type == WebInputEvent::Undefined) | 150 if (!webEvent || webEvent->type == WebInputEvent::Undefined) |
| 139 return; | 151 return; |
| 140 | 152 |
| 141 m_webFrame->client()->forwardInputEvent(webEvent.get()); | 153 m_webFrame->client()->forwardInputEvent(webEvent.get()); |
| 142 } | 154 } |
| 143 | 155 |
| 144 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |