Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 258
259 private: 259 private:
260 WebAutofillClient* const m_client; 260 WebAutofillClient* const m_client;
261 bool* const m_userGestureObserved; 261 bool* const m_userGestureObserved;
262 }; 262 };
263 263
264 UserGestureNotifier::UserGestureNotifier(WebAutofillClient* client, bool* userGe stureObserved) 264 UserGestureNotifier::UserGestureNotifier(WebAutofillClient* client, bool* userGe stureObserved)
265 : m_client(client) 265 : m_client(client)
266 , m_userGestureObserved(userGestureObserved) 266 , m_userGestureObserved(userGestureObserved)
267 { 267 {
268 ASSERT(m_userGestureObserved); 268 DCHECK(m_userGestureObserved);
269 } 269 }
270 270
271 UserGestureNotifier::~UserGestureNotifier() 271 UserGestureNotifier::~UserGestureNotifier()
272 { 272 {
273 if (!*m_userGestureObserved && UserGestureIndicator::processedUserGestureSin ceLoad()) { 273 if (!*m_userGestureObserved && UserGestureIndicator::processedUserGestureSin ceLoad()) {
274 *m_userGestureObserved = true; 274 *m_userGestureObserved = true;
275 if (m_client) 275 if (m_client)
276 m_client->firstUserGestureObserved(); 276 m_client->firstUserGestureObserved();
277 } 277 }
278 } 278 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 Page::allVisitedStateChanged(invalidateVisitedLinkHashes); 355 Page::allVisitedStateChanged(invalidateVisitedLinkHashes);
356 } 356 }
357 357
358 void WebView::willEnterModalLoop() 358 void WebView::willEnterModalLoop()
359 { 359 {
360 pageLoadDeferrerStack().append(adoptPtr(new ScopedPageLoadDeferrer())); 360 pageLoadDeferrerStack().append(adoptPtr(new ScopedPageLoadDeferrer()));
361 } 361 }
362 362
363 void WebView::didExitModalLoop() 363 void WebView::didExitModalLoop()
364 { 364 {
365 ASSERT(pageLoadDeferrerStack().size()); 365 DCHECK(pageLoadDeferrerStack().size());
366 pageLoadDeferrerStack().removeLast(); 366 pageLoadDeferrerStack().removeLast();
367 } 367 }
368 368
369 void WebViewImpl::setMainFrame(WebFrame* frame) 369 void WebViewImpl::setMainFrame(WebFrame* frame)
370 { 370 {
371 frame->toImplBase()->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullAtom); 371 frame->toImplBase()->initializeCoreFrame(&page()->frameHost(), 0, nullAtom, nullAtom);
372 } 372 }
373 373
374 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred entialManagerClient) 374 void WebViewImpl::setCredentialManagerClient(WebCredentialManagerClient* webCred entialManagerClient)
375 { 375 {
376 ASSERT(m_page); 376 DCHECK(m_page);
377 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre dentialManagerClient)); 377 provideCredentialManagerClientTo(*m_page, new CredentialManagerClient(webCre dentialManagerClient));
378 } 378 }
379 379
380 void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient) 380 void WebViewImpl::setPrerendererClient(WebPrerendererClient* prerendererClient)
381 { 381 {
382 ASSERT(m_page); 382 DCHECK(m_page);
383 providePrerendererClientTo(*m_page, new PrerendererClientImpl(prerendererCli ent)); 383 providePrerendererClientTo(*m_page, new PrerendererClientImpl(prerendererCli ent));
384 } 384 }
385 385
386 void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient) 386 void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient)
387 { 387 {
388 m_spellCheckClient = spellCheckClient; 388 m_spellCheckClient = spellCheckClient;
389 } 389 }
390 390
391 // static 391 // static
392 HashSet<WebViewImpl*>& WebViewImpl::allInstances() 392 HashSet<WebViewImpl*>& WebViewImpl::allInstances()
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 471
472 m_devToolsEmulator = DevToolsEmulator::create(this); 472 m_devToolsEmulator = DevToolsEmulator::create(this);
473 473
474 allInstances().add(this); 474 allInstances().add(this);
475 475
476 m_pageImportanceSignals.setObserver(client); 476 m_pageImportanceSignals.setObserver(client);
477 } 477 }
478 478
479 WebViewImpl::~WebViewImpl() 479 WebViewImpl::~WebViewImpl()
480 { 480 {
481 ASSERT(!m_page); 481 DCHECK(!m_page);
482 482
483 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline 483 // Each highlight uses m_owningWebViewImpl->m_linkHighlightsTimeline
484 // in destructor. m_linkHighlightsTimeline might be destroyed earlier 484 // in destructor. m_linkHighlightsTimeline might be destroyed earlier
485 // than m_linkHighlights. 485 // than m_linkHighlights.
486 ASSERT(m_linkHighlights.isEmpty()); 486 DCHECK(m_linkHighlights.isEmpty());
487 } 487 }
488 488
489 WebDevToolsAgentImpl* WebViewImpl::mainFrameDevToolsAgentImpl() 489 WebDevToolsAgentImpl* WebViewImpl::mainFrameDevToolsAgentImpl()
490 { 490 {
491 WebLocalFrameImpl* mainFrame = mainFrameImpl(); 491 WebLocalFrameImpl* mainFrame = mainFrameImpl();
492 return mainFrame ? mainFrame->devToolsAgentImpl() : nullptr; 492 return mainFrame ? mainFrame->devToolsAgentImpl() : nullptr;
493 } 493 }
494 494
495 InspectorOverlay* WebViewImpl::inspectorOverlay() 495 InspectorOverlay* WebViewImpl::inspectorOverlay()
496 { 496 {
497 if (WebDevToolsAgentImpl* devtools = mainFrameDevToolsAgentImpl()) 497 if (WebDevToolsAgentImpl* devtools = mainFrameDevToolsAgentImpl())
498 return devtools->overlay(); 498 return devtools->overlay();
499 return nullptr; 499 return nullptr;
500 } 500 }
501 501
502 WebLocalFrameImpl* WebViewImpl::mainFrameImpl() const 502 WebLocalFrameImpl* WebViewImpl::mainFrameImpl() const
503 { 503 {
504 return m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame() 504 return m_page && m_page->mainFrame() && m_page->mainFrame()->isLocalFrame()
505 ? WebLocalFrameImpl::fromFrame(m_page->deprecatedLocalMainFrame()) : nul lptr; 505 ? WebLocalFrameImpl::fromFrame(m_page->deprecatedLocalMainFrame()) : nul lptr;
506 } 506 }
507 507
508 bool WebViewImpl::tabKeyCyclesThroughElements() const 508 bool WebViewImpl::tabKeyCyclesThroughElements() const
509 { 509 {
510 ASSERT(m_page); 510 DCHECK(m_page);
511 return m_page->tabKeyCyclesThroughElements(); 511 return m_page->tabKeyCyclesThroughElements();
512 } 512 }
513 513
514 void WebViewImpl::setTabKeyCyclesThroughElements(bool value) 514 void WebViewImpl::setTabKeyCyclesThroughElements(bool value)
515 { 515 {
516 if (m_page) 516 if (m_page)
517 m_page->setTabKeyCyclesThroughElements(value); 517 m_page->setTabKeyCyclesThroughElements(value);
518 } 518 }
519 519
520 void WebViewImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseEvent& e vent) 520 void WebViewImpl::handleMouseLeave(LocalFrame& mainFrame, const WebMouseEvent& e vent)
521 { 521 {
522 m_client->setMouseOverURL(WebURL()); 522 m_client->setMouseOverURL(WebURL());
523 PageWidgetEventHandler::handleMouseLeave(mainFrame, event); 523 PageWidgetEventHandler::handleMouseLeave(mainFrame, event);
524 } 524 }
525 525
526 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev ent) 526 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev ent)
527 { 527 {
528 // If there is a popup open, close it as the user is clicking on the page 528 // If there is a popup open, close it as the user is clicking on the page
529 // (outside of the popup). We also save it so we can prevent a click on an 529 // (outside of the popup). We also save it so we can prevent a click on an
530 // element from immediately reopening the same popup. 530 // element from immediately reopening the same popup.
531 RefPtr<WebPagePopupImpl> pagePopup; 531 RefPtr<WebPagePopupImpl> pagePopup;
532 if (event.button == WebMouseEvent::ButtonLeft) { 532 if (event.button == WebMouseEvent::ButtonLeft) {
533 pagePopup = m_pagePopup; 533 pagePopup = m_pagePopup;
534 hidePopups(); 534 hidePopups();
535 ASSERT(!m_pagePopup); 535 DCHECK(!m_pagePopup);
536 } 536 }
537 537
538 m_lastMouseDownPoint = WebPoint(event.x, event.y); 538 m_lastMouseDownPoint = WebPoint(event.x, event.y);
539 539
540 // Take capture on a mouse down on a plugin so we can send it mouse events. 540 // Take capture on a mouse down on a plugin so we can send it mouse events.
541 // If the hit node is a plugin but a scrollbar is over it don't start mouse 541 // If the hit node is a plugin but a scrollbar is over it don't start mouse
542 // capture because it will interfere with the scrollbar receiving events. 542 // capture because it will interfere with the scrollbar receiving events.
543 IntPoint point(event.x, event.y); 543 IntPoint point(event.x, event.y);
544 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca lFrame()) { 544 if (event.button == WebMouseEvent::ButtonLeft && m_page->mainFrame()->isLoca lFrame()) {
545 point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents( point); 545 point = m_page->deprecatedLocalMainFrame()->view()->rootFrameToContents( point);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 gestureEvent.x = m_positionOnFlingStart.x; 652 gestureEvent.x = m_positionOnFlingStart.x;
653 gestureEvent.y = m_positionOnFlingStart.y; 653 gestureEvent.y = m_positionOnFlingStart.y;
654 gestureEvent.globalX = m_globalPositionOnFlingStart.x; 654 gestureEvent.globalX = m_globalPositionOnFlingStart.x;
655 gestureEvent.globalY = m_globalPositionOnFlingStart.y; 655 gestureEvent.globalY = m_globalPositionOnFlingStart.y;
656 gestureEvent.modifiers = m_flingModifier; 656 gestureEvent.modifiers = m_flingModifier;
657 return gestureEvent; 657 return gestureEvent;
658 } 658 }
659 659
660 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty) 660 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty)
661 { 661 {
662 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); 662 DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized);
663 if (!m_page || !m_page->mainFrame() || !m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFrame()->view()) 663 if (!m_page || !m_page->mainFrame() || !m_page->mainFrame()->isLocalFrame() || !m_page->deprecatedLocalMainFrame()->view())
664 return false; 664 return false;
665 665
666 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { 666 if (m_flingSourceDevice == WebGestureDeviceTouchpad) {
667 WebMouseWheelEvent syntheticWheel; 667 WebMouseWheelEvent syntheticWheel;
668 const float tickDivisor = WheelEvent::TickMultiplier; 668 const float tickDivisor = WheelEvent::TickMultiplier;
669 669
670 syntheticWheel.type = WebInputEvent::MouseWheel; 670 syntheticWheel.type = WebInputEvent::MouseWheel;
671 syntheticWheel.timeStampSeconds = WTF::monotonicallyIncreasingTime(); 671 syntheticWheel.timeStampSeconds = WTF::monotonicallyIncreasingTime();
672 syntheticWheel.deltaX = delta.width; 672 syntheticWheel.deltaX = delta.width;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 switch (event.type) { 729 switch (event.type) {
730 case WebInputEvent::GestureFlingStart: { 730 case WebInputEvent::GestureFlingStart: {
731 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures ()) 731 if (mainFrameImpl()->frame()->eventHandler().isScrollbarHandlingGestures ())
732 break; 732 break;
733 endActiveFlingAnimation(); 733 endActiveFlingAnimation();
734 m_client->cancelScheduledContentIntents(); 734 m_client->cancelScheduledContentIntents();
735 m_positionOnFlingStart = WebPoint(event.x, event.y); 735 m_positionOnFlingStart = WebPoint(event.x, event.y);
736 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY); 736 m_globalPositionOnFlingStart = WebPoint(event.globalX, event.globalY);
737 m_flingModifier = event.modifiers; 737 m_flingModifier = event.modifiers;
738 m_flingSourceDevice = event.sourceDevice; 738 m_flingSourceDevice = event.sourceDevice;
739 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); 739 DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized);
740 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize())); 740 OwnPtr<WebGestureCurve> flingCurve = adoptPtr(Platform::current()->creat eFlingAnimationCurve(event.sourceDevice, WebFloatPoint(event.data.flingStart.vel ocityX, event.data.flingStart.velocityY), WebSize()));
741 ASSERT(flingCurve); 741 DCHECK(flingCurve);
742 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this); 742 m_gestureAnimation = WebActiveGestureAnimation::createAtAnimationStart(f lingCurve.release(), this);
743 scheduleAnimation(); 743 scheduleAnimation();
744 eventResult = WebInputEventResult::HandledSystem; 744 eventResult = WebInputEventResult::HandledSystem;
745 745
746 // Plugins may need to see GestureFlingStart to balance 746 // Plugins may need to see GestureFlingStart to balance
747 // GestureScrollBegin (since the former replaces GestureScrollEnd when 747 // GestureScrollBegin (since the former replaces GestureScrollEnd when
748 // transitioning to a fling). 748 // transitioning to a fling).
749 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); 749 PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event);
750 // TODO(dtapuska): Why isn't the response used? 750 // TODO(dtapuska): Why isn't the response used?
751 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEvent(platfo rmEvent); 751 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEvent(platfo rmEvent);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 break; 819 break;
820 } 820 }
821 821
822 switch (event.type) { 822 switch (event.type) {
823 case WebInputEvent::GestureTap: { 823 case WebInputEvent::GestureTap: {
824 // If there is a popup open, close it as the user is clicking on the pag e 824 // If there is a popup open, close it as the user is clicking on the pag e
825 // (outside of the popup). We also save it so we can prevent a tap on an 825 // (outside of the popup). We also save it so we can prevent a tap on an
826 // element from immediately reopening the same popup. 826 // element from immediately reopening the same popup.
827 RefPtr<WebPagePopupImpl> pagePopup = m_pagePopup; 827 RefPtr<WebPagePopupImpl> pagePopup = m_pagePopup;
828 hidePopups(); 828 hidePopups();
829 ASSERT(!m_pagePopup); 829 DCHECK(!m_pagePopup);
830 830
831 m_client->cancelScheduledContentIntents(); 831 m_client->cancelScheduledContentIntents();
832 if (detectContentOnTouch(targetedEvent)) { 832 if (detectContentOnTouch(targetedEvent)) {
833 eventResult = WebInputEventResult::HandledSystem; 833 eventResult = WebInputEventResult::HandledSystem;
834 break; 834 break;
835 } 835 }
836 836
837 // Don't trigger a disambiguation popup on sites designed for mobile dev ices. 837 // Don't trigger a disambiguation popup on sites designed for mobile dev ices.
838 // Instead, assume that the page has been designed with big enough butto ns and links. 838 // Instead, assume that the page has been designed with big enough butto ns and links.
839 // Don't trigger a disambiguation popup when screencasting, since it's i mplemented outside of 839 // Don't trigger a disambiguation popup when screencasting, since it's i mplemented outside of
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 } 905 }
906 default: 906 default:
907 ASSERT_NOT_REACHED(); 907 ASSERT_NOT_REACHED();
908 } 908 }
909 m_client->didHandleGestureEvent(event, eventCancelled); 909 m_client->didHandleGestureEvent(event, eventCancelled);
910 return eventResult; 910 return eventResult;
911 } 911 }
912 912
913 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent(cons t WebGestureEvent& pinchEvent) 913 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent(cons t WebGestureEvent& pinchEvent)
914 { 914 {
915 ASSERT(pinchEvent.type == WebInputEvent::GesturePinchUpdate); 915 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate);
916 916
917 // Touchscreen pinch events should not reach Blink. 917 // Touchscreen pinch events should not reach Blink.
918 ASSERT(pinchEvent.sourceDevice == WebGestureDeviceTouchpad); 918 DCHECK_EQ(pinchEvent.sourceDevice, WebGestureDeviceTouchpad);
919 919
920 // For pinch gesture events, match typical trackpad behavior on Windows by s ending fake 920 // For pinch gesture events, match typical trackpad behavior on Windows by s ending fake
921 // wheel events with the ctrl modifier set when we see trackpad pinch gestur es. Ideally 921 // wheel events with the ctrl modifier set when we see trackpad pinch gestur es. Ideally
922 // we'd someday get a platform 'pinch' event and send that instead. 922 // we'd someday get a platform 'pinch' event and send that instead.
923 WebMouseWheelEvent wheelEvent; 923 WebMouseWheelEvent wheelEvent;
924 wheelEvent.type = WebInputEvent::MouseWheel; 924 wheelEvent.type = WebInputEvent::MouseWheel;
925 wheelEvent.timeStampSeconds = pinchEvent.timeStampSeconds; 925 wheelEvent.timeStampSeconds = pinchEvent.timeStampSeconds;
926 wheelEvent.windowX = wheelEvent.x = pinchEvent.x; 926 wheelEvent.windowX = wheelEvent.x = pinchEvent.x;
927 wheelEvent.windowY = wheelEvent.y = pinchEvent.y; 927 wheelEvent.windowY = wheelEvent.y = pinchEvent.y;
928 wheelEvent.globalX = pinchEvent.globalX; 928 wheelEvent.globalX = pinchEvent.globalX;
929 wheelEvent.globalY = pinchEvent.globalY; 929 wheelEvent.globalY = pinchEvent.globalY;
930 wheelEvent.modifiers = 930 wheelEvent.modifiers =
931 pinchEvent.modifiers | WebInputEvent::ControlKey; 931 pinchEvent.modifiers | WebInputEvent::ControlKey;
932 wheelEvent.deltaX = 0; 932 wheelEvent.deltaX = 0;
933 933
934 // The function to convert scales to deltaY values is designed to be 934 // The function to convert scales to deltaY values is designed to be
935 // compatible with websites existing use of wheel events, and with existing 935 // compatible with websites existing use of wheel events, and with existing
936 // Windows trackpad behavior. In particular, we want: 936 // Windows trackpad behavior. In particular, we want:
937 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2) 937 // - deltas should accumulate via addition: f(s1*s2)==f(s1)+f(s2)
938 // - deltas should invert via negation: f(1/s) == -f(s) 938 // - deltas should invert via negation: f(1/s) == -f(s)
939 // - zoom in should be positive: f(s) > 0 iff s > 1 939 // - zoom in should be positive: f(s) > 0 iff s > 1
940 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100 940 // - magnitude roughly matches wheels: f(2) > 25 && f(2) < 100
941 // - a formula that's relatively easy to use from JavaScript 941 // - a formula that's relatively easy to use from JavaScript
942 // Note that 'wheel' event deltaY values have their sign inverted. So to 942 // Note that 'wheel' event deltaY values have their sign inverted. So to
943 // convert a wheel deltaY back to a scale use Math.exp(-deltaY/100). 943 // convert a wheel deltaY back to a scale use Math.exp(-deltaY/100).
944 ASSERT(pinchEvent.data.pinchUpdate.scale > 0); 944 DCHECK_GT(pinchEvent.data.pinchUpdate.scale, 0);
945 wheelEvent.deltaY = 100.0f * log(pinchEvent.data.pinchUpdate.scale); 945 wheelEvent.deltaY = 100.0f * log(pinchEvent.data.pinchUpdate.scale);
946 wheelEvent.hasPreciseScrollingDeltas = true; 946 wheelEvent.hasPreciseScrollingDeltas = true;
947 wheelEvent.wheelTicksX = 0; 947 wheelEvent.wheelTicksX = 0;
948 wheelEvent.wheelTicksY = 948 wheelEvent.wheelTicksY =
949 pinchEvent.data.pinchUpdate.scale > 1 ? 1 : -1; 949 pinchEvent.data.pinchUpdate.scale > 1 ? 1 : -1;
950 wheelEvent.canScroll = false; 950 wheelEvent.canScroll = false;
951 951
952 return handleInputEvent(wheelEvent); 952 return handleInputEvent(wheelEvent);
953 } 953 }
954 954
955 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar ameters& parameters) 955 void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar ameters& parameters)
956 { 956 {
957 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation"); 957 TRACE_EVENT0("blink", "WebViewImpl::transferActiveWheelFlingAnimation");
958 ASSERT(!m_gestureAnimation); 958 DCHECK(!m_gestureAnimation);
959 m_positionOnFlingStart = parameters.point; 959 m_positionOnFlingStart = parameters.point;
960 m_globalPositionOnFlingStart = parameters.globalPoint; 960 m_globalPositionOnFlingStart = parameters.globalPoint;
961 m_flingModifier = parameters.modifiers; 961 m_flingModifier = parameters.modifiers;
962 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters .cumulativeScroll)); 962 OwnPtr<WebGestureCurve> curve = adoptPtr(Platform::current()->createFlingAni mationCurve(parameters.sourceDevice, WebFloatPoint(parameters.delta), parameters .cumulativeScroll));
963 ASSERT(curve); 963 DCHECK(curve);
964 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r elease(), this, parameters.startTime); 964 m_gestureAnimation = WebActiveGestureAnimation::createWithTimeOffset(curve.r elease(), this, parameters.startTime);
965 ASSERT(parameters.sourceDevice != WebGestureDeviceUninitialized); 965 DCHECK_NE(parameters.sourceDevice, WebGestureDeviceUninitialized);
966 m_flingSourceDevice = parameters.sourceDevice; 966 m_flingSourceDevice = parameters.sourceDevice;
967 scheduleAnimation(); 967 scheduleAnimation();
968 } 968 }
969 969
970 bool WebViewImpl::endActiveFlingAnimation() 970 bool WebViewImpl::endActiveFlingAnimation()
971 { 971 {
972 if (m_gestureAnimation) { 972 if (m_gestureAnimation) {
973 m_gestureAnimation.clear(); 973 m_gestureAnimation.clear();
974 m_flingSourceDevice = WebGestureDeviceUninitialized; 974 m_flingSourceDevice = WebGestureDeviceUninitialized;
975 if (m_layerTreeView) 975 if (m_layerTreeView)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 FontCache::acceptLanguagesChanged(m_client->acceptLanguages()); 1057 FontCache::acceptLanguagesChanged(m_client->acceptLanguages());
1058 1058
1059 if (!page()) 1059 if (!page())
1060 return; 1060 return;
1061 1061
1062 page()->acceptLanguagesChanged(); 1062 page()->acceptLanguagesChanged();
1063 } 1063 }
1064 1064
1065 WebInputEventResult WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) 1065 WebInputEventResult WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event)
1066 { 1066 {
1067 ASSERT((event.type == WebInputEvent::RawKeyDown) 1067 DCHECK((event.type == WebInputEvent::RawKeyDown)
1068 || (event.type == WebInputEvent::KeyDown) 1068 || (event.type == WebInputEvent::KeyDown)
1069 || (event.type == WebInputEvent::KeyUp)); 1069 || (event.type == WebInputEvent::KeyUp));
1070 TRACE_EVENT2("input", "WebViewImpl::handleKeyEvent", 1070 TRACE_EVENT2("input", "WebViewImpl::handleKeyEvent",
1071 "type", inputTypeToName(event.type), 1071 "type", inputTypeToName(event.type),
1072 "text", String(event.text).utf8()); 1072 "text", String(event.text).utf8());
1073 1073
1074 // Halt an in-progress fling on a key event. 1074 // Halt an in-progress fling on a key event.
1075 endActiveFlingAnimation(); 1075 endActiveFlingAnimation();
1076 1076
1077 // Please refer to the comments explaining the m_suppressNextKeypressEvent 1077 // Please refer to the comments explaining the m_suppressNextKeypressEvent
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 } 1146 }
1147 #endif // !OS(MACOSX) 1147 #endif // !OS(MACOSX)
1148 1148
1149 if (keyEventDefault(event)) 1149 if (keyEventDefault(event))
1150 return WebInputEventResult::HandledSystem; 1150 return WebInputEventResult::HandledSystem;
1151 return WebInputEventResult::NotHandled; 1151 return WebInputEventResult::NotHandled;
1152 } 1152 }
1153 1153
1154 WebInputEventResult WebViewImpl::handleCharEvent(const WebKeyboardEvent& event) 1154 WebInputEventResult WebViewImpl::handleCharEvent(const WebKeyboardEvent& event)
1155 { 1155 {
1156 ASSERT(event.type == WebInputEvent::Char); 1156 DCHECK_EQ(event.type, WebInputEvent::Char);
1157 TRACE_EVENT1("input", "WebViewImpl::handleCharEvent", 1157 TRACE_EVENT1("input", "WebViewImpl::handleCharEvent",
1158 "text", String(event.text).utf8()); 1158 "text", String(event.text).utf8());
1159 1159
1160 // Please refer to the comments explaining the m_suppressNextKeypressEvent 1160 // Please refer to the comments explaining the m_suppressNextKeypressEvent
1161 // member. The m_suppressNextKeypressEvent is set if the KeyDown is 1161 // member. The m_suppressNextKeypressEvent is set if the KeyDown is
1162 // handled by Webkit. A keyDown event is typically associated with a 1162 // handled by Webkit. A keyDown event is typically associated with a
1163 // keyPress(char) event and a keyUp event. We reset this flag here as it 1163 // keyPress(char) event and a keyUp event. We reset this flag here as it
1164 // only applies to the current keyPress event. 1164 // only applies to the current keyPress event.
1165 bool suppress = m_suppressNextKeypressEvent; 1165 bool suppress = m_suppressNextKeypressEvent;
1166 m_suppressNextKeypressEvent = false; 1166 m_suppressNextKeypressEvent = false;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1251
1252 const int maximumRightMargin = maxSize.width - (source.width + absoluteSourc eX); 1252 const int maximumRightMargin = maxSize.width - (source.width + absoluteSourc eX);
1253 if (rightMargin > maximumRightMargin) { 1253 if (rightMargin > maximumRightMargin) {
1254 rightMargin = maximumRightMargin; 1254 rightMargin = maximumRightMargin;
1255 leftMargin = std::min(leftMargin, std::max(rightMargin, minimumMargin)); 1255 leftMargin = std::min(leftMargin, std::max(rightMargin, minimumMargin));
1256 } 1256 }
1257 1257
1258 const int newWidth = source.width + leftMargin + rightMargin; 1258 const int newWidth = source.width + leftMargin + rightMargin;
1259 const int newX = source.x - leftMargin; 1259 const int newX = source.x - leftMargin;
1260 1260
1261 ASSERT(newWidth >= 0); 1261 DCHECK_GE(newWidth, 0);
1262 ASSERT(scrollOffset.width() + newX + newWidth <= maxSize.width); 1262 DCHECK_LE(scrollOffset.width() + newX + newWidth, maxSize.width);
1263 1263
1264 return WebRect(newX, source.y, newWidth, source.height); 1264 return WebRect(newX, source.y, newWidth, source.height);
1265 } 1265 }
1266 1266
1267 float WebViewImpl::maximumLegiblePageScale() const 1267 float WebViewImpl::maximumLegiblePageScale() const
1268 { 1268 {
1269 // Pages should be as legible as on desktop when at dpi scale, so no 1269 // Pages should be as legible as on desktop when at dpi scale, so no
1270 // need to zoom in further when automatically determining zoom level 1270 // need to zoom in further when automatically determining zoom level
1271 // (after double tap, find in page, etc), though the user should still 1271 // (after double tap, find in page, etc), though the user should still
1272 // be allowed to manually pinch zoom in further if they desire. 1272 // be allowed to manually pinch zoom in further if they desire.
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 break; 1677 break;
1678 default: 1678 default:
1679 return false; 1679 return false;
1680 } 1680 }
1681 1681
1682 return true; 1682 return true;
1683 } 1683 }
1684 1684
1685 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client) 1685 PagePopup* WebViewImpl::openPagePopup(PagePopupClient* client)
1686 { 1686 {
1687 ASSERT(client); 1687 DCHECK(client);
1688 if (hasOpenedPopup()) 1688 if (hasOpenedPopup())
1689 hidePopups(); 1689 hidePopups();
1690 ASSERT(!m_pagePopup); 1690 DCHECK(!m_pagePopup);
1691 1691
1692 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage); 1692 WebWidget* popupWidget = m_client->createPopupMenu(WebPopupTypePage);
1693 // createPopupMenu returns nullptr if this renderer process is about to die. 1693 // createPopupMenu returns nullptr if this renderer process is about to die.
1694 if (!popupWidget) 1694 if (!popupWidget)
1695 return nullptr; 1695 return nullptr;
1696 m_pagePopup = toWebPagePopupImpl(popupWidget); 1696 m_pagePopup = toWebPagePopupImpl(popupWidget);
1697 if (!m_pagePopup->initialize(this, client)) { 1697 if (!m_pagePopup->initialize(this, client)) {
1698 m_pagePopup->closePopup(); 1698 m_pagePopup->closePopup();
1699 m_pagePopup = nullptr; 1699 m_pagePopup = nullptr;
1700 } 1700 }
1701 enablePopupMouseWheelEventListener(); 1701 enablePopupMouseWheelEventListener();
1702 return m_pagePopup.get(); 1702 return m_pagePopup.get();
1703 } 1703 }
1704 1704
1705 void WebViewImpl::closePagePopup(PagePopup* popup) 1705 void WebViewImpl::closePagePopup(PagePopup* popup)
1706 { 1706 {
1707 ASSERT(popup); 1707 DCHECK(popup);
1708 WebPagePopupImpl* popupImpl = toWebPagePopupImpl(popup); 1708 WebPagePopupImpl* popupImpl = toWebPagePopupImpl(popup);
1709 ASSERT(m_pagePopup.get() == popupImpl); 1709 DCHECK_EQ(m_pagePopup.get(), popupImpl);
1710 if (m_pagePopup.get() != popupImpl) 1710 if (m_pagePopup.get() != popupImpl)
1711 return; 1711 return;
1712 m_pagePopup->closePopup(); 1712 m_pagePopup->closePopup();
1713 } 1713 }
1714 1714
1715 void WebViewImpl::cleanupPagePopup() 1715 void WebViewImpl::cleanupPagePopup()
1716 { 1716 {
1717 m_pagePopup = nullptr; 1717 m_pagePopup = nullptr;
1718 disablePopupMouseWheelEventListener(); 1718 disablePopupMouseWheelEventListener();
1719 } 1719 }
1720 1720
1721 void WebViewImpl::cancelPagePopup() 1721 void WebViewImpl::cancelPagePopup()
1722 { 1722 {
1723 if (m_pagePopup) 1723 if (m_pagePopup)
1724 m_pagePopup->cancel(); 1724 m_pagePopup->cancel();
1725 } 1725 }
1726 1726
1727 void WebViewImpl::enablePopupMouseWheelEventListener() 1727 void WebViewImpl::enablePopupMouseWheelEventListener()
1728 { 1728 {
1729 // TODO(kenrb): Popup coordination for out-of-process iframes needs to be 1729 // TODO(kenrb): Popup coordination for out-of-process iframes needs to be
1730 // added. Because of the early return here a select element 1730 // added. Because of the early return here a select element
1731 // popup can remain visible even when the element underneath it is 1731 // popup can remain visible even when the element underneath it is
1732 // scrolled to a new position. This is part of a larger set of issues with 1732 // scrolled to a new position. This is part of a larger set of issues with
1733 // popups. 1733 // popups.
1734 // See https://crbug.com/566130 1734 // See https://crbug.com/566130
1735 if (!mainFrameImpl() || !mainFrameImpl()->frame()->isLocalFrame()) 1735 if (!mainFrameImpl() || !mainFrameImpl()->frame()->isLocalFrame())
1736 return; 1736 return;
1737 ASSERT(!m_popupMouseWheelEventListener); 1737 DCHECK(!m_popupMouseWheelEventListener);
1738 Document* document = mainFrameImpl()->frame()->document(); 1738 Document* document = mainFrameImpl()->frame()->document();
1739 ASSERT(document); 1739 DCHECK(document);
1740 // We register an empty event listener, EmptyEventListener, so that mouse 1740 // We register an empty event listener, EmptyEventListener, so that mouse
1741 // wheel events get sent to the WebView. 1741 // wheel events get sent to the WebView.
1742 m_popupMouseWheelEventListener = EmptyEventListener::create(); 1742 m_popupMouseWheelEventListener = EmptyEventListener::create();
1743 document->addEventListener(EventTypeNames::mousewheel, m_popupMouseWheelEven tListener, false); 1743 document->addEventListener(EventTypeNames::mousewheel, m_popupMouseWheelEven tListener, false);
1744 } 1744 }
1745 1745
1746 void WebViewImpl::disablePopupMouseWheelEventListener() 1746 void WebViewImpl::disablePopupMouseWheelEventListener()
1747 { 1747 {
1748 // TODO(kenrb): Concerns the same as in enablePopupMouseWheelEventListener. 1748 // TODO(kenrb): Concerns the same as in enablePopupMouseWheelEventListener.
1749 // See https://crbug.com/566130 1749 // See https://crbug.com/566130
1750 if (!mainFrameImpl() || !mainFrameImpl()->frame()->isLocalFrame()) 1750 if (!mainFrameImpl() || !mainFrameImpl()->frame()->isLocalFrame())
1751 return; 1751 return;
1752 ASSERT(m_popupMouseWheelEventListener); 1752 DCHECK(m_popupMouseWheelEventListener);
1753 Document* document = mainFrameImpl()->frame()->document(); 1753 Document* document = mainFrameImpl()->frame()->document();
1754 ASSERT(document); 1754 DCHECK(document);
1755 // Document may have already removed the event listener, for instance, due 1755 // Document may have already removed the event listener, for instance, due
1756 // to a navigation, but remove it anyway. 1756 // to a navigation, but remove it anyway.
1757 document->removeEventListener(EventTypeNames::mousewheel, m_popupMouseWheelE ventListener.release(), false); 1757 document->removeEventListener(EventTypeNames::mousewheel, m_popupMouseWheelE ventListener.release(), false);
1758 } 1758 }
1759 1759
1760 LocalDOMWindow* WebViewImpl::pagePopupWindow() const 1760 LocalDOMWindow* WebViewImpl::pagePopupWindow() const
1761 { 1761 {
1762 return m_pagePopup ? m_pagePopup->window() : nullptr; 1762 return m_pagePopup ? m_pagePopup->window() : nullptr;
1763 } 1763 }
1764 1764
1765 Frame* WebViewImpl::focusedCoreFrame() const 1765 Frame* WebViewImpl::focusedCoreFrame() const
1766 { 1766 {
1767 return m_page ? m_page->focusController().focusedOrMainFrame() : nullptr; 1767 return m_page ? m_page->focusController().focusedOrMainFrame() : nullptr;
1768 } 1768 }
1769 1769
1770 WebViewImpl* WebViewImpl::fromPage(Page* page) 1770 WebViewImpl* WebViewImpl::fromPage(Page* page)
1771 { 1771 {
1772 return page ? static_cast<WebViewImpl*>(page->chromeClient().webView()) : nu llptr; 1772 return page ? static_cast<WebViewImpl*>(page->chromeClient().webView()) : nu llptr;
1773 } 1773 }
1774 1774
1775 // WebWidget ------------------------------------------------------------------ 1775 // WebWidget ------------------------------------------------------------------
1776 1776
1777 void WebViewImpl::close() 1777 void WebViewImpl::close()
1778 { 1778 {
1779 WebDevToolsAgentImpl::webViewImplClosed(this); 1779 WebDevToolsAgentImpl::webViewImplClosed(this);
1780 ASSERT(allInstances().contains(this)); 1780 DCHECK(allInstances().contains(this));
1781 allInstances().remove(this); 1781 allInstances().remove(this);
1782 1782
1783 if (m_page) { 1783 if (m_page) {
1784 // Initiate shutdown for the entire frameset. This will cause a lot of 1784 // Initiate shutdown for the entire frameset. This will cause a lot of
1785 // notifications to be sent. 1785 // notifications to be sent.
1786 m_page->willBeDestroyed(); 1786 m_page->willBeDestroyed();
1787 m_page.clear(); 1787 m_page.clear();
1788 } 1788 }
1789 1789
1790 // Reset the delegate to prevent notifications being sent as we're being 1790 // Reset the delegate to prevent notifications being sent as we're being
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment / minim umPageScaleFactor()); 1862 view->setTopControlsViewportAdjustment(topControlsViewportAdjustment / minim umPageScaleFactor());
1863 } 1863 }
1864 1864
1865 TopControls& WebViewImpl::topControls() 1865 TopControls& WebViewImpl::topControls()
1866 { 1866 {
1867 return page()->frameHost().topControls(); 1867 return page()->frameHost().topControls();
1868 } 1868 }
1869 1869
1870 void WebViewImpl::resizeViewWhileAnchored(FrameView* view) 1870 void WebViewImpl::resizeViewWhileAnchored(FrameView* view)
1871 { 1871 {
1872 ASSERT(mainFrameImpl() && mainFrameImpl()->frame()->isLocalFrame()); 1872 DCHECK(mainFrameImpl() && mainFrameImpl()->frame()->isLocalFrame());
tkent 2016/03/31 23:05:21 Please split this into two. DCHECK(mainFrameIm
1873 1873
1874 { 1874 {
1875 // Avoids unnecessary invalidations while various bits of state in TextA utosizer are updated. 1875 // Avoids unnecessary invalidations while various bits of state in TextA utosizer are updated.
1876 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); 1876 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page());
1877 performResize(); 1877 performResize();
1878 } 1878 }
1879 1879
1880 m_fullscreenController->updateSize(); 1880 m_fullscreenController->updateSize();
1881 1881
1882 // Update lifecyle phases immediately to recalculate the minimum scale limit for rotation anchoring, 1882 // Update lifecyle phases immediately to recalculate the minimum scale limit for rotation anchoring,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 } 1931 }
1932 1932
1933 void WebViewImpl::didExitFullScreen() 1933 void WebViewImpl::didExitFullScreen()
1934 { 1934 {
1935 m_fullscreenController->didExitFullScreen(); 1935 m_fullscreenController->didExitFullScreen();
1936 } 1936 }
1937 1937
1938 void WebViewImpl::beginFrame(double lastFrameTimeMonotonic) 1938 void WebViewImpl::beginFrame(double lastFrameTimeMonotonic)
1939 { 1939 {
1940 TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime", lastFrameTimeM onotonic); 1940 TRACE_EVENT1("blink", "WebViewImpl::beginFrame", "frameTime", lastFrameTimeM onotonic);
1941 ASSERT(lastFrameTimeMonotonic); 1941 DCHECK(lastFrameTimeMonotonic);
1942 1942
1943 // Create synthetic wheel events as necessary for fling. 1943 // Create synthetic wheel events as necessary for fling.
1944 if (m_gestureAnimation) { 1944 if (m_gestureAnimation) {
1945 if (m_gestureAnimation->animate(lastFrameTimeMonotonic)) 1945 if (m_gestureAnimation->animate(lastFrameTimeMonotonic))
1946 scheduleAnimation(); 1946 scheduleAnimation();
1947 else { 1947 else {
1948 ASSERT(m_flingSourceDevice != WebGestureDeviceUninitialized); 1948 DCHECK_NE(m_flingSourceDevice, WebGestureDeviceUninitialized);
1949 WebGestureDevice lastFlingSourceDevice = m_flingSourceDevice; 1949 WebGestureDevice lastFlingSourceDevice = m_flingSourceDevice;
1950 endActiveFlingAnimation(); 1950 endActiveFlingAnimation();
1951 1951
1952 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd, 1952 PlatformGestureEvent endScrollEvent(PlatformEvent::GestureScrollEnd,
1953 m_positionOnFlingStart, m_globalPositionOnFlingStart, 1953 m_positionOnFlingStart, m_globalPositionOnFlingStart,
1954 IntSize(), 0, PlatformEvent::NoModifiers, lastFlingSourceDevice == WebGestureDeviceTouchpad ? PlatformGestureSourceTouchpad : PlatformGestureSou rceTouchscreen); 1954 IntSize(), 0, PlatformEvent::NoModifiers, lastFlingSourceDevice == WebGestureDeviceTouchpad ? PlatformGestureSourceTouchpad : PlatformGestureSou rceTouchscreen);
1955 endScrollEvent.setScrollGestureData(0, 0, ScrollByPrecisePixel, 0, 0 , true, false, -1 /* null plugin id */); 1955 endScrollEvent.setScrollGestureData(0, 0, ScrollByPrecisePixel, 0, 0 , true, false, -1 /* null plugin id */);
1956 1956
1957 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent); 1957 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEnd(endS crollEvent);
1958 } 1958 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 m_shouldDispatchFirstLayoutAfterFinishedLoading = false; 2009 m_shouldDispatchFirstLayoutAfterFinishedLoading = false;
2010 client()->didMeaningfulLayout(WebMeaningfulLayout::FinishedLoading); 2010 client()->didMeaningfulLayout(WebMeaningfulLayout::FinishedLoading);
2011 } 2011 }
2012 } 2012 }
2013 } 2013 }
2014 2014
2015 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) 2015 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
2016 { 2016 {
2017 // This should only be used when compositing is not being used for this 2017 // This should only be used when compositing is not being used for this
2018 // WebView, and it is painting into the recording of its parent. 2018 // WebView, and it is painting into the recording of its parent.
2019 ASSERT(!isAcceleratedCompositingActive()); 2019 DCHECK(!isAcceleratedCompositingActive());
2020 2020
2021 double paintStart = currentTime(); 2021 double paintStart = currentTime();
2022 PageWidgetDelegate::paint(*m_page, canvas, rect, *m_page->deprecatedLocalMai nFrame()); 2022 PageWidgetDelegate::paint(*m_page, canvas, rect, *m_page->deprecatedLocalMai nFrame());
2023 double paintEnd = currentTime(); 2023 double paintEnd = currentTime();
2024 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); 2024 double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart);
2025 DEFINE_STATIC_LOCAL(CustomCountHistogram, softwarePaintDurationHistogram, (" Renderer4.SoftwarePaintDurationMS", 0, 120, 30)); 2025 DEFINE_STATIC_LOCAL(CustomCountHistogram, softwarePaintDurationHistogram, (" Renderer4.SoftwarePaintDurationMS", 0, 120, 30));
2026 softwarePaintDurationHistogram.count((paintEnd - paintStart) * 1000); 2026 softwarePaintDurationHistogram.count((paintEnd - paintStart) * 1000);
2027 DEFINE_STATIC_LOCAL(CustomCountHistogram, softwarePaintRateHistogram, ("Rend erer4.SoftwarePaintMegapixPerSecond", 10, 210, 30)); 2027 DEFINE_STATIC_LOCAL(CustomCountHistogram, softwarePaintRateHistogram, ("Rend erer4.SoftwarePaintMegapixPerSecond", 10, 210, 30));
2028 softwarePaintRateHistogram.count(pixelsPerSec / 1000000); 2028 softwarePaintRateHistogram.count(pixelsPerSec / 1000000);
2029 } 2029 }
2030 2030
2031 #if OS(ANDROID) 2031 #if OS(ANDROID)
2032 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re ct) 2032 void WebViewImpl::paintCompositedDeprecated(WebCanvas* canvas, const WebRect& re ct)
2033 { 2033 {
2034 // Note: This method exists on OS(ANDROID) and will hopefully be 2034 // Note: This method exists on OS(ANDROID) and will hopefully be
2035 // removed once the link disambiguation feature renders using 2035 // removed once the link disambiguation feature renders using
2036 // the compositor. 2036 // the compositor.
2037 ASSERT(isAcceleratedCompositingActive()); 2037 DCHECK(isAcceleratedCompositingActive());
2038 2038
2039 PageWidgetDelegate::paintIgnoringCompositing(*m_page, canvas, rect, *m_page- >deprecatedLocalMainFrame()); 2039 PageWidgetDelegate::paintIgnoringCompositing(*m_page, canvas, rect, *m_page- >deprecatedLocalMainFrame());
2040 } 2040 }
2041 #endif 2041 #endif
2042 2042
2043 void WebViewImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* callback) 2043 void WebViewImpl::layoutAndPaintAsync(WebLayoutAndPaintAsyncCallback* callback)
2044 { 2044 {
2045 m_layerTreeView->layoutAndPaintAsync(callback); 2045 m_layerTreeView->layoutAndPaintAsync(callback);
2046 } 2046 }
2047 2047
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 2389
2390 LocalFrame* focused = toLocalFrame(frame); 2390 LocalFrame* focused = toLocalFrame(frame);
2391 if (!focused || !m_imeAcceptEvents) 2391 if (!focused || !m_imeAcceptEvents)
2392 return false; 2392 return false;
2393 2393
2394 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange(); 2394 const EphemeralRange range = focused->inputMethodController().compositionEph emeralRange();
2395 if (range.isNull()) 2395 if (range.isNull())
2396 return false; 2396 return false;
2397 2397
2398 Element* editable = focused->selection().rootEditableElementOrDocumentElemen t(); 2398 Element* editable = focused->selection().rootEditableElementOrDocumentElemen t();
2399 ASSERT(editable); 2399 DCHECK(editable);
2400 PlainTextRange plainTextRange(PlainTextRange::create(*editable, range)); 2400 PlainTextRange plainTextRange(PlainTextRange::create(*editable, range));
2401 if (plainTextRange.isNull()) 2401 if (plainTextRange.isNull())
2402 return false; 2402 return false;
2403 *location = plainTextRange.start(); 2403 *location = plainTextRange.start();
2404 *length = plainTextRange.length(); 2404 *length = plainTextRange.length();
2405 return true; 2405 return true;
2406 } 2406 }
2407 2407
2408 WebTextInputInfo WebViewImpl::textInputInfo() 2408 WebTextInputInfo WebViewImpl::textInputInfo()
2409 { 2409 {
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2787 if (mainFrameImpl()->frameView()) 2787 if (mainFrameImpl()->frameView())
2788 mainFrameImpl()->frameView()->windowResizerRectChanged(); 2788 mainFrameImpl()->frameView()->windowResizerRectChanged();
2789 } 2789 }
2790 2790
2791 // WebView -------------------------------------------------------------------- 2791 // WebView --------------------------------------------------------------------
2792 2792
2793 WebSettingsImpl* WebViewImpl::settingsImpl() 2793 WebSettingsImpl* WebViewImpl::settingsImpl()
2794 { 2794 {
2795 if (!m_webSettings) 2795 if (!m_webSettings)
2796 m_webSettings = adoptPtr(new WebSettingsImpl(&m_page->settings(), m_devT oolsEmulator.get())); 2796 m_webSettings = adoptPtr(new WebSettingsImpl(&m_page->settings(), m_devT oolsEmulator.get()));
2797 ASSERT(m_webSettings); 2797 DCHECK(m_webSettings);
2798 return m_webSettings.get(); 2798 return m_webSettings.get();
2799 } 2799 }
2800 2800
2801 WebSettings* WebViewImpl::settings() 2801 WebSettings* WebViewImpl::settings()
2802 { 2802 {
2803 return settingsImpl(); 2803 return settingsImpl();
2804 } 2804 }
2805 2805
2806 WebString WebViewImpl::pageEncoding() const 2806 WebString WebViewImpl::pageEncoding() const
2807 { 2807 {
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
3126 return page()->frameHost().visualViewport().scale(); 3126 return page()->frameHost().visualViewport().scale();
3127 } 3127 }
3128 3128
3129 float WebViewImpl::clampPageScaleFactorToLimits(float scaleFactor) const 3129 float WebViewImpl::clampPageScaleFactorToLimits(float scaleFactor) const
3130 { 3130 {
3131 return pageScaleConstraintsSet().finalConstraints().clampToConstraints(scale Factor); 3131 return pageScaleConstraintsSet().finalConstraints().clampToConstraints(scale Factor);
3132 } 3132 }
3133 3133
3134 void WebViewImpl::setVisualViewportOffset(const WebFloatPoint& offset) 3134 void WebViewImpl::setVisualViewportOffset(const WebFloatPoint& offset)
3135 { 3135 {
3136 ASSERT(page()); 3136 DCHECK(page());
3137 page()->frameHost().visualViewport().setLocation(offset); 3137 page()->frameHost().visualViewport().setLocation(offset);
3138 } 3138 }
3139 3139
3140 WebFloatPoint WebViewImpl::visualViewportOffset() const 3140 WebFloatPoint WebViewImpl::visualViewportOffset() const
3141 { 3141 {
3142 ASSERT(page()); 3142 DCHECK(page());
3143 return page()->frameHost().visualViewport().visibleRect().location(); 3143 return page()->frameHost().visualViewport().visibleRect().location();
3144 } 3144 }
3145 3145
3146 WebFloatSize WebViewImpl::visualViewportSize() const 3146 WebFloatSize WebViewImpl::visualViewportSize() const
3147 { 3147 {
3148 ASSERT(page()); 3148 DCHECK(page());
3149 return page()->frameHost().visualViewport().visibleRect().size(); 3149 return page()->frameHost().visualViewport().visibleRect().size();
3150 } 3150 }
3151 3151
3152 void WebViewImpl::scrollAndRescaleViewports(float scaleFactor, 3152 void WebViewImpl::scrollAndRescaleViewports(float scaleFactor,
3153 const IntPoint& mainFrameOrigin, 3153 const IntPoint& mainFrameOrigin,
3154 const FloatPoint& visualViewportOrigin) 3154 const FloatPoint& visualViewportOrigin)
3155 { 3155 {
3156 if (!page()) 3156 if (!page())
3157 return; 3157 return;
3158 3158
3159 if (!mainFrameImpl()) 3159 if (!mainFrameImpl())
3160 return; 3160 return;
3161 3161
3162 FrameView * view = mainFrameImpl()->frameView(); 3162 FrameView * view = mainFrameImpl()->frameView();
3163 if (!view) 3163 if (!view)
3164 return; 3164 return;
3165 3165
3166 // Order is important: visual viewport location is clamped based on 3166 // Order is important: visual viewport location is clamped based on
3167 // main frame scroll position and visual viewport scale. 3167 // main frame scroll position and visual viewport scale.
3168 3168
3169 view->setScrollPosition(mainFrameOrigin, ProgrammaticScroll); 3169 view->setScrollPosition(mainFrameOrigin, ProgrammaticScroll);
3170 3170
3171 setPageScaleFactor(scaleFactor); 3171 setPageScaleFactor(scaleFactor);
3172 3172
3173 page()->frameHost().visualViewport().setLocation(visualViewportOrigin); 3173 page()->frameHost().visualViewport().setLocation(visualViewportOrigin);
3174 } 3174 }
3175 3175
3176 void WebViewImpl::setPageScaleFactorAndLocation(float scaleFactor, const FloatPo int& location) 3176 void WebViewImpl::setPageScaleFactorAndLocation(float scaleFactor, const FloatPo int& location)
3177 { 3177 {
3178 ASSERT(page()); 3178 DCHECK(page());
3179 3179
3180 page()->frameHost().visualViewport().setScaleAndLocation( 3180 page()->frameHost().visualViewport().setScaleAndLocation(
3181 clampPageScaleFactorToLimits(scaleFactor), 3181 clampPageScaleFactorToLimits(scaleFactor),
3182 location); 3182 location);
3183 } 3183 }
3184 3184
3185 void WebViewImpl::setPageScaleFactor(float scaleFactor) 3185 void WebViewImpl::setPageScaleFactor(float scaleFactor)
3186 { 3186 {
3187 ASSERT(page()); 3187 DCHECK(page());
3188 3188
3189 scaleFactor = clampPageScaleFactorToLimits(scaleFactor); 3189 scaleFactor = clampPageScaleFactorToLimits(scaleFactor);
3190 if (scaleFactor == pageScaleFactor()) 3190 if (scaleFactor == pageScaleFactor())
3191 return; 3191 return;
3192 3192
3193 page()->frameHost().visualViewport().setScale(scaleFactor); 3193 page()->frameHost().visualViewport().setScale(scaleFactor);
3194 } 3194 }
3195 3195
3196 void WebViewImpl::setDeviceScaleFactor(float scaleFactor) 3196 void WebViewImpl::setDeviceScaleFactor(float scaleFactor)
3197 { 3197 {
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
3614 } 3614 }
3615 } 3615 }
3616 3616
3617 WebDragOperation WebViewImpl::dragTargetDragEnter( 3617 WebDragOperation WebViewImpl::dragTargetDragEnter(
3618 const WebDragData& webDragData, 3618 const WebDragData& webDragData,
3619 const WebPoint& clientPoint, 3619 const WebPoint& clientPoint,
3620 const WebPoint& screenPoint, 3620 const WebPoint& screenPoint,
3621 WebDragOperationsMask operationsAllowed, 3621 WebDragOperationsMask operationsAllowed,
3622 int modifiers) 3622 int modifiers)
3623 { 3623 {
3624 ASSERT(!m_currentDragData); 3624 DCHECK(!m_currentDragData);
3625 3625
3626 m_currentDragData = DataObject::create(webDragData); 3626 m_currentDragData = DataObject::create(webDragData);
3627 m_operationsAllowed = operationsAllowed; 3627 m_operationsAllowed = operationsAllowed;
3628 3628
3629 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, modifi ers); 3629 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragEnter, modifi ers);
3630 } 3630 }
3631 3631
3632 WebDragOperation WebViewImpl::dragTargetDragOver( 3632 WebDragOperation WebViewImpl::dragTargetDragOver(
3633 const WebPoint& clientPoint, 3633 const WebPoint& clientPoint,
3634 const WebPoint& screenPoint, 3634 const WebPoint& screenPoint,
3635 WebDragOperationsMask operationsAllowed, 3635 WebDragOperationsMask operationsAllowed,
3636 int modifiers) 3636 int modifiers)
3637 { 3637 {
3638 m_operationsAllowed = operationsAllowed; 3638 m_operationsAllowed = operationsAllowed;
3639 3639
3640 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, modifie rs); 3640 return dragTargetDragEnterOrOver(clientPoint, screenPoint, DragOver, modifie rs);
3641 } 3641 }
3642 3642
3643 void WebViewImpl::dragTargetDragLeave() 3643 void WebViewImpl::dragTargetDragLeave()
3644 { 3644 {
3645 ASSERT(m_currentDragData); 3645 DCHECK(m_currentDragData);
3646 3646
3647 DragData dragData( 3647 DragData dragData(
3648 m_currentDragData.get(), 3648 m_currentDragData.get(),
3649 IntPoint(), 3649 IntPoint(),
3650 IntPoint(), 3650 IntPoint(),
3651 static_cast<DragOperation>(m_operationsAllowed)); 3651 static_cast<DragOperation>(m_operationsAllowed));
3652 3652
3653 m_page->dragController().dragExited(&dragData); 3653 m_page->dragController().dragExited(&dragData);
3654 3654
3655 // FIXME: why is the drag scroll timer not stopped here? 3655 // FIXME: why is the drag scroll timer not stopped here?
3656 3656
3657 m_dragOperation = WebDragOperationNone; 3657 m_dragOperation = WebDragOperationNone;
3658 m_currentDragData = nullptr; 3658 m_currentDragData = nullptr;
3659 } 3659 }
3660 3660
3661 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, 3661 void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint,
3662 const WebPoint& screenPoint, 3662 const WebPoint& screenPoint,
3663 int modifiers) 3663 int modifiers)
3664 { 3664 {
3665 ASSERT(m_currentDragData); 3665 DCHECK(m_currentDragData);
3666 3666
3667 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof illClient() : 0; 3667 WebAutofillClient* autofillClient = mainFrameImpl() ? mainFrameImpl()->autof illClient() : 0;
3668 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved); 3668 UserGestureNotifier notifier(autofillClient, &m_userGestureObserved);
3669 3669
3670 // If this webview transitions from the "drop accepting" state to the "not 3670 // If this webview transitions from the "drop accepting" state to the "not
3671 // accepting" state, then our IPC message reply indicating that may be in- 3671 // accepting" state, then our IPC message reply indicating that may be in-
3672 // flight, or else delayed by javascript processing in this webview. If a 3672 // flight, or else delayed by javascript processing in this webview. If a
3673 // drop happens before our IPC reply has reached the browser process, then 3673 // drop happens before our IPC reply has reached the browser process, then
3674 // the browser forwards the drop to this webview. So only allow a drop to 3674 // the browser forwards the drop to this webview. So only allow a drop to
3675 // proceed if our webview m_dragOperation state is not DragOperationNone. 3675 // proceed if our webview m_dragOperation state is not DragOperationNone.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3712 convertedWords.append(words.data(), words.size()); 3712 convertedWords.append(words.data(), words.size());
3713 3713
3714 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) { 3714 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
3715 if (frame->isLocalFrame()) 3715 if (frame->isLocalFrame())
3716 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords) ; 3716 toLocalFrame(frame)->removeSpellingMarkersUnderWords(convertedWords) ;
3717 } 3717 }
3718 } 3718 }
3719 3719
3720 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo int, const WebPoint& screenPoint, DragAction dragAction, int modifiers) 3720 WebDragOperation WebViewImpl::dragTargetDragEnterOrOver(const WebPoint& clientPo int, const WebPoint& screenPoint, DragAction dragAction, int modifiers)
3721 { 3721 {
3722 ASSERT(m_currentDragData); 3722 DCHECK(m_currentDragData);
3723 3723
3724 m_currentDragData->setModifiers(modifiers); 3724 m_currentDragData->setModifiers(modifiers);
3725 DragData dragData( 3725 DragData dragData(
3726 m_currentDragData.get(), 3726 m_currentDragData.get(),
3727 clientPoint, 3727 clientPoint,
3728 screenPoint, 3728 screenPoint,
3729 static_cast<DragOperation>(m_operationsAllowed)); 3729 static_cast<DragOperation>(m_operationsAllowed));
3730 3730
3731 DragSession dragSession; 3731 DragSession dragSession;
3732 if (dragAction == DragEnter) 3732 if (dragAction == DragEnter)
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
4124 } 4124 }
4125 4125
4126 void WebViewImpl::startDragging(LocalFrame* frame, 4126 void WebViewImpl::startDragging(LocalFrame* frame,
4127 const WebDragData& dragData, 4127 const WebDragData& dragData,
4128 WebDragOperationsMask mask, 4128 WebDragOperationsMask mask,
4129 const WebImage& dragImage, 4129 const WebImage& dragImage,
4130 const WebPoint& dragImageOffset) 4130 const WebPoint& dragImageOffset)
4131 { 4131 {
4132 if (!m_client) 4132 if (!m_client)
4133 return; 4133 return;
4134 ASSERT(!m_doingDragAndDrop); 4134 DCHECK(!m_doingDragAndDrop);
4135 m_doingDragAndDrop = true; 4135 m_doingDragAndDrop = true;
4136 m_client->startDragging(WebLocalFrameImpl::fromFrame(frame), dragData, mask, dragImage, dragImageOffset); 4136 m_client->startDragging(WebLocalFrameImpl::fromFrame(frame), dragData, mask, dragImage, dragImageOffset);
4137 } 4137 }
4138 4138
4139 void WebViewImpl::setIgnoreInputEvents(bool newValue) 4139 void WebViewImpl::setIgnoreInputEvents(bool newValue)
4140 { 4140 {
4141 ASSERT(m_ignoreInputEvents != newValue); 4141 DCHECK_NE(m_ignoreInputEvents, newValue);
4142 m_ignoreInputEvents = newValue; 4142 m_ignoreInputEvents = newValue;
4143 } 4143 }
4144 4144
4145 void WebViewImpl::setBackgroundColorOverride(WebColor color) 4145 void WebViewImpl::setBackgroundColorOverride(WebColor color)
4146 { 4146 {
4147 m_backgroundColorOverride = color; 4147 m_backgroundColorOverride = color;
4148 updateLayerTreeBackgroundColor(); 4148 updateLayerTreeBackgroundColor();
4149 } 4149 }
4150 4150
4151 void WebViewImpl::setZoomFactorOverride(float zoomFactor) 4151 void WebViewImpl::setZoomFactorOverride(float zoomFactor)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
4233 return m_tabsToLinks; 4233 return m_tabsToLinks;
4234 } 4234 }
4235 4235
4236 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) 4236 void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer)
4237 { 4237 {
4238 if (!m_layerTreeView) 4238 if (!m_layerTreeView)
4239 return; 4239 return;
4240 4240
4241 // In SPv2, we attach layers via PaintArtifactCompositor, rather than 4241 // In SPv2, we attach layers via PaintArtifactCompositor, rather than
4242 // supplying a root GraphicsLayer from PaintLayerCompositor. 4242 // supplying a root GraphicsLayer from PaintLayerCompositor.
4243 ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 4243 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
4244 4244
4245 VisualViewport& visualViewport = page()->frameHost().visualViewport(); 4245 VisualViewport& visualViewport = page()->frameHost().visualViewport();
4246 visualViewport.attachToLayerTree(layer); 4246 visualViewport.attachToLayerTree(layer);
4247 if (layer) { 4247 if (layer) {
4248 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer(); 4248 m_rootGraphicsLayer = visualViewport.rootGraphicsLayer();
4249 m_rootLayer = m_rootGraphicsLayer->platformLayer(); 4249 m_rootLayer = m_rootGraphicsLayer->platformLayer();
4250 updateRootLayerTransform(); 4250 updateRootLayerTransform();
4251 m_layerTreeView->setRootLayer(*m_rootLayer); 4251 m_layerTreeView->setRootLayer(*m_rootLayer);
4252 // We register viewport layers here since there may not be a layer 4252 // We register viewport layers here since there may not be a layer
4253 // tree view prior to this point. 4253 // tree view prior to this point.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
4327 4327
4328 if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl()) 4328 if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl())
4329 devTools->layerTreeViewChanged(m_layerTreeView); 4329 devTools->layerTreeViewChanged(m_layerTreeView);
4330 4330
4331 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView); 4331 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView);
4332 if (m_layerTreeView) 4332 if (m_layerTreeView)
4333 m_page->layerTreeViewInitialized(*m_layerTreeView); 4333 m_page->layerTreeViewInitialized(*m_layerTreeView);
4334 4334
4335 // FIXME: only unittests, click to play, Android printing, and printing (for headers and footers) 4335 // FIXME: only unittests, click to play, Android printing, and printing (for headers and footers)
4336 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView. 4336 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView.
4337 ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew()); 4337 DCHECK(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew());
4338 4338
4339 if (Platform::current()->isThreadedAnimationEnabled() && m_layerTreeView) { 4339 if (Platform::current()->isThreadedAnimationEnabled() && m_layerTreeView) {
4340 m_linkHighlightsTimeline = adoptPtr(CompositorFactory::current().createA nimationTimeline()); 4340 m_linkHighlightsTimeline = adoptPtr(CompositorFactory::current().createA nimationTimeline());
4341 attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); 4341 attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get());
4342 } 4342 }
4343 4343
4344 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 4344 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
4345 attachPaintArtifactCompositor(); 4345 attachPaintArtifactCompositor();
4346 } 4346 }
4347 4347
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 void WebViewImpl::updateLayerTreeBackgroundColor() 4416 void WebViewImpl::updateLayerTreeBackgroundColor()
4417 { 4417 {
4418 if (!m_layerTreeView) 4418 if (!m_layerTreeView)
4419 return; 4419 return;
4420 4420
4421 m_layerTreeView->setBackgroundColor(alphaChannel(m_backgroundColorOverride) ? m_backgroundColorOverride : backgroundColor()); 4421 m_layerTreeView->setBackgroundColor(alphaChannel(m_backgroundColorOverride) ? m_backgroundColorOverride : backgroundColor());
4422 } 4422 }
4423 4423
4424 void WebViewImpl::updateLayerTreeDeviceScaleFactor() 4424 void WebViewImpl::updateLayerTreeDeviceScaleFactor()
4425 { 4425 {
4426 ASSERT(page()); 4426 DCHECK(page());
4427 ASSERT(m_layerTreeView); 4427 DCHECK(m_layerTreeView);
4428 4428
4429 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit orDeviceScaleFactorOverride : page()->deviceScaleFactor(); 4429 float deviceScaleFactor = m_compositorDeviceScaleFactorOverride ? m_composit orDeviceScaleFactorOverride : page()->deviceScaleFactor();
4430 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 4430 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
4431 } 4431 }
4432 4432
4433 void WebViewImpl::updateRootLayerTransform() 4433 void WebViewImpl::updateRootLayerTransform()
4434 { 4434 {
4435 if (m_rootGraphicsLayer) { 4435 if (m_rootGraphicsLayer) {
4436 TransformationMatrix transform; 4436 TransformationMatrix transform;
4437 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height); 4437 transform.translate(m_rootLayerOffset.width, m_rootLayerOffset.height);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4474 return true; 4474 return true;
4475 } 4475 }
4476 4476
4477 WebViewScheduler* WebViewImpl::scheduler() const 4477 WebViewScheduler* WebViewImpl::scheduler() const
4478 { 4478 {
4479 return m_scheduler.get(); 4479 return m_scheduler.get();
4480 } 4480 }
4481 4481
4482 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, 4482 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState,
4483 bool isInitialState) { 4483 bool isInitialState) {
4484 ASSERT(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere nder); 4484 DCHECK(visibilityState == WebPageVisibilityStateVisible || visibilityState = = WebPageVisibilityStateHidden || visibilityState == WebPageVisibilityStatePrere nder);
4485 4485
4486 if (page()) 4486 if (page())
4487 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState); 4487 m_page->setVisibilityState(static_cast<PageVisibilityState>(static_cast< int>(visibilityState)), isInitialState);
4488 4488
4489 bool visible = visibilityState == WebPageVisibilityStateVisible; 4489 bool visible = visibilityState == WebPageVisibilityStateVisible;
4490 if (m_layerTreeView) 4490 if (m_layerTreeView)
4491 m_layerTreeView->setVisible(visible); 4491 m_layerTreeView->setVisible(visible);
4492 m_scheduler->setPageVisible(visible); 4492 m_scheduler->setPageVisible(visible);
4493 } 4493 }
4494 4494
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
4558 } 4558 }
4559 } 4559 }
4560 4560
4561 void WebViewImpl::attachPaintArtifactCompositor() 4561 void WebViewImpl::attachPaintArtifactCompositor()
4562 { 4562 {
4563 if (!m_layerTreeView) 4563 if (!m_layerTreeView)
4564 return; 4564 return;
4565 4565
4566 // Otherwise, PaintLayerCompositor is expected to supply a root 4566 // Otherwise, PaintLayerCompositor is expected to supply a root
4567 // GraphicsLayer via setRootGraphicsLayer. 4567 // GraphicsLayer via setRootGraphicsLayer.
4568 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 4568 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
4569 4569
4570 // TODO(jbroman): This should probably have hookups for overlays, visual 4570 // TODO(jbroman): This should probably have hookups for overlays, visual
4571 // viewport, etc. 4571 // viewport, etc.
4572 4572
4573 WebLayer* rootLayer = m_paintArtifactCompositor.getWebLayer(); 4573 WebLayer* rootLayer = m_paintArtifactCompositor.getWebLayer();
4574 ASSERT(rootLayer); 4574 DCHECK(rootLayer);
4575 m_layerTreeView->setRootLayer(*rootLayer); 4575 m_layerTreeView->setRootLayer(*rootLayer);
4576 4576
4577 // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it 4577 // TODO(jbroman): This is cargo-culted from setRootGraphicsLayer. Is it
4578 // necessary? 4578 // necessary?
4579 m_layerTreeView->setVisible(page()->isPageVisible()); 4579 m_layerTreeView->setVisible(page()->isPageVisible());
4580 } 4580 }
4581 4581
4582 void WebViewImpl::detachPaintArtifactCompositor() 4582 void WebViewImpl::detachPaintArtifactCompositor()
4583 { 4583 {
4584 if (!m_layerTreeView) 4584 if (!m_layerTreeView)
4585 return; 4585 return;
4586 4586
4587 m_layerTreeView->setDeferCommits(true); 4587 m_layerTreeView->setDeferCommits(true);
4588 m_layerTreeView->clearRootLayer(); 4588 m_layerTreeView->clearRootLayer();
4589 } 4589 }
4590 4590
4591 float WebViewImpl::deviceScaleFactor() const 4591 float WebViewImpl::deviceScaleFactor() const
4592 { 4592 {
4593 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than 4593 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fa ctor rather than
4594 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. 4594 // page's scale factor, which can be 1 in use-zoom-for-dsf mode.
4595 if (!page()) 4595 if (!page())
4596 return 1; 4596 return 1;
4597 4597
4598 return page()->deviceScaleFactor(); 4598 return page()->deviceScaleFactor();
4599 } 4599 }
4600 4600
4601 } // namespace blink 4601 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698