| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2010-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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #include "public/web/WebSettings.h" | 67 #include "public/web/WebSettings.h" |
| 68 #include "public/web/WebViewClient.h" | 68 #include "public/web/WebViewClient.h" |
| 69 #include "web/WebInputEventConversion.h" | 69 #include "web/WebInputEventConversion.h" |
| 70 #include "web/WebLocalFrameImpl.h" | 70 #include "web/WebLocalFrameImpl.h" |
| 71 #include "web/WebViewImpl.h" | 71 #include "web/WebViewImpl.h" |
| 72 #include "wtf/CurrentTime.h" | 72 #include "wtf/CurrentTime.h" |
| 73 #include "wtf/MathExtras.h" | 73 #include "wtf/MathExtras.h" |
| 74 #include "wtf/Noncopyable.h" | 74 #include "wtf/Noncopyable.h" |
| 75 #include "wtf/text/WTFString.h" | 75 #include "wtf/text/WTFString.h" |
| 76 | 76 |
| 77 using namespace WebCore; | 77 using namespace blink; |
| 78 | 78 |
| 79 namespace OverlayZOrders { | 79 namespace OverlayZOrders { |
| 80 // Use 99 as a big z-order number so that highlight is above other overlays. | 80 // Use 99 as a big z-order number so that highlight is above other overlays. |
| 81 static const int highlight = 99; | 81 static const int highlight = 99; |
| 82 } | 82 } |
| 83 | 83 |
| 84 namespace blink { | 84 namespace blink { |
| 85 | 85 |
| 86 class ClientMessageLoopAdapter : public PageScriptDebugServer::ClientMessageLoop
{ | 86 class ClientMessageLoopAdapter : public PageScriptDebugServer::ClientMessageLoop
{ |
| 87 public: | 87 public: |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 288 |
| 289 void WebDevToolsAgentImpl::didComposite() | 289 void WebDevToolsAgentImpl::didComposite() |
| 290 { | 290 { |
| 291 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "CompositeL
ayers"); | 291 TRACE_EVENT_END0(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "CompositeL
ayers"); |
| 292 if (InspectorController* ic = inspectorController()) | 292 if (InspectorController* ic = inspectorController()) |
| 293 ic->didComposite(); | 293 ic->didComposite(); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void WebDevToolsAgentImpl::didCreateScriptContext(WebLocalFrameImpl* webframe, i
nt worldId) | 296 void WebDevToolsAgentImpl::didCreateScriptContext(WebLocalFrameImpl* webframe, i
nt worldId) |
| 297 { | 297 { |
| 298 if (WebCore::LocalFrame* frame = webframe->frame()) | 298 if (blink::LocalFrame* frame = webframe->frame()) |
| 299 frame->script().setWorldDebugId(worldId, m_debuggerId); | 299 frame->script().setWorldDebugId(worldId, m_debuggerId); |
| 300 // Skip non main world contexts. | 300 // Skip non main world contexts. |
| 301 if (worldId) | 301 if (worldId) |
| 302 return; | 302 return; |
| 303 m_webViewDidLayoutOnceAfterLoad = false; | 303 m_webViewDidLayoutOnceAfterLoad = false; |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool WebDevToolsAgentImpl::handleInputEvent(WebCore::Page* page, const WebInputE
vent& inputEvent) | 306 bool WebDevToolsAgentImpl::handleInputEvent(blink::Page* page, const WebInputEve
nt& inputEvent) |
| 307 { | 307 { |
| 308 if (!m_attached && !m_generatingEvent) | 308 if (!m_attached && !m_generatingEvent) |
| 309 return false; | 309 return false; |
| 310 | 310 |
| 311 // FIXME: This workaround is required for touch emulation on Mac, where | 311 // FIXME: This workaround is required for touch emulation on Mac, where |
| 312 // compositor-side pinch handling is not enabled. See http://crbug.com/13800
3. | 312 // compositor-side pinch handling is not enabled. See http://crbug.com/13800
3. |
| 313 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || inputE
vent.type == WebInputEvent::GesturePinchUpdate || inputEvent.type == WebInputEve
nt::GesturePinchEnd; | 313 bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin || inputE
vent.type == WebInputEvent::GesturePinchUpdate || inputEvent.type == WebInputEve
nt::GesturePinchEnd; |
| 314 if (isPinch && m_touchEventEmulationEnabled && m_emulateMobileEnabled) { | 314 if (isPinch && m_touchEventEmulationEnabled && m_emulateMobileEnabled) { |
| 315 FrameView* frameView = page->deprecatedLocalMainFrame()->view(); | 315 FrameView* frameView = page->deprecatedLocalMainFrame()->view(); |
| 316 PlatformGestureEventBuilder gestureEvent(frameView, static_cast<const We
bGestureEvent&>(inputEvent)); | 316 PlatformGestureEventBuilder gestureEvent(frameView, static_cast<const We
bGestureEvent&>(inputEvent)); |
| 317 float pageScaleFactor = page->pageScaleFactor(); | 317 float pageScaleFactor = page->pageScaleFactor(); |
| 318 if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { | 318 if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) { |
| 319 m_lastPinchAnchorCss = adoptPtr(new WebCore::IntPoint(frameView->scr
ollPosition() + gestureEvent.position())); | 319 m_lastPinchAnchorCss = adoptPtr(new blink::IntPoint(frameView->scrol
lPosition() + gestureEvent.position())); |
| 320 m_lastPinchAnchorDip = adoptPtr(new WebCore::IntPoint(gestureEvent.p
osition())); | 320 m_lastPinchAnchorDip = adoptPtr(new blink::IntPoint(gestureEvent.pos
ition())); |
| 321 m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor); | 321 m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor); |
| 322 } | 322 } |
| 323 if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && m_lastPi
nchAnchorCss) { | 323 if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate && m_lastPi
nchAnchorCss) { |
| 324 float newPageScaleFactor = pageScaleFactor * gestureEvent.scale(); | 324 float newPageScaleFactor = pageScaleFactor * gestureEvent.scale(); |
| 325 WebCore::IntPoint anchorCss(*m_lastPinchAnchorDip.get()); | 325 blink::IntPoint anchorCss(*m_lastPinchAnchorDip.get()); |
| 326 anchorCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor); | 326 anchorCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor); |
| 327 m_webViewImpl->setPageScaleFactor(newPageScaleFactor); | 327 m_webViewImpl->setPageScaleFactor(newPageScaleFactor); |
| 328 m_webViewImpl->setMainFrameScrollOffset(*m_lastPinchAnchorCss.get()
- toIntSize(anchorCss)); | 328 m_webViewImpl->setMainFrameScrollOffset(*m_lastPinchAnchorCss.get()
- toIntSize(anchorCss)); |
| 329 } | 329 } |
| 330 if (gestureEvent.type() == PlatformEvent::GesturePinchEnd) { | 330 if (gestureEvent.type() == PlatformEvent::GesturePinchEnd) { |
| 331 m_lastPinchAnchorCss.clear(); | 331 m_lastPinchAnchorCss.clear(); |
| 332 m_lastPinchAnchorDip.clear(); | 332 m_lastPinchAnchorDip.clear(); |
| 333 } | 333 } |
| 334 return true; | 334 return true; |
| 335 } | 335 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 m_webViewImpl->layout(); | 656 m_webViewImpl->layout(); |
| 657 } | 657 } |
| 658 m_webViewImpl->addPageOverlay(this, OverlayZOrders::highlight); | 658 m_webViewImpl->addPageOverlay(this, OverlayZOrders::highlight); |
| 659 } | 659 } |
| 660 | 660 |
| 661 void WebDevToolsAgentImpl::hideHighlight() | 661 void WebDevToolsAgentImpl::hideHighlight() |
| 662 { | 662 { |
| 663 m_webViewImpl->removePageOverlay(this); | 663 m_webViewImpl->removePageOverlay(this); |
| 664 } | 664 } |
| 665 | 665 |
| 666 void WebDevToolsAgentImpl::sendMessageToFrontend(PassRefPtr<WebCore::JSONObject>
message) | 666 void WebDevToolsAgentImpl::sendMessageToFrontend(PassRefPtr<blink::JSONObject> m
essage) |
| 667 { | 667 { |
| 668 m_frontendMessageQueue.append(message); | 668 m_frontendMessageQueue.append(message); |
| 669 } | 669 } |
| 670 | 670 |
| 671 void WebDevToolsAgentImpl::flush() | 671 void WebDevToolsAgentImpl::flush() |
| 672 { | 672 { |
| 673 flushPendingFrontendMessages(); | 673 flushPendingFrontendMessages(); |
| 674 } | 674 } |
| 675 | 675 |
| 676 void WebDevToolsAgentImpl::updateInspectorStateCookie(const String& state) | 676 void WebDevToolsAgentImpl::updateInspectorStateCookie(const String& state) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) | 738 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) |
| 739 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); | 739 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); |
| 740 } | 740 } |
| 741 | 741 |
| 742 void WebDevToolsAgent::processPendingMessages() | 742 void WebDevToolsAgent::processPendingMessages() |
| 743 { | 743 { |
| 744 PageScriptDebugServer::shared().runPendingTasks(); | 744 PageScriptDebugServer::shared().runPendingTasks(); |
| 745 } | 745 } |
| 746 | 746 |
| 747 } // namespace blink | 747 } // namespace blink |
| OLD | NEW |