| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 233 } |
| 234 | 234 |
| 235 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { | 235 bool InspectorOverlay::handleInputEvent(const WebInputEvent& inputEvent) { |
| 236 bool handled = false; | 236 bool handled = false; |
| 237 | 237 |
| 238 if (isEmpty()) | 238 if (isEmpty()) |
| 239 return false; | 239 return false; |
| 240 | 240 |
| 241 if (WebInputEvent::isGestureEventType(inputEvent.type) && | 241 if (WebInputEvent::isGestureEventType(inputEvent.type) && |
| 242 inputEvent.type == WebInputEvent::GestureTap) { | 242 inputEvent.type == WebInputEvent::GestureTap) { |
| 243 // Only let GestureTab in (we only need it and we know PlatformGestureEventB
uilder supports it). | 243 // Only let GestureTab in (we only need it and we know |
| 244 // PlatformGestureEventBuilder supports it). |
| 244 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder( | 245 PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder( |
| 245 m_webViewImpl->mainFrameImpl()->frameView(), | 246 m_webViewImpl->mainFrameImpl()->frameView(), |
| 246 static_cast<const WebGestureEvent&>(inputEvent)); | 247 static_cast<const WebGestureEvent&>(inputEvent)); |
| 247 handled = handleGestureEvent(gestureEvent); | 248 handled = handleGestureEvent(gestureEvent); |
| 248 if (handled) | 249 if (handled) |
| 249 return true; | 250 return true; |
| 250 | 251 |
| 251 overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); | 252 overlayMainFrame()->eventHandler().handleGestureEvent(gestureEvent); |
| 252 } | 253 } |
| 253 if (WebInputEvent::isMouseEventType(inputEvent.type) && | 254 if (WebInputEvent::isMouseEventType(inputEvent.type) && |
| 254 inputEvent.type != WebInputEvent::MouseEnter) { | 255 inputEvent.type != WebInputEvent::MouseEnter) { |
| 255 // PlatformMouseEventBuilder does not work with MouseEnter type, so we filte
r it out manually. | 256 // PlatformMouseEventBuilder does not work with MouseEnter type, so we |
| 257 // filter it out manually. |
| 256 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( | 258 PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder( |
| 257 m_webViewImpl->mainFrameImpl()->frameView(), | 259 m_webViewImpl->mainFrameImpl()->frameView(), |
| 258 static_cast<const WebMouseEvent&>(inputEvent)); | 260 static_cast<const WebMouseEvent&>(inputEvent)); |
| 259 | 261 |
| 260 if (mouseEvent.type() == PlatformEvent::MouseMoved) | 262 if (mouseEvent.type() == PlatformEvent::MouseMoved) |
| 261 handled = handleMouseMove(mouseEvent); | 263 handled = handleMouseMove(mouseEvent); |
| 262 else if (mouseEvent.type() == PlatformEvent::MousePressed) | 264 else if (mouseEvent.type() == PlatformEvent::MousePressed) |
| 263 handled = handleMousePress(); | 265 handled = handleMousePress(); |
| 264 | 266 |
| 265 if (handled) | 267 if (handled) |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 m_webViewImpl->page()->deviceScaleFactor()); | 604 m_webViewImpl->page()->deviceScaleFactor()); |
| 603 resetData->setDouble("pageScaleFactor", | 605 resetData->setDouble("pageScaleFactor", |
| 604 m_webViewImpl->page()->pageScaleFactor()); | 606 m_webViewImpl->page()->pageScaleFactor()); |
| 605 | 607 |
| 606 IntRect viewportInScreen = m_webViewImpl->chromeClient().viewportToScreen( | 608 IntRect viewportInScreen = m_webViewImpl->chromeClient().viewportToScreen( |
| 607 IntRect(IntPoint(), viewportSize), | 609 IntRect(IntPoint(), viewportSize), |
| 608 m_webViewImpl->mainFrameImpl()->frame()->view()); | 610 m_webViewImpl->mainFrameImpl()->frame()->view()); |
| 609 resetData->setObject("viewportSize", | 611 resetData->setObject("viewportSize", |
| 610 buildObjectForSize(viewportInScreen.size())); | 612 buildObjectForSize(viewportInScreen.size())); |
| 611 | 613 |
| 612 // The zoom factor in the overlay frame already has been multiplied by the win
dow to viewport scale | 614 // The zoom factor in the overlay frame already has been multiplied by the |
| 613 // (aka device scale factor), so cancel it. | 615 // window to viewport scale (aka device scale factor), so cancel it. |
| 614 resetData->setDouble( | 616 resetData->setDouble( |
| 615 "pageZoomFactor", | 617 "pageZoomFactor", |
| 616 m_webViewImpl->mainFrameImpl()->frame()->pageZoomFactor() / | 618 m_webViewImpl->mainFrameImpl()->frame()->pageZoomFactor() / |
| 617 windowToViewportScale()); | 619 windowToViewportScale()); |
| 618 | 620 |
| 619 resetData->setInteger("scrollX", documentScrollOffset.x()); | 621 resetData->setInteger("scrollX", documentScrollOffset.x()); |
| 620 resetData->setInteger("scrollY", documentScrollOffset.y()); | 622 resetData->setInteger("scrollY", documentScrollOffset.y()); |
| 621 evaluateInOverlay("reset", std::move(resetData)); | 623 evaluateInOverlay("reset", std::move(resetData)); |
| 622 } | 624 } |
| 623 | 625 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 !node->isElementNode() || !node->ownerDocument()->isActive() || | 868 !node->isElementNode() || !node->ownerDocument()->isActive() || |
| 867 !m_cssAgent || !m_domAgent) | 869 !m_cssAgent || !m_domAgent) |
| 868 return; | 870 return; |
| 869 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgent, | 871 m_layoutEditor = LayoutEditor::create(toElement(node), m_cssAgent, m_domAgent, |
| 870 &overlayMainFrame()->script()); | 872 &overlayMainFrame()->script()); |
| 871 toChromeClientImpl(m_webViewImpl->page()->chromeClient()) | 873 toChromeClientImpl(m_webViewImpl->page()->chromeClient()) |
| 872 .setCursorOverridden(true); | 874 .setCursorOverridden(true); |
| 873 } | 875 } |
| 874 | 876 |
| 875 } // namespace blink | 877 } // namespace blink |
| OLD | NEW |