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 | |
| 127 // hidden, which destroys the layout object. In that case we do not | |
| 128 // forward. See https://crbug.com/520705. | |
|
dcheng
2015/08/18 17:44:19
I don't think I followed the explanation in the bu
kenrb
2015/08/19 15:53:51
Comment expanded.
| |
| 129 if (!toCoreFrame(m_webFrame)->ownerLayoutObject()) | |
| 130 return; | |
| 131 | |
| 126 // This is only called when we have out-of-process iframes, which | 132 // This is only called when we have out-of-process iframes, which |
| 127 // need to forward input events across processes. | 133 // need to forward input events across processes. |
| 128 // FIXME: Add a check for out-of-process iframes enabled. | 134 // FIXME: Add a check for out-of-process iframes enabled. |
| 129 OwnPtr<WebInputEvent> webEvent; | 135 OwnPtr<WebInputEvent> webEvent; |
| 130 if (event->isKeyboardEvent()) | 136 if (event->isKeyboardEvent()) |
| 131 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event))); | 137 webEvent = adoptPtr(new WebKeyboardEventBuilder(*static_cast<KeyboardEve nt*>(event))); |
| 132 else if (event->isMouseEvent()) | 138 else if (event->isMouseEvent()) |
| 133 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<MouseEvent*>(event) )); | 139 webEvent = adoptPtr(new WebMouseEventBuilder(m_webFrame->frame()->view() , toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<MouseEvent*>(event) )); |
| 134 else if (event->isWheelEvent()) | 140 else if (event->isWheelEvent()) |
| 135 webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->v iew(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<WheelEvent*>(e vent))); | 141 webEvent = adoptPtr(new WebMouseWheelEventBuilder(m_webFrame->frame()->v iew(), toCoreFrame(m_webFrame)->ownerLayoutObject(), *static_cast<WheelEvent*>(e vent))); |
| 136 | 142 |
| 137 // Other or internal Blink events should not be forwarded. | 143 // Other or internal Blink events should not be forwarded. |
| 138 if (!webEvent || webEvent->type == WebInputEvent::Undefined) | 144 if (!webEvent || webEvent->type == WebInputEvent::Undefined) |
| 139 return; | 145 return; |
| 140 | 146 |
| 141 m_webFrame->client()->forwardInputEvent(webEvent.get()); | 147 m_webFrame->client()->forwardInputEvent(webEvent.get()); |
| 142 } | 148 } |
| 143 | 149 |
| 144 } // namespace blink | 150 } // namespace blink |
| OLD | NEW |