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 "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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 148 // implemented, since this code path will need to be removed or refactored | 148 // implemented, since this code path will need to be removed or refactored |
| 149 // anyway. | 149 // anyway. |
| 150 // See https://crbug.com/520705. | 150 // See https://crbug.com/520705. |
| 151 if (m_webFrame->toImplBase()->frame()->ownerLayoutItem().isNull()) | 151 if (m_webFrame->toImplBase()->frame()->ownerLayoutItem().isNull()) |
| 152 return; | 152 return; |
| 153 | 153 |
| 154 // This is only called when we have out-of-process iframes, which | 154 // This is only called when we have out-of-process iframes, which |
| 155 // need to forward input events across processes. | 155 // need to forward input events across processes. |
| 156 // FIXME: Add a check for out-of-process iframes enabled. | 156 // FIXME: Add a check for out-of-process iframes enabled. |
| 157 std::unique_ptr<WebInputEvent> webEvent; | 157 std::unique_ptr<WebInputEvent> webEvent; |
| 158 if (event->isKeyboardEvent()) | 158 if (event->isKeyboardEvent()) { |
| 159 webEvent = WTF::wrapUnique( | 159 webEvent = WTF::wrapUnique( |
| 160 new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); | 160 new WebKeyboardEventBuilder(*static_cast<KeyboardEvent*>(event))); |
| 161 else if (event->isMouseEvent()) | 161 } else if (event->isMouseEvent()) { |
| 162 webEvent = WTF::wrapUnique(new WebMouseEventBuilder( | 162 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); |
| 163 m_webFrame->frame()->view(), | 163 if (mouseEvent->nativeEvent()) { |
|
bokan
2017/01/27 16:57:17
So we'll only forward non-synthetic events to remo
dtapuska
2017/01/27 21:00:00
Reverted back to original code.
| |
| 164 m_webFrame->toImplBase()->frame()->ownerLayoutItem(), | 164 WebMouseEvent transformedEvent = |
| 165 *static_cast<MouseEvent*>(event))); | 165 mouseEvent->nativeEvent()->flattenTransform(); |
| 166 WebFloatPoint absoluteRootFrameLocation = | |
|
bokan
2017/01/27 16:57:17
You can just replace this with transformedEvent.po
dtapuska
2017/01/27 21:00:00
Removed.
| |
| 167 mouseEvent->nativeEvent()->positionInRootFrame(); | |
| 168 IntPoint localPoint = roundedIntPoint( | |
| 169 m_webFrame->toImplBase()->frame()->ownerLayoutItem().absoluteToLocal( | |
| 170 absoluteRootFrameLocation, UseTransforms)); | |
| 171 transformedEvent.x = localPoint.x(); | |
| 172 transformedEvent.y = localPoint.y(); | |
| 173 | |
| 174 webEvent = WTF::wrapUnique(new WebMouseEvent()); | |
| 175 *webEvent = transformedEvent; | |
| 176 } | |
| 177 } | |
| 166 | 178 |
| 167 // Other or internal Blink events should not be forwarded. | 179 // Other or internal Blink events should not be forwarded. |
| 168 if (!webEvent || webEvent->type() == WebInputEvent::Undefined) | 180 if (!webEvent || webEvent->type() == WebInputEvent::Undefined) |
| 169 return; | 181 return; |
| 170 | 182 |
| 171 m_webFrame->client()->forwardInputEvent(webEvent.get()); | 183 m_webFrame->client()->forwardInputEvent(webEvent.get()); |
| 172 } | 184 } |
| 173 | 185 |
| 174 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) { | 186 void RemoteFrameClientImpl::frameRectsChanged(const IntRect& frameRect) { |
| 175 m_webFrame->client()->frameRectsChanged(frameRect); | 187 m_webFrame->client()->frameRectsChanged(frameRect); |
| 176 } | 188 } |
| 177 | 189 |
| 178 void RemoteFrameClientImpl::updateRemoteViewportIntersection( | 190 void RemoteFrameClientImpl::updateRemoteViewportIntersection( |
| 179 const IntRect& viewportIntersection) { | 191 const IntRect& viewportIntersection) { |
| 180 m_webFrame->client()->updateRemoteViewportIntersection(viewportIntersection); | 192 m_webFrame->client()->updateRemoteViewportIntersection(viewportIntersection); |
| 181 } | 193 } |
| 182 | 194 |
| 183 void RemoteFrameClientImpl::advanceFocus(WebFocusType type, | 195 void RemoteFrameClientImpl::advanceFocus(WebFocusType type, |
| 184 LocalFrame* source) { | 196 LocalFrame* source) { |
| 185 m_webFrame->client()->advanceFocus(type, | 197 m_webFrame->client()->advanceFocus(type, |
| 186 WebLocalFrameImpl::fromFrame(source)); | 198 WebLocalFrameImpl::fromFrame(source)); |
| 187 } | 199 } |
| 188 | 200 |
| 189 void RemoteFrameClientImpl::visibilityChanged(bool visible) { | 201 void RemoteFrameClientImpl::visibilityChanged(bool visible) { |
| 190 m_webFrame->client()->visibilityChanged(visible); | 202 m_webFrame->client()->visibilityChanged(visible); |
| 191 } | 203 } |
| 192 | 204 |
| 193 } // namespace blink | 205 } // namespace blink |
| OLD | NEW |