| 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 "web/RemoteFrameClientImpl.h" | 5 #include "web/RemoteFrameClientImpl.h" |
| 6 | 6 |
| 7 #include "core/events/KeyboardEvent.h" | 7 #include "core/events/KeyboardEvent.h" |
| 8 #include "core/events/MouseEvent.h" | 8 #include "core/events/MouseEvent.h" |
| 9 #include "core/events/WheelEvent.h" | 9 #include "core/events/WheelEvent.h" |
| 10 #include "core/frame/RemoteFrame.h" | 10 #include "core/frame/RemoteFrame.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void RemoteFrameClientImpl::forwardPostMessage( | 128 void RemoteFrameClientImpl::forwardPostMessage( |
| 129 MessageEvent* event, | 129 MessageEvent* event, |
| 130 PassRefPtr<SecurityOrigin> target, | 130 PassRefPtr<SecurityOrigin> target, |
| 131 LocalFrame* sourceFrame) const { | 131 LocalFrame* sourceFrame) const { |
| 132 if (m_webFrame->client()) | 132 if (m_webFrame->client()) |
| 133 m_webFrame->client()->forwardPostMessage( | 133 m_webFrame->client()->forwardPostMessage( |
| 134 WebLocalFrameImpl::fromFrame(sourceFrame), m_webFrame, | 134 WebLocalFrameImpl::fromFrame(sourceFrame), m_webFrame, |
| 135 WebSecurityOrigin(std::move(target)), WebDOMMessageEvent(event)); | 135 WebSecurityOrigin(std::move(target)), WebDOMMessageEvent(event)); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // FIXME: Remove this code once we have input routing in the browser | |
| 139 // process. See http://crbug.com/339659. | |
| 140 void RemoteFrameClientImpl::forwardInputEvent(Event* event) { | |
| 141 // It is possible for a platform event to cause the remote iframe element | |
| 142 // to be hidden, which destroys the layout object (for instance, a mouse | |
| 143 // event that moves between elements will trigger a mouseout on the old | |
| 144 // element, which might hide the new element). In that case we do not | |
| 145 // forward. This is divergent behavior from local frames, where the | |
| 146 // content of the frame can receive events even after the frame is hidden. | |
| 147 // We might need to revisit this after browser hit testing is fully | |
| 148 // implemented, since this code path will need to be removed or refactored | |
| 149 // anyway. | |
| 150 // See https://crbug.com/520705. | |
| 151 if (m_webFrame->toImplBase()->frame()->ownerLayoutItem().isNull()) | |
| 152 return; | |
| 153 | |
| 154 // This is only called when we have out-of-process iframes, which | |
| 155 // need to forward input events across processes. | |
| 156 // FIXME: Add a check for out-of-process iframes enabled. | |
| 157 std::unique_ptr<WebInputEvent> webEvent; | |
| 158 if (event->isKeyboardEvent()) | |
| 159 webEvent = WTF::wrapUnique( | |
| 160 new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); | |
| 161 else if (event->isMouseEvent()) | |
| 162 webEvent = WTF::wrapUnique(new WebMouseEventBuilder( | |
| 163 m_webFrame->frame()->view(), | |
| 164 m_webFrame->toImplBase()->frame()->ownerLayoutItem(), | |
| 165 *static_cast<MouseEvent*>(event))); | |
| 166 | |
| 167 // Other or internal Blink events should not be forwarded. | |
| 168 if (!webEvent || webEvent->type() == WebInputEvent::Undefined) | |
| 169 return; | |
| 170 | |
| 171 m_webFrame->client()->forwardInputEvent(webEvent.get()); | |
| 172 } | |
| 173 | |
| 174 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) { | 138 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) { |
| 175 m_webFrame->client()->frameRectsChanged(frameRect); | 139 m_webFrame->client()->frameRectsChanged(frameRect); |
| 176 } | 140 } |
| 177 | 141 |
| 178 void RemoteFrameClientImpl::updateRemoteViewportIntersection( | 142 void RemoteFrameClientImpl::updateRemoteViewportIntersection( |
| 179 const IntRect& viewportIntersection) { | 143 const IntRect& viewportIntersection) { |
| 180 m_webFrame->client()->updateRemoteViewportIntersection(viewportIntersection); | 144 m_webFrame->client()->updateRemoteViewportIntersection(viewportIntersection); |
| 181 } | 145 } |
| 182 | 146 |
| 183 void RemoteFrameClientImpl::advanceFocus(WebFocusType type, | 147 void RemoteFrameClientImpl::advanceFocus(WebFocusType type, |
| 184 LocalFrame* source) { | 148 LocalFrame* source) { |
| 185 m_webFrame->client()->advanceFocus(type, | 149 m_webFrame->client()->advanceFocus(type, |
| 186 WebLocalFrameImpl::fromFrame(source)); | 150 WebLocalFrameImpl::fromFrame(source)); |
| 187 } | 151 } |
| 188 | 152 |
| 189 void RemoteFrameClientImpl::visibilityChanged(bool visible) { | 153 void RemoteFrameClientImpl::visibilityChanged(bool visible) { |
| 190 m_webFrame->client()->visibilityChanged(visible); | 154 m_webFrame->client()->visibilityChanged(visible); |
| 191 } | 155 } |
| 192 | 156 |
| 193 } // namespace blink | 157 } // namespace blink |
| OLD | NEW |