OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 294 |
295 void WebView::updateVisitedLinkState(unsigned long long linkHash) { | 295 void WebView::updateVisitedLinkState(unsigned long long linkHash) { |
296 Page::visitedStateChanged(linkHash); | 296 Page::visitedStateChanged(linkHash); |
297 } | 297 } |
298 | 298 |
299 void WebView::resetVisitedLinkState(bool invalidateVisitedLinkHashes) { | 299 void WebView::resetVisitedLinkState(bool invalidateVisitedLinkHashes) { |
300 Page::allVisitedStateChanged(invalidateVisitedLinkHashes); | 300 Page::allVisitedStateChanged(invalidateVisitedLinkHashes); |
301 } | 301 } |
302 | 302 |
303 void WebView::willEnterModalLoop() { | 303 void WebView::willEnterModalLoop() { |
304 pageSuspenderStack().append(makeUnique<ScopedPageSuspender>()); | 304 pageSuspenderStack().append(WTF::makeUnique<ScopedPageSuspender>()); |
305 } | 305 } |
306 | 306 |
307 void WebView::didExitModalLoop() { | 307 void WebView::didExitModalLoop() { |
308 DCHECK(pageSuspenderStack().size()); | 308 DCHECK(pageSuspenderStack().size()); |
309 pageSuspenderStack().pop_back(); | 309 pageSuspenderStack().pop_back(); |
310 } | 310 } |
311 | 311 |
312 void WebViewImpl::setMainFrame(WebFrame* frame) { | 312 void WebViewImpl::setMainFrame(WebFrame* frame) { |
313 frame->toImplBase()->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, | 313 frame->toImplBase()->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, |
314 nullAtom); | 314 nullAtom); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 m_baseBackgroundColor(Color::white), | 376 m_baseBackgroundColor(Color::white), |
377 m_backgroundColorOverride(Color::transparent), | 377 m_backgroundColorOverride(Color::transparent), |
378 m_zoomFactorOverride(0), | 378 m_zoomFactorOverride(0), |
379 m_userGestureObserved(false), | 379 m_userGestureObserved(false), |
380 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), | 380 m_shouldDispatchFirstVisuallyNonEmptyLayout(false), |
381 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), | 381 m_shouldDispatchFirstLayoutAfterFinishedParsing(false), |
382 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), | 382 m_shouldDispatchFirstLayoutAfterFinishedLoading(false), |
383 m_displayMode(WebDisplayModeBrowser), | 383 m_displayMode(WebDisplayModeBrowser), |
384 m_elasticOverscroll(FloatSize()), | 384 m_elasticOverscroll(FloatSize()), |
385 m_mutator(nullptr), | 385 m_mutator(nullptr), |
386 m_scheduler(wrapUnique(Platform::current() | 386 m_scheduler(WTF::wrapUnique(Platform::current() |
387 ->currentThread() | 387 ->currentThread() |
388 ->scheduler() | 388 ->scheduler() |
389 ->createWebViewScheduler(this, this) | 389 ->createWebViewScheduler(this, this) |
390 .release())), | 390 .release())), |
391 m_lastFrameTimeMonotonic(0), | 391 m_lastFrameTimeMonotonic(0), |
392 m_overrideCompositorVisibility(false) { | 392 m_overrideCompositorVisibility(false) { |
393 Page::PageClients pageClients; | 393 Page::PageClients pageClients; |
394 pageClients.chromeClient = m_chromeClientImpl.get(); | 394 pageClients.chromeClient = m_chromeClientImpl.get(); |
395 pageClients.contextMenuClient = &m_contextMenuClientImpl; | 395 pageClients.contextMenuClient = &m_contextMenuClientImpl; |
396 pageClients.editorClient = &m_editorClientImpl; | 396 pageClients.editorClient = &m_editorClientImpl; |
397 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; | 397 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; |
398 | 398 |
399 m_page = Page::createOrdinary(pageClients); | 399 m_page = Page::createOrdinary(pageClients); |
400 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); | 400 MediaKeysController::provideMediaKeysTo(*m_page, &m_mediaKeysClientImpl); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 .isScrollbarHandlingGestures()) | 710 .isScrollbarHandlingGestures()) |
711 break; | 711 break; |
712 endActiveFlingAnimation(); | 712 endActiveFlingAnimation(); |
713 m_client->cancelScheduledContentIntents(); | 713 m_client->cancelScheduledContentIntents(); |
714 m_positionOnFlingStart = WebPoint(event.x, event.y); | 714 m_positionOnFlingStart = WebPoint(event.x, event.y); |
715 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); | 715 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); |
716 m_flingModifier = event.modifiers; | 716 m_flingModifier = event.modifiers; |
717 m_flingSourceDevice = event.sourceDevice; | 717 m_flingSourceDevice = event.sourceDevice; |
718 DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized); | 718 DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized); |
719 std::unique_ptr<WebGestureCurve> flingCurve = | 719 std::unique_ptr<WebGestureCurve> flingCurve = |
720 wrapUnique(Platform::current()->createFlingAnimationCurve( | 720 WTF::wrapUnique(Platform::current()->createFlingAnimationCurve( |
721 event.sourceDevice, | 721 event.sourceDevice, |
722 WebFloatPoint(event.data.flingStart.velocityX, | 722 WebFloatPoint(event.data.flingStart.velocityX, |
723 event.data.flingStart.velocityY), | 723 event.data.flingStart.velocityY), |
724 WebSize())); | 724 WebSize())); |
725 DCHECK(flingCurve); | 725 DCHECK(flingCurve); |
726 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart( | 726 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart( |
727 std::move(flingCurve), this); | 727 std::move(flingCurve), this); |
728 mainFrameImpl()->frameWidget()->scheduleAnimation(); | 728 mainFrameImpl()->frameWidget()->scheduleAnimation(); |
729 eventResult = WebInputEventResult::HandledSystem; | 729 eventResult = WebInputEventResult::HandledSystem; |
730 | 730 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 } | 958 } |
959 | 959 |
960 void WebViewImpl::transferActiveWheelFlingAnimation( | 960 void WebViewImpl::transferActiveWheelFlingAnimation( |
961 const WebActiveWheelFlingParameters& parameters) { | 961 const WebActiveWheelFlingParameters& parameters) { |
962 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); | 962 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); |
963 DCHECK(!m_gestureAnimation); | 963 DCHECK(!m_gestureAnimation); |
964 m_positionOnFlingStart = parameters.point; | 964 m_positionOnFlingStart = parameters.point; |
965 m_globalPositionOnFlingStart = parameters.globalPoint; | 965 m_globalPositionOnFlingStart = parameters.globalPoint; |
966 m_flingModifier = parameters.modifiers; | 966 m_flingModifier = parameters.modifiers; |
967 std::unique_ptr<WebGestureCurve> curve = | 967 std::unique_ptr<WebGestureCurve> curve = |
968 wrapUnique(Platform::current()->createFlingAnimationCurve( | 968 WTF::wrapUnique(Platform::current()->createFlingAnimationCurve( |
969 parameters.sourceDevice, WebFloatPoint(parameters.delta), | 969 parameters.sourceDevice, WebFloatPoint(parameters.delta), |
970 parameters.cumulativeScroll)); | 970 parameters.cumulativeScroll)); |
971 DCHECK(curve); | 971 DCHECK(curve); |
972 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset( | 972 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset( |
973 std::move(curve), this, parameters.startTime); | 973 std::move(curve), this, parameters.startTime); |
974 DCHECK_NE(parameters.sourceDevice, WebGestureDeviceUninitialized); | 974 DCHECK_NE(parameters.sourceDevice, WebGestureDeviceUninitialized); |
975 m_flingSourceDevice = parameters.sourceDevice; | 975 m_flingSourceDevice = parameters.sourceDevice; |
976 mainFrameImpl()->frameWidget()->scheduleAnimation(); | 976 mainFrameImpl()->frameWidget()->scheduleAnimation(); |
977 } | 977 } |
978 | 978 |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 AtomicString eventType; | 2178 AtomicString eventType; |
2179 switch (inputEvent.type) { | 2179 switch (inputEvent.type) { |
2180 case WebInputEvent::MouseMove: | 2180 case WebInputEvent::MouseMove: |
2181 eventType = EventTypeNames::mousemove; | 2181 eventType = EventTypeNames::mousemove; |
2182 break; | 2182 break; |
2183 case WebInputEvent::MouseLeave: | 2183 case WebInputEvent::MouseLeave: |
2184 eventType = EventTypeNames::mouseout; | 2184 eventType = EventTypeNames::mouseout; |
2185 break; | 2185 break; |
2186 case WebInputEvent::MouseDown: | 2186 case WebInputEvent::MouseDown: |
2187 eventType = EventTypeNames::mousedown; | 2187 eventType = EventTypeNames::mousedown; |
2188 gestureIndicator = wrapUnique( | 2188 gestureIndicator = WTF::wrapUnique( |
2189 new UserGestureIndicator(DocumentUserGestureToken::create( | 2189 new UserGestureIndicator(DocumentUserGestureToken::create( |
2190 &node->document(), UserGestureToken::NewGesture))); | 2190 &node->document(), UserGestureToken::NewGesture))); |
2191 m_mouseCaptureGestureToken = gestureIndicator->currentToken(); | 2191 m_mouseCaptureGestureToken = gestureIndicator->currentToken(); |
2192 break; | 2192 break; |
2193 case WebInputEvent::MouseUp: | 2193 case WebInputEvent::MouseUp: |
2194 eventType = EventTypeNames::mouseup; | 2194 eventType = EventTypeNames::mouseup; |
2195 gestureIndicator = wrapUnique( | 2195 gestureIndicator = WTF::wrapUnique( |
2196 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); | 2196 new UserGestureIndicator(m_mouseCaptureGestureToken.release())); |
2197 break; | 2197 break; |
2198 default: | 2198 default: |
2199 NOTREACHED(); | 2199 NOTREACHED(); |
2200 } | 2200 } |
2201 | 2201 |
2202 node->dispatchMouseEvent( | 2202 node->dispatchMouseEvent( |
2203 PlatformMouseEventBuilder( | 2203 PlatformMouseEventBuilder( |
2204 mainFrameImpl()->frameView(), | 2204 mainFrameImpl()->frameView(), |
2205 static_cast<const WebMouseEvent&>(inputEvent)), | 2205 static_cast<const WebMouseEvent&>(inputEvent)), |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2583 // well. This code needs to be refactored (http://crbug.com/629721). | 2583 // well. This code needs to be refactored (http://crbug.com/629721). |
2584 void WebViewImpl::applyReplacementRange(const WebRange& range) { | 2584 void WebViewImpl::applyReplacementRange(const WebRange& range) { |
2585 if (WebLocalFrame* frame = focusedFrame()) | 2585 if (WebLocalFrame* frame = focusedFrame()) |
2586 frame->selectRange(range); | 2586 frame->selectRange(range); |
2587 } | 2587 } |
2588 | 2588 |
2589 // WebView -------------------------------------------------------------------- | 2589 // WebView -------------------------------------------------------------------- |
2590 | 2590 |
2591 WebSettingsImpl* WebViewImpl::settingsImpl() { | 2591 WebSettingsImpl* WebViewImpl::settingsImpl() { |
2592 if (!m_webSettings) | 2592 if (!m_webSettings) |
2593 m_webSettings = wrapUnique( | 2593 m_webSettings = WTF::wrapUnique( |
2594 new WebSettingsImpl(&m_page->settings(), m_devToolsEmulator.get())); | 2594 new WebSettingsImpl(&m_page->settings(), m_devToolsEmulator.get())); |
2595 DCHECK(m_webSettings); | 2595 DCHECK(m_webSettings); |
2596 return m_webSettings.get(); | 2596 return m_webSettings.get(); |
2597 } | 2597 } |
2598 | 2598 |
2599 WebSettings* WebViewImpl::settings() { | 2599 WebSettings* WebViewImpl::settings() { |
2600 return settingsImpl(); | 2600 return settingsImpl(); |
2601 } | 2601 } |
2602 | 2602 |
2603 WebString WebViewImpl::pageEncoding() const { | 2603 WebString WebViewImpl::pageEncoding() const { |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3733 setZoomLevel(zoomLevel()); | 3733 setZoomLevel(zoomLevel()); |
3734 } | 3734 } |
3735 | 3735 |
3736 void WebViewImpl::setPageOverlayColor(WebColor color) { | 3736 void WebViewImpl::setPageOverlayColor(WebColor color) { |
3737 if (m_pageColorOverlay) | 3737 if (m_pageColorOverlay) |
3738 m_pageColorOverlay.reset(); | 3738 m_pageColorOverlay.reset(); |
3739 | 3739 |
3740 if (color == Color::transparent) | 3740 if (color == Color::transparent) |
3741 return; | 3741 return; |
3742 | 3742 |
3743 m_pageColorOverlay = | 3743 m_pageColorOverlay = PageOverlay::create( |
3744 PageOverlay::create(mainFrameImpl(), makeUnique<ColorOverlay>(color)); | 3744 mainFrameImpl(), WTF::makeUnique<ColorOverlay>(color)); |
3745 m_pageColorOverlay->update(); | 3745 m_pageColorOverlay->update(); |
3746 } | 3746 } |
3747 | 3747 |
3748 WebPageImportanceSignals* WebViewImpl::pageImportanceSignals() { | 3748 WebPageImportanceSignals* WebViewImpl::pageImportanceSignals() { |
3749 return &m_pageImportanceSignals; | 3749 return &m_pageImportanceSignals; |
3750 } | 3750 } |
3751 | 3751 |
3752 Element* WebViewImpl::focusedElement() const { | 3752 Element* WebViewImpl::focusedElement() const { |
3753 LocalFrame* frame = m_page->focusController().focusedFrame(); | 3753 LocalFrame* frame = m_page->focusController().focusedFrame(); |
3754 if (!frame) | 3754 if (!frame) |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4125 } | 4125 } |
4126 | 4126 |
4127 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) { | 4127 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) { |
4128 std::unique_ptr<UserGestureIndicator> gestureIndicator; | 4128 std::unique_ptr<UserGestureIndicator> gestureIndicator; |
4129 AtomicString eventType; | 4129 AtomicString eventType; |
4130 switch (event.type) { | 4130 switch (event.type) { |
4131 case WebInputEvent::MouseDown: | 4131 case WebInputEvent::MouseDown: |
4132 eventType = EventTypeNames::mousedown; | 4132 eventType = EventTypeNames::mousedown; |
4133 if (!page() || !page()->pointerLockController().element()) | 4133 if (!page() || !page()->pointerLockController().element()) |
4134 break; | 4134 break; |
4135 gestureIndicator = | 4135 gestureIndicator = WTF::wrapUnique( |
4136 wrapUnique(new UserGestureIndicator(DocumentUserGestureToken::create( | 4136 new UserGestureIndicator(DocumentUserGestureToken::create( |
4137 &page()->pointerLockController().element()->document(), | 4137 &page()->pointerLockController().element()->document(), |
4138 UserGestureToken::NewGesture))); | 4138 UserGestureToken::NewGesture))); |
4139 m_pointerLockGestureToken = gestureIndicator->currentToken(); | 4139 m_pointerLockGestureToken = gestureIndicator->currentToken(); |
4140 break; | 4140 break; |
4141 case WebInputEvent::MouseUp: | 4141 case WebInputEvent::MouseUp: |
4142 eventType = EventTypeNames::mouseup; | 4142 eventType = EventTypeNames::mouseup; |
4143 gestureIndicator = wrapUnique( | 4143 gestureIndicator = WTF::wrapUnique( |
4144 new UserGestureIndicator(m_pointerLockGestureToken.release())); | 4144 new UserGestureIndicator(m_pointerLockGestureToken.release())); |
4145 break; | 4145 break; |
4146 case WebInputEvent::MouseMove: | 4146 case WebInputEvent::MouseMove: |
4147 eventType = EventTypeNames::mousemove; | 4147 eventType = EventTypeNames::mousemove; |
4148 break; | 4148 break; |
4149 default: | 4149 default: |
4150 NOTREACHED(); | 4150 NOTREACHED(); |
4151 } | 4151 } |
4152 | 4152 |
4153 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); | 4153 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4204 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4204 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4205 return nullptr; | 4205 return nullptr; |
4206 return focusedFrame; | 4206 return focusedFrame; |
4207 } | 4207 } |
4208 | 4208 |
4209 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4209 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4210 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4210 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4211 } | 4211 } |
4212 | 4212 |
4213 } // namespace blink | 4213 } // namespace blink |
OLD | NEW |