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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 // Change the text zoom level by kTextSizeMultiplierRatio each time the user | 224 // Change the text zoom level by kTextSizeMultiplierRatio each time the user |
225 // zooms text in or out (ie., change by 20%). The min and max values limit | 225 // zooms text in or out (ie., change by 20%). The min and max values limit |
226 // text zoom to half and 3x the original text size. These three values match | 226 // text zoom to half and 3x the original text size. These three values match |
227 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm | 227 // those in Apple's port in WebKit/WebKit/WebView/WebView.mm |
228 const double WebView::textSizeMultiplierRatio = 1.2; | 228 const double WebView::textSizeMultiplierRatio = 1.2; |
229 const double WebView::minTextSizeMultiplier = 0.5; | 229 const double WebView::minTextSizeMultiplier = 0.5; |
230 const double WebView::maxTextSizeMultiplier = 3.0; | 230 const double WebView::maxTextSizeMultiplier = 3.0; |
231 | 231 |
232 // Used to defer all page activity in cases where the embedder wishes to run | 232 // Used to defer all page activity in cases where the embedder wishes to run |
233 // a nested event loop. Using a stack enables nesting of message loop invocation
s. | 233 // a nested event loop. Using a stack enables nesting of message loop |
| 234 // invocations. |
234 static Vector<std::unique_ptr<ScopedPageLoadDeferrer>>& | 235 static Vector<std::unique_ptr<ScopedPageLoadDeferrer>>& |
235 pageLoadDeferrerStack() { | 236 pageLoadDeferrerStack() { |
236 DEFINE_STATIC_LOCAL(Vector<std::unique_ptr<ScopedPageLoadDeferrer>>, | 237 DEFINE_STATIC_LOCAL(Vector<std::unique_ptr<ScopedPageLoadDeferrer>>, |
237 deferrerStack, ()); | 238 deferrerStack, ()); |
238 return deferrerStack; | 239 return deferrerStack; |
239 } | 240 } |
240 | 241 |
241 // Ensure that the WebDragOperation enum values stay in sync with the original | 242 // Ensure that the WebDragOperation enum values stay in sync with the original |
242 // DragOperation constants. | 243 // DragOperation constants. |
243 #define STATIC_ASSERT_ENUM(a, b) \ | 244 #define STATIC_ASSERT_ENUM(a, b) \ |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 } | 550 } |
550 | 551 |
551 PageWidgetEventHandler::handleMouseDown(mainFrame, event); | 552 PageWidgetEventHandler::handleMouseDown(mainFrame, event); |
552 | 553 |
553 if (event.button == WebMouseEvent::Button::Left && m_mouseCaptureNode) | 554 if (event.button == WebMouseEvent::Button::Left && m_mouseCaptureNode) |
554 m_mouseCaptureGestureToken = | 555 m_mouseCaptureGestureToken = |
555 mainFrame.eventHandler().takeLastMouseDownGestureToken(); | 556 mainFrame.eventHandler().takeLastMouseDownGestureToken(); |
556 | 557 |
557 if (m_pagePopup && pagePopup && | 558 if (m_pagePopup && pagePopup && |
558 m_pagePopup->hasSamePopupClient(pagePopup.get())) { | 559 m_pagePopup->hasSamePopupClient(pagePopup.get())) { |
559 // That click triggered a page popup that is the same as the one we just clo
sed. | 560 // That click triggered a page popup that is the same as the one we just |
560 // It needs to be closed. | 561 // closed. It needs to be closed. |
561 cancelPagePopup(); | 562 cancelPagePopup(); |
562 } | 563 } |
563 | 564 |
564 // Dispatch the contextmenu event regardless of if the click was swallowed. | 565 // Dispatch the contextmenu event regardless of if the click was swallowed. |
565 if (!page()->settings().showContextMenuOnMouseUp()) { | 566 if (!page()->settings().showContextMenuOnMouseUp()) { |
566 #if OS(MACOSX) | 567 #if OS(MACOSX) |
567 if (event.button == WebMouseEvent::Button::Right || | 568 if (event.button == WebMouseEvent::Button::Right || |
568 (event.button == WebMouseEvent::Button::Left && | 569 (event.button == WebMouseEvent::Button::Left && |
569 event.modifiers & WebMouseEvent::ControlKey)) | 570 event.modifiers & WebMouseEvent::ControlKey)) |
570 mouseContextMenu(event); | 571 mouseContextMenu(event); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 syntheticWheel.x = m_positionOnFlingStart.x; | 676 syntheticWheel.x = m_positionOnFlingStart.x; |
676 syntheticWheel.y = m_positionOnFlingStart.y; | 677 syntheticWheel.y = m_positionOnFlingStart.y; |
677 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; | 678 syntheticWheel.globalX = m_globalPositionOnFlingStart.x; |
678 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; | 679 syntheticWheel.globalY = m_globalPositionOnFlingStart.y; |
679 syntheticWheel.modifiers = m_flingModifier; | 680 syntheticWheel.modifiers = m_flingModifier; |
680 | 681 |
681 if (handleMouseWheel(*m_page->deprecatedLocalMainFrame(), syntheticWheel) != | 682 if (handleMouseWheel(*m_page->deprecatedLocalMainFrame(), syntheticWheel) != |
682 WebInputEventResult::NotHandled) | 683 WebInputEventResult::NotHandled) |
683 return true; | 684 return true; |
684 | 685 |
685 // TODO(dtapuska): Remove these GSB/GSE sequences when trackpad latching is
implemented; see crbug.com/526463. | 686 // TODO(dtapuska): Remove these GSB/GSE sequences when trackpad latching is |
| 687 // implemented; see crbug.com/526463. |
686 WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( | 688 WebGestureEvent syntheticScrollBegin = createGestureScrollEventFromFling( |
687 WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); | 689 WebInputEvent::GestureScrollBegin, WebGestureDeviceTouchpad); |
688 syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; | 690 syntheticScrollBegin.data.scrollBegin.deltaXHint = delta.width; |
689 syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; | 691 syntheticScrollBegin.data.scrollBegin.deltaYHint = delta.height; |
690 syntheticScrollBegin.data.scrollBegin.inertialPhase = | 692 syntheticScrollBegin.data.scrollBegin.inertialPhase = |
691 WebGestureEvent::MomentumPhase; | 693 WebGestureEvent::MomentumPhase; |
692 handleGestureEvent(syntheticScrollBegin); | 694 handleGestureEvent(syntheticScrollBegin); |
693 | 695 |
694 WebGestureEvent syntheticScrollUpdate = createGestureScrollEventFromFling( | 696 WebGestureEvent syntheticScrollUpdate = createGestureScrollEventFromFling( |
695 WebInputEvent::GestureScrollUpdate, WebGestureDeviceTouchpad); | 697 WebInputEvent::GestureScrollUpdate, WebGestureDeviceTouchpad); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 788 |
787 // Special handling for double tap and scroll events as we don't want to | 789 // Special handling for double tap and scroll events as we don't want to |
788 // hit test for them. | 790 // hit test for them. |
789 switch (event.type) { | 791 switch (event.type) { |
790 case WebInputEvent::GestureDoubleTap: | 792 case WebInputEvent::GestureDoubleTap: |
791 if (m_webSettings->doubleTapToZoomEnabled() && | 793 if (m_webSettings->doubleTapToZoomEnabled() && |
792 minimumPageScaleFactor() != maximumPageScaleFactor()) { | 794 minimumPageScaleFactor() != maximumPageScaleFactor()) { |
793 m_client->cancelScheduledContentIntents(); | 795 m_client->cancelScheduledContentIntents(); |
794 animateDoubleTapZoom(platformEvent.position()); | 796 animateDoubleTapZoom(platformEvent.position()); |
795 } | 797 } |
796 // GestureDoubleTap is currently only used by Android for zooming. For Web
Core, | 798 // GestureDoubleTap is currently only used by Android for zooming. For |
797 // GestureTap with tap count = 2 is used instead. So we drop GestureDouble
Tap here. | 799 // WebCore, GestureTap with tap count = 2 is used instead. So we drop |
| 800 // GestureDoubleTap here. |
798 eventResult = WebInputEventResult::HandledSystem; | 801 eventResult = WebInputEventResult::HandledSystem; |
799 m_client->didHandleGestureEvent(event, eventCancelled); | 802 m_client->didHandleGestureEvent(event, eventCancelled); |
800 return eventResult; | 803 return eventResult; |
801 case WebInputEvent::GestureScrollBegin: | 804 case WebInputEvent::GestureScrollBegin: |
802 m_client->cancelScheduledContentIntents(); | 805 m_client->cancelScheduledContentIntents(); |
803 case WebInputEvent::GestureScrollEnd: | 806 case WebInputEvent::GestureScrollEnd: |
804 case WebInputEvent::GestureScrollUpdate: | 807 case WebInputEvent::GestureScrollUpdate: |
805 case WebInputEvent::GestureFlingStart: | 808 case WebInputEvent::GestureFlingStart: |
806 // Scrolling-related gesture events invoke EventHandler recursively for ea
ch frame down | 809 // Scrolling-related gesture events invoke EventHandler recursively for |
807 // the chain, doing a single-frame hit-test per frame. This matches handle
WheelEvent. | 810 // each frame down the chain, doing a single-frame hit-test per frame. |
808 // Perhaps we could simplify things by rewriting scroll handling to work i
nner frame | 811 // This matches handleWheelEvent. Perhaps we could simplify things by |
809 // out, and then unify with other gesture events. | 812 // rewriting scroll handling to work inner frame out, and then unify with |
| 813 // other gesture events. |
810 eventResult = | 814 eventResult = |
811 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEvent( | 815 mainFrameImpl()->frame()->eventHandler().handleGestureScrollEvent( |
812 platformEvent); | 816 platformEvent); |
813 m_client->didHandleGestureEvent(event, eventCancelled); | 817 m_client->didHandleGestureEvent(event, eventCancelled); |
814 return eventResult; | 818 return eventResult; |
815 case WebInputEvent::GesturePinchBegin: | 819 case WebInputEvent::GesturePinchBegin: |
816 case WebInputEvent::GesturePinchEnd: | 820 case WebInputEvent::GesturePinchEnd: |
817 case WebInputEvent::GesturePinchUpdate: | 821 case WebInputEvent::GesturePinchUpdate: |
818 return WebInputEventResult::NotHandled; | 822 return WebInputEventResult::NotHandled; |
819 default: | 823 default: |
820 break; | 824 break; |
821 } | 825 } |
822 | 826 |
823 // Hit test across all frames and do touch adjustment as necessary for the eve
nt type. | 827 // Hit test across all frames and do touch adjustment as necessary for the |
| 828 // event type. |
824 GestureEventWithHitTestResults targetedEvent = | 829 GestureEventWithHitTestResults targetedEvent = |
825 m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent( | 830 m_page->deprecatedLocalMainFrame()->eventHandler().targetGestureEvent( |
826 platformEvent); | 831 platformEvent); |
827 | 832 |
828 // Handle link highlighting outside the main switch to avoid getting lost in t
he | 833 // Handle link highlighting outside the main switch to avoid getting lost in |
829 // complicated set of cases handled below. | 834 // the complicated set of cases handled below. |
830 switch (event.type) { | 835 switch (event.type) { |
831 case WebInputEvent::GestureShowPress: | 836 case WebInputEvent::GestureShowPress: |
832 // Queue a highlight animation, then hand off to regular handler. | 837 // Queue a highlight animation, then hand off to regular handler. |
833 enableTapHighlightAtPoint(targetedEvent); | 838 enableTapHighlightAtPoint(targetedEvent); |
834 break; | 839 break; |
835 case WebInputEvent::GestureTapCancel: | 840 case WebInputEvent::GestureTapCancel: |
836 case WebInputEvent::GestureTap: | 841 case WebInputEvent::GestureTap: |
837 case WebInputEvent::GestureLongPress: | 842 case WebInputEvent::GestureLongPress: |
838 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 843 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
839 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 844 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
(...skipping 10 matching lines...) Expand all Loading... |
850 RefPtr<WebPagePopupImpl> pagePopup = m_pagePopup; | 855 RefPtr<WebPagePopupImpl> pagePopup = m_pagePopup; |
851 hidePopups(); | 856 hidePopups(); |
852 DCHECK(!m_pagePopup); | 857 DCHECK(!m_pagePopup); |
853 | 858 |
854 m_client->cancelScheduledContentIntents(); | 859 m_client->cancelScheduledContentIntents(); |
855 if (detectContentOnTouch(targetedEvent)) { | 860 if (detectContentOnTouch(targetedEvent)) { |
856 eventResult = WebInputEventResult::HandledSystem; | 861 eventResult = WebInputEventResult::HandledSystem; |
857 break; | 862 break; |
858 } | 863 } |
859 | 864 |
860 // Don't trigger a disambiguation popup on sites designed for mobile devic
es. | 865 // Don't trigger a disambiguation popup on sites designed for mobile |
861 // Instead, assume that the page has been designed with big enough buttons
and links. | 866 // devices. Instead, assume that the page has been designed with big |
862 // Don't trigger a disambiguation popup when screencasting, since it's imp
lemented outside of | 867 // enough buttons and links. Don't trigger a disambiguation popup when |
863 // compositor pipeline and is not being screencasted itself. This leads to
bad user experience. | 868 // screencasting, since it's implemented outside of compositor pipeline |
| 869 // and is not being screencasted itself. This leads to bad user |
| 870 // experience. |
864 WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl(); | 871 WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl(); |
865 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 872 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
866 bool screencastEnabled = devTools && devTools->screencastEnabled(); | 873 bool screencastEnabled = devTools && devTools->screencastEnabled(); |
867 if (event.data.tap.width > 0 && | 874 if (event.data.tap.width > 0 && |
868 !visualViewport.shouldDisableDesktopWorkarounds() && | 875 !visualViewport.shouldDisableDesktopWorkarounds() && |
869 !screencastEnabled) { | 876 !screencastEnabled) { |
870 IntRect boundingBox(visualViewport.viewportToRootFrame( | 877 IntRect boundingBox(visualViewport.viewportToRootFrame( |
871 IntRect(event.x - event.data.tap.width / 2, | 878 IntRect(event.x - event.data.tap.width / 2, |
872 event.y - event.data.tap.height / 2, event.data.tap.width, | 879 event.y - event.data.tap.height / 2, event.data.tap.width, |
873 event.data.tap.height))); | 880 event.data.tap.height))); |
874 | 881 |
875 // TODO(bokan): We shouldn't pass details of the VisualViewport offset t
o render_view_impl. | 882 // TODO(bokan): We shouldn't pass details of the VisualViewport offset |
876 // crbug.com/459591 | 883 // to render_view_impl. crbug.com/459591 |
877 WebSize visualViewportOffset = | 884 WebSize visualViewportOffset = |
878 flooredIntSize(visualViewport.location()); | 885 flooredIntSize(visualViewport.location()); |
879 | 886 |
880 if (m_webSettings->multiTargetTapNotificationEnabled()) { | 887 if (m_webSettings->multiTargetTapNotificationEnabled()) { |
881 Vector<IntRect> goodTargets; | 888 Vector<IntRect> goodTargets; |
882 HeapVector<Member<Node>> highlightNodes; | 889 HeapVector<Member<Node>> highlightNodes; |
883 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), | 890 findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), |
884 goodTargets, highlightNodes); | 891 goodTargets, highlightNodes); |
885 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? | 892 // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? |
886 // Single candidate case is currently handled by: https://bugs.webkit.
org/show_bug.cgi?id=85101 | 893 // Single candidate case is currently handled by: |
| 894 // https://bugs.webkit.org/show_bug.cgi?id=85101 |
887 if (goodTargets.size() >= 2 && m_client && | 895 if (goodTargets.size() >= 2 && m_client && |
888 m_client->didTapMultipleTargets(visualViewportOffset, boundingBox, | 896 m_client->didTapMultipleTargets(visualViewportOffset, boundingBox, |
889 goodTargets)) { | 897 goodTargets)) { |
890 enableTapHighlights(highlightNodes); | 898 enableTapHighlights(highlightNodes); |
891 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 899 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
892 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); | 900 m_linkHighlights[i]->startHighlightAnimationIfNeeded(); |
893 eventResult = WebInputEventResult::HandledSystem; | 901 eventResult = WebInputEventResult::HandledSystem; |
894 eventCancelled = true; | 902 eventCancelled = true; |
895 break; | 903 break; |
896 } | 904 } |
897 } | 905 } |
898 } | 906 } |
899 | 907 |
900 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( | 908 eventResult = mainFrameImpl()->frame()->eventHandler().handleGestureEvent( |
901 targetedEvent); | 909 targetedEvent); |
902 | 910 |
903 if (m_pagePopup && pagePopup && | 911 if (m_pagePopup && pagePopup && |
904 m_pagePopup->hasSamePopupClient(pagePopup.get())) { | 912 m_pagePopup->hasSamePopupClient(pagePopup.get())) { |
905 // The tap triggered a page popup that is the same as the one we just cl
osed. | 913 // The tap triggered a page popup that is the same as the one we just |
906 // It needs to be closed. | 914 // closed. It needs to be closed. |
907 cancelPagePopup(); | 915 cancelPagePopup(); |
908 } | 916 } |
909 break; | 917 break; |
910 } | 918 } |
911 case WebInputEvent::GestureTwoFingerTap: | 919 case WebInputEvent::GestureTwoFingerTap: |
912 case WebInputEvent::GestureLongPress: | 920 case WebInputEvent::GestureLongPress: |
913 case WebInputEvent::GestureLongTap: { | 921 case WebInputEvent::GestureLongTap: { |
914 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) | 922 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) |
915 break; | 923 break; |
916 | 924 |
(...skipping 21 matching lines...) Expand all Loading... |
938 NOTREACHED(); | 946 NOTREACHED(); |
939 } | 947 } |
940 m_client->didHandleGestureEvent(event, eventCancelled); | 948 m_client->didHandleGestureEvent(event, eventCancelled); |
941 return eventResult; | 949 return eventResult; |
942 } | 950 } |
943 | 951 |
944 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent( | 952 WebInputEventResult WebViewImpl::handleSyntheticWheelFromTouchpadPinchEvent( |
945 const WebGestureEvent& pinchEvent) { | 953 const WebGestureEvent& pinchEvent) { |
946 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate); | 954 DCHECK_EQ(pinchEvent.type, WebInputEvent::GesturePinchUpdate); |
947 | 955 |
948 // For pinch gesture events, match typical trackpad behavior on Windows by sen
ding fake | 956 // For pinch gesture events, match typical trackpad behavior on Windows by |
949 // wheel events with the ctrl modifier set when we see trackpad pinch gestures
. Ideally | 957 // sending fake wheel events with the ctrl modifier set when we see trackpad |
950 // we'd someday get a platform 'pinch' event and send that instead. | 958 // pinch gestures. Ideally we'd someday get a platform 'pinch' event and |
| 959 // send that instead. |
951 WebMouseWheelEvent wheelEvent; | 960 WebMouseWheelEvent wheelEvent; |
952 wheelEvent.type = WebInputEvent::MouseWheel; | 961 wheelEvent.type = WebInputEvent::MouseWheel; |
953 wheelEvent.timeStampSeconds = pinchEvent.timeStampSeconds; | 962 wheelEvent.timeStampSeconds = pinchEvent.timeStampSeconds; |
954 wheelEvent.windowX = wheelEvent.x = pinchEvent.x; | 963 wheelEvent.windowX = wheelEvent.x = pinchEvent.x; |
955 wheelEvent.windowY = wheelEvent.y = pinchEvent.y; | 964 wheelEvent.windowY = wheelEvent.y = pinchEvent.y; |
956 wheelEvent.globalX = pinchEvent.globalX; | 965 wheelEvent.globalX = pinchEvent.globalX; |
957 wheelEvent.globalY = pinchEvent.globalY; | 966 wheelEvent.globalY = pinchEvent.globalY; |
958 wheelEvent.modifiers = pinchEvent.modifiers | WebInputEvent::ControlKey; | 967 wheelEvent.modifiers = pinchEvent.modifiers | WebInputEvent::ControlKey; |
959 wheelEvent.deltaX = 0; | 968 wheelEvent.deltaX = 0; |
960 | 969 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 } | 1137 } |
1129 | 1138 |
1130 if (!focusedFrame || !focusedFrame->isLocalFrame()) | 1139 if (!focusedFrame || !focusedFrame->isLocalFrame()) |
1131 return WebInputEventResult::NotHandled; | 1140 return WebInputEventResult::NotHandled; |
1132 | 1141 |
1133 LocalFrame* frame = toLocalFrame(focusedFrame); | 1142 LocalFrame* frame = toLocalFrame(focusedFrame); |
1134 | 1143 |
1135 WebInputEventResult result = frame->eventHandler().keyEvent(event); | 1144 WebInputEventResult result = frame->eventHandler().keyEvent(event); |
1136 if (result != WebInputEventResult::NotHandled) { | 1145 if (result != WebInputEventResult::NotHandled) { |
1137 if (WebInputEvent::RawKeyDown == event.type) { | 1146 if (WebInputEvent::RawKeyDown == event.type) { |
1138 // Suppress the next keypress event unless the focused node is a plugin no
de. | 1147 // Suppress the next keypress event unless the focused node is a plugin |
1139 // (Flash needs these keypress events to handle non-US keyboards.) | 1148 // node. (Flash needs these keypress events to handle non-US keyboards.) |
1140 Element* element = focusedElement(); | 1149 Element* element = focusedElement(); |
1141 if (element && element->layoutObject() && | 1150 if (element && element->layoutObject() && |
1142 element->layoutObject()->isEmbeddedObject()) { | 1151 element->layoutObject()->isEmbeddedObject()) { |
1143 if (event.windowsKeyCode == VKEY_TAB) { | 1152 if (event.windowsKeyCode == VKEY_TAB) { |
1144 // If the plugin supports keyboard focus then we should not send a tab
keypress event. | 1153 // If the plugin supports keyboard focus then we should not send a tab |
| 1154 // keypress event. |
1145 Widget* widget = toLayoutPart(element->layoutObject())->widget(); | 1155 Widget* widget = toLayoutPart(element->layoutObject())->widget(); |
1146 if (widget && widget->isPluginContainer()) { | 1156 if (widget && widget->isPluginContainer()) { |
1147 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); | 1157 WebPluginContainerImpl* plugin = toWebPluginContainerImpl(widget); |
1148 if (plugin && plugin->supportsKeyboardFocus()) | 1158 if (plugin && plugin->supportsKeyboardFocus()) |
1149 m_suppressNextKeypressEvent = true; | 1159 m_suppressNextKeypressEvent = true; |
1150 } | 1160 } |
1151 } | 1161 } |
1152 } else { | 1162 } else { |
1153 m_suppressNextKeypressEvent = true; | 1163 m_suppressNextKeypressEvent = true; |
1154 } | 1164 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 HitTestResult result = | 1261 HitTestResult result = |
1252 mainFrameImpl()->frame()->eventHandler().hitTestResultAtPoint(point, | 1262 mainFrameImpl()->frame()->eventHandler().hitTestResultAtPoint(point, |
1253 hitType); | 1263 hitType); |
1254 result.setToShadowHostIfInUserAgentShadowRoot(); | 1264 result.setToShadowHostIfInUserAgentShadowRoot(); |
1255 | 1265 |
1256 Node* node = result.innerNodeOrImageMapImage(); | 1266 Node* node = result.innerNodeOrImageMapImage(); |
1257 if (!node) | 1267 if (!node) |
1258 return WebRect(); | 1268 return WebRect(); |
1259 | 1269 |
1260 // Find the block type node based on the hit node. | 1270 // Find the block type node based on the hit node. |
1261 // FIXME: This wants to walk flat tree with LayoutTreeBuilderTraversal::parent
(). | 1271 // FIXME: This wants to walk flat tree with |
| 1272 // LayoutTreeBuilderTraversal::parent(). |
1262 while (node && (!node->layoutObject() || node->layoutObject()->isInline())) | 1273 while (node && (!node->layoutObject() || node->layoutObject()->isInline())) |
1263 node = LayoutTreeBuilderTraversal::parent(*node); | 1274 node = LayoutTreeBuilderTraversal::parent(*node); |
1264 | 1275 |
1265 // Return the bounding box in the root frame's coordinate space. | 1276 // Return the bounding box in the root frame's coordinate space. |
1266 if (node) { | 1277 if (node) { |
1267 IntRect pointInRootFrame = node->Node::pixelSnappedBoundingBox(); | 1278 IntRect pointInRootFrame = node->Node::pixelSnappedBoundingBox(); |
1268 LocalFrame* frame = node->document().frame(); | 1279 LocalFrame* frame = node->document().frame(); |
1269 return frame->view()->contentsToRootFrame(pointInRootFrame); | 1280 return frame->view()->contentsToRootFrame(pointInRootFrame); |
1270 } | 1281 } |
1271 return WebRect(); | 1282 return WebRect(); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 | 1445 |
1435 Node* cursorDefiningAncestor = findCursorDefiningAncestor( | 1446 Node* cursorDefiningAncestor = findCursorDefiningAncestor( |
1436 bestTouchNode, m_page->deprecatedLocalMainFrame()); | 1447 bestTouchNode, m_page->deprecatedLocalMainFrame()); |
1437 // We show a highlight on tap only when the current node shows a hand cursor | 1448 // We show a highlight on tap only when the current node shows a hand cursor |
1438 if (!cursorDefiningAncestor || | 1449 if (!cursorDefiningAncestor || |
1439 !showsHandCursor(cursorDefiningAncestor, | 1450 !showsHandCursor(cursorDefiningAncestor, |
1440 m_page->deprecatedLocalMainFrame())) { | 1451 m_page->deprecatedLocalMainFrame())) { |
1441 return nullptr; | 1452 return nullptr; |
1442 } | 1453 } |
1443 | 1454 |
1444 // We should pick the largest enclosing node with hand cursor set. We do this
by first jumping | 1455 // We should pick the largest enclosing node with hand cursor set. We do this |
1445 // up to cursorDefiningAncestor (which is already known to have hand cursor se
t). Then we locate | 1456 // by first jumping up to cursorDefiningAncestor (which is already known to |
1446 // the next cursor-defining ancestor up in the the tree and repeat the jumps a
s long as the node | 1457 // have hand cursor set). Then we locate the next cursor-defining ancestor up |
1447 // has hand cursor set. | 1458 // in the the tree and repeat the jumps as long as the node has hand cursor |
| 1459 // set. |
1448 do { | 1460 do { |
1449 bestTouchNode = cursorDefiningAncestor; | 1461 bestTouchNode = cursorDefiningAncestor; |
1450 cursorDefiningAncestor = findCursorDefiningAncestor( | 1462 cursorDefiningAncestor = findCursorDefiningAncestor( |
1451 LayoutTreeBuilderTraversal::parent(*bestTouchNode), | 1463 LayoutTreeBuilderTraversal::parent(*bestTouchNode), |
1452 m_page->deprecatedLocalMainFrame()); | 1464 m_page->deprecatedLocalMainFrame()); |
1453 } while (cursorDefiningAncestor && | 1465 } while (cursorDefiningAncestor && |
1454 showsHandCursor(cursorDefiningAncestor, | 1466 showsHandCursor(cursorDefiningAncestor, |
1455 m_page->deprecatedLocalMainFrame())); | 1467 m_page->deprecatedLocalMainFrame())); |
1456 | 1468 |
1457 return bestTouchNode; | 1469 return bestTouchNode; |
(...skipping 18 matching lines...) Expand all Loading... |
1476 // don't get a new target to highlight. | 1488 // don't get a new target to highlight. |
1477 m_linkHighlights.clear(); | 1489 m_linkHighlights.clear(); |
1478 | 1490 |
1479 for (size_t i = 0; i < highlightNodes.size(); ++i) { | 1491 for (size_t i = 0; i < highlightNodes.size(); ++i) { |
1480 Node* node = highlightNodes[i]; | 1492 Node* node = highlightNodes[i]; |
1481 | 1493 |
1482 if (!node || !node->layoutObject()) | 1494 if (!node || !node->layoutObject()) |
1483 continue; | 1495 continue; |
1484 | 1496 |
1485 Color highlightColor = node->layoutObject()->style()->tapHighlightColor(); | 1497 Color highlightColor = node->layoutObject()->style()->tapHighlightColor(); |
1486 // Safari documentation for -webkit-tap-highlight-color says if the specifie
d color has 0 alpha, | 1498 // Safari documentation for -webkit-tap-highlight-color says if the |
1487 // then tap highlighting is disabled. | 1499 // specified color has 0 alpha, then tap highlighting is disabled. |
1488 // http://developer.apple.com/library/safari/#documentation/appleapplication
s/reference/safaricssref/articles/standardcssproperties.html | 1500 // http://developer.apple.com/library/safari/#documentation/appleapplication
s/reference/safaricssref/articles/standardcssproperties.html |
1489 if (!highlightColor.alpha()) | 1501 if (!highlightColor.alpha()) |
1490 continue; | 1502 continue; |
1491 | 1503 |
1492 m_linkHighlights.append(LinkHighlightImpl::create(node, this)); | 1504 m_linkHighlights.append(LinkHighlightImpl::create(node, this)); |
1493 } | 1505 } |
1494 | 1506 |
1495 updateAllLifecyclePhases(); | 1507 updateAllLifecyclePhases(); |
1496 } | 1508 } |
1497 | 1509 |
(...skipping 25 matching lines...) Expand all Loading... |
1523 scale = minimumPageScaleFactor(); | 1535 scale = minimumPageScaleFactor(); |
1524 IntPoint targetPosition = | 1536 IntPoint targetPosition = |
1525 mainFrameImpl()->frameView()->rootFrameToContents(pointInRootFrame); | 1537 mainFrameImpl()->frameView()->rootFrameToContents(pointInRootFrame); |
1526 isAnimating = startPageScaleAnimation( | 1538 isAnimating = startPageScaleAnimation( |
1527 targetPosition, true, scale, doubleTapZoomAnimationDurationInSeconds); | 1539 targetPosition, true, scale, doubleTapZoomAnimationDurationInSeconds); |
1528 } else { | 1540 } else { |
1529 isAnimating = startPageScaleAnimation( | 1541 isAnimating = startPageScaleAnimation( |
1530 scroll, false, scale, doubleTapZoomAnimationDurationInSeconds); | 1542 scroll, false, scale, doubleTapZoomAnimationDurationInSeconds); |
1531 } | 1543 } |
1532 | 1544 |
1533 // TODO(dglazkov): The only reason why we're using isAnimating and not just ch
ecking for | 1545 // TODO(dglazkov): The only reason why we're using isAnimating and not just |
1534 // m_layerTreeView->hasPendingPageScaleAnimation() is because of fake page sca
le animation plumbing | 1546 // checking for m_layerTreeView->hasPendingPageScaleAnimation() is because of |
1535 // for testing, which doesn't actually initiate a page scale animation. | 1547 // fake page scale animation plumbing for testing, which doesn't actually |
| 1548 // initiate a page scale animation. |
1536 if (isAnimating) { | 1549 if (isAnimating) { |
1537 m_doubleTapZoomPageScaleFactor = scale; | 1550 m_doubleTapZoomPageScaleFactor = scale; |
1538 m_doubleTapZoomPending = true; | 1551 m_doubleTapZoomPending = true; |
1539 } | 1552 } |
1540 } | 1553 } |
1541 | 1554 |
1542 void WebViewImpl::zoomToFindInPageRect(const WebRect& rectInRootFrame) { | 1555 void WebViewImpl::zoomToFindInPageRect(const WebRect& rectInRootFrame) { |
1543 if (!mainFrameImpl()) | 1556 if (!mainFrameImpl()) |
1544 return; | 1557 return; |
1545 | 1558 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 multipleTargetsZoomAnimationDurationInSeconds); | 1596 multipleTargetsZoomAnimationDurationInSeconds); |
1584 return true; | 1597 return true; |
1585 } | 1598 } |
1586 | 1599 |
1587 void WebViewImpl::hasTouchEventHandlers(bool hasTouchHandlers) { | 1600 void WebViewImpl::hasTouchEventHandlers(bool hasTouchHandlers) { |
1588 if (m_client) | 1601 if (m_client) |
1589 m_client->hasTouchEventHandlers(hasTouchHandlers); | 1602 m_client->hasTouchEventHandlers(hasTouchHandlers); |
1590 } | 1603 } |
1591 | 1604 |
1592 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) { | 1605 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) { |
1593 // FIXME: Implement this. Note that the point must be divided by pageScaleFact
or. | 1606 // FIXME: Implement this. Note that the point must be divided by |
| 1607 // pageScaleFactor. |
1594 return true; | 1608 return true; |
1595 } | 1609 } |
1596 | 1610 |
1597 #if !OS(MACOSX) | 1611 #if !OS(MACOSX) |
1598 // Mac has no way to open a context menu based on a keyboard event. | 1612 // Mac has no way to open a context menu based on a keyboard event. |
1599 WebInputEventResult WebViewImpl::sendContextMenuEvent( | 1613 WebInputEventResult WebViewImpl::sendContextMenuEvent( |
1600 const WebKeyboardEvent& event) { | 1614 const WebKeyboardEvent& event) { |
1601 // The contextMenuController() holds onto the last context menu that was | 1615 // The contextMenuController() holds onto the last context menu that was |
1602 // popped up on the page until a new one is created. We need to clear | 1616 // popped up on the page until a new one is created. We need to clear |
1603 // this menu before propagating the event through the DOM so that we can | 1617 // this menu before propagating the event through the DOM so that we can |
1604 // detect if we create a new menu for this event, since we won't create | 1618 // detect if we create a new menu for this event, since we won't create |
1605 // a new menu if the DOM swallows the event and the defaultEventHandler does | 1619 // a new menu if the DOM swallows the event and the defaultEventHandler does |
1606 // not run. | 1620 // not run. |
1607 page()->contextMenuController().clearContextMenu(); | 1621 page()->contextMenuController().clearContextMenu(); |
1608 | 1622 |
1609 { | 1623 { |
1610 ContextMenuAllowedScope scope; | 1624 ContextMenuAllowedScope scope; |
1611 Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); | 1625 Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); |
1612 if (!focusedFrame->isLocalFrame()) | 1626 if (!focusedFrame->isLocalFrame()) |
1613 return WebInputEventResult::NotHandled; | 1627 return WebInputEventResult::NotHandled; |
1614 // Firefox reveal focus based on "keydown" event but not "contextmenu" event
, we match FF. | 1628 // Firefox reveal focus based on "keydown" event but not "contextmenu" |
| 1629 // event, we match FF. |
1615 if (Element* focusedElement = | 1630 if (Element* focusedElement = |
1616 toLocalFrame(focusedFrame)->document()->focusedElement()) | 1631 toLocalFrame(focusedFrame)->document()->focusedElement()) |
1617 focusedElement->scrollIntoViewIfNeeded(); | 1632 focusedElement->scrollIntoViewIfNeeded(); |
1618 return toLocalFrame(focusedFrame) | 1633 return toLocalFrame(focusedFrame) |
1619 ->eventHandler() | 1634 ->eventHandler() |
1620 .sendContextMenuEventForKey(nullptr); | 1635 .sendContextMenuEventForKey(nullptr); |
1621 } | 1636 } |
1622 } | 1637 } |
1623 #endif | 1638 #endif |
1624 | 1639 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 } | 1962 } |
1948 | 1963 |
1949 void WebViewImpl::resizeViewWhileAnchored(FrameView* view, | 1964 void WebViewImpl::resizeViewWhileAnchored(FrameView* view, |
1950 float topControlsHeight, | 1965 float topControlsHeight, |
1951 bool topControlsShrinkLayout) { | 1966 bool topControlsShrinkLayout) { |
1952 DCHECK(mainFrameImpl()); | 1967 DCHECK(mainFrameImpl()); |
1953 | 1968 |
1954 topControls().setHeight(topControlsHeight, topControlsShrinkLayout); | 1969 topControls().setHeight(topControlsHeight, topControlsShrinkLayout); |
1955 | 1970 |
1956 { | 1971 { |
1957 // Avoids unnecessary invalidations while various bits of state in TextAutos
izer are updated. | 1972 // Avoids unnecessary invalidations while various bits of state in |
| 1973 // TextAutosizer are updated. |
1958 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); | 1974 TextAutosizer::DeferUpdatePageInfo deferUpdatePageInfo(page()); |
1959 performResize(); | 1975 performResize(); |
1960 } | 1976 } |
1961 | 1977 |
1962 m_fullscreenController->updateSize(); | 1978 m_fullscreenController->updateSize(); |
1963 | 1979 |
1964 // Update lifecyle phases immediately to recalculate the minimum scale limit f
or rotation anchoring, | 1980 // Update lifecyle phases immediately to recalculate the minimum scale limit |
1965 // and to make sure that no lifecycle states are stale if this WebView is embe
dded in another one. | 1981 // for rotation anchoring, and to make sure that no lifecycle states are |
| 1982 // stale if this WebView is embedded in another one. |
1966 updateAllLifecyclePhases(); | 1983 updateAllLifecyclePhases(); |
1967 } | 1984 } |
1968 | 1985 |
1969 void WebViewImpl::resizeWithTopControls(const WebSize& newSize, | 1986 void WebViewImpl::resizeWithTopControls(const WebSize& newSize, |
1970 float topControlsHeight, | 1987 float topControlsHeight, |
1971 bool topControlsShrinkLayout) { | 1988 bool topControlsShrinkLayout) { |
1972 if (m_shouldAutoResize) | 1989 if (m_shouldAutoResize) |
1973 return; | 1990 return; |
1974 | 1991 |
1975 if (m_size == newSize && topControls().height() == topControlsHeight && | 1992 if (m_size == newSize && topControls().height() == topControlsHeight && |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 | 2106 |
2090 if (InspectorOverlay* overlay = inspectorOverlay()) { | 2107 if (InspectorOverlay* overlay = inspectorOverlay()) { |
2091 overlay->updateAllLifecyclePhases(); | 2108 overlay->updateAllLifecyclePhases(); |
2092 // TODO(chrishtr): integrate paint into the overlay's lifecycle. | 2109 // TODO(chrishtr): integrate paint into the overlay's lifecycle. |
2093 if (overlay->pageOverlay() && overlay->pageOverlay()->graphicsLayer()) | 2110 if (overlay->pageOverlay() && overlay->pageOverlay()->graphicsLayer()) |
2094 overlay->pageOverlay()->graphicsLayer()->paint(nullptr); | 2111 overlay->pageOverlay()->graphicsLayer()->paint(nullptr); |
2095 } | 2112 } |
2096 if (m_pageColorOverlay) | 2113 if (m_pageColorOverlay) |
2097 m_pageColorOverlay->graphicsLayer()->paint(nullptr); | 2114 m_pageColorOverlay->graphicsLayer()->paint(nullptr); |
2098 | 2115 |
2099 // TODO(chrishtr): link highlights don't currently paint themselves, it's stil
l driven by cc. | 2116 // TODO(chrishtr): link highlights don't currently paint themselves, it's |
2100 // Fix this. | 2117 // still driven by cc. Fix this. |
2101 for (size_t i = 0; i < m_linkHighlights.size(); ++i) | 2118 for (size_t i = 0; i < m_linkHighlights.size(); ++i) |
2102 m_linkHighlights[i]->updateGeometry(); | 2119 m_linkHighlights[i]->updateGeometry(); |
2103 | 2120 |
2104 if (FrameView* view = mainFrameImpl()->frameView()) { | 2121 if (FrameView* view = mainFrameImpl()->frameView()) { |
2105 LocalFrame* frame = mainFrameImpl()->frame(); | 2122 LocalFrame* frame = mainFrameImpl()->frame(); |
2106 WebWidgetClient* client = | 2123 WebWidgetClient* client = |
2107 WebLocalFrameImpl::fromFrame(frame)->frameWidget()->client(); | 2124 WebLocalFrameImpl::fromFrame(frame)->frameWidget()->client(); |
2108 | 2125 |
2109 if (m_shouldDispatchFirstVisuallyNonEmptyLayout && | 2126 if (m_shouldDispatchFirstVisuallyNonEmptyLayout && |
2110 view->isVisuallyNonEmpty()) { | 2127 view->isVisuallyNonEmpty()) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2228 return WebInputEventResult::HandledSuppressed; | 2245 return WebInputEventResult::HandledSuppressed; |
2229 | 2246 |
2230 if (m_devToolsEmulator->handleInputEvent(inputEvent)) | 2247 if (m_devToolsEmulator->handleInputEvent(inputEvent)) |
2231 return WebInputEventResult::HandledSuppressed; | 2248 return WebInputEventResult::HandledSuppressed; |
2232 | 2249 |
2233 if (InspectorOverlay* overlay = inspectorOverlay()) { | 2250 if (InspectorOverlay* overlay = inspectorOverlay()) { |
2234 if (overlay->handleInputEvent(inputEvent)) | 2251 if (overlay->handleInputEvent(inputEvent)) |
2235 return WebInputEventResult::HandledSuppressed; | 2252 return WebInputEventResult::HandledSuppressed; |
2236 } | 2253 } |
2237 | 2254 |
2238 // Report the event to be NOT processed by WebKit, so that the browser can han
dle it appropriately. | 2255 // Report the event to be NOT processed by WebKit, so that the browser can |
| 2256 // handle it appropriately. |
2239 if (m_ignoreInputEvents) | 2257 if (m_ignoreInputEvents) |
2240 return WebInputEventResult::NotHandled; | 2258 return WebInputEventResult::NotHandled; |
2241 | 2259 |
2242 AutoReset<const WebInputEvent*> currentEventChange(&m_currentInputEvent, | 2260 AutoReset<const WebInputEvent*> currentEventChange(&m_currentInputEvent, |
2243 &inputEvent); | 2261 &inputEvent); |
2244 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); | 2262 UIEventWithKeyState::clearNewTabModifierSetFromIsolatedWorld(); |
2245 | 2263 |
2246 bool isPointerLocked = false; | 2264 bool isPointerLocked = false; |
2247 if (WebFrameWidgetBase* widget = mainFrameImpl()->frameWidget()) { | 2265 if (WebFrameWidgetBase* widget = mainFrameImpl()->frameWidget()) { |
2248 if (WebWidgetClient* client = widget->client()) | 2266 if (WebWidgetClient* client = widget->client()) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2381 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); | 2399 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); |
2382 if (focusedFrame) { | 2400 if (focusedFrame) { |
2383 // Finish an ongoing composition to delete the composition node. | 2401 // Finish an ongoing composition to delete the composition node. |
2384 if (focusedFrame->inputMethodController().hasComposition()) { | 2402 if (focusedFrame->inputMethodController().hasComposition()) { |
2385 WebAutofillClient* autofillClient = | 2403 WebAutofillClient* autofillClient = |
2386 WebLocalFrameImpl::fromFrame(focusedFrame)->autofillClient(); | 2404 WebLocalFrameImpl::fromFrame(focusedFrame)->autofillClient(); |
2387 | 2405 |
2388 if (autofillClient) | 2406 if (autofillClient) |
2389 autofillClient->setIgnoreTextChanges(true); | 2407 autofillClient->setIgnoreTextChanges(true); |
2390 | 2408 |
2391 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh
eets | 2409 // TODO(xiaochengh): The use of |
| 2410 // updateStyleAndLayoutIgnorePendingStylesheets |
2392 // needs to be audited. See http://crbug.com/590369 for more details. | 2411 // needs to be audited. See http://crbug.com/590369 for more details. |
2393 focusedFrame->document() | 2412 focusedFrame->document() |
2394 ->updateStyleAndLayoutIgnorePendingStylesheets(); | 2413 ->updateStyleAndLayoutIgnorePendingStylesheets(); |
2395 | 2414 |
2396 focusedFrame->inputMethodController().finishComposingText( | 2415 focusedFrame->inputMethodController().finishComposingText( |
2397 InputMethodController::KeepSelection); | 2416 InputMethodController::KeepSelection); |
2398 | 2417 |
2399 if (autofillClient) | 2418 if (autofillClient) |
2400 autofillClient->setIgnoreTextChanges(false); | 2419 autofillClient->setIgnoreTextChanges(false); |
2401 } | 2420 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2540 info.inputMode = inputModeOfFocusedElement(); | 2559 info.inputMode = inputModeOfFocusedElement(); |
2541 | 2560 |
2542 info.type = textInputType(); | 2561 info.type = textInputType(); |
2543 info.flags = textInputFlags(); | 2562 info.flags = textInputFlags(); |
2544 if (info.type == WebTextInputTypeNone) | 2563 if (info.type == WebTextInputTypeNone) |
2545 return info; | 2564 return info; |
2546 | 2565 |
2547 if (!focused->editor().canEdit()) | 2566 if (!focused->editor().canEdit()) |
2548 return info; | 2567 return info; |
2549 | 2568 |
2550 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets nee
ds to be audited. | 2569 // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets |
2551 // see http://crbug.com/590369 for more details. | 2570 // needs to be audited. see http://crbug.com/590369 for more details. |
2552 focused->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 2571 focused->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
2553 | 2572 |
2554 DocumentLifecycle::DisallowTransitionScope disallowTransition( | 2573 DocumentLifecycle::DisallowTransitionScope disallowTransition( |
2555 focused->document()->lifecycle()); | 2574 focused->document()->lifecycle()); |
2556 | 2575 |
2557 // Emits an object replacement character for each replaced element so that | 2576 // Emits an object replacement character for each replaced element so that |
2558 // it is exposed to IME and thus could be deleted by IME on android. | 2577 // it is exposed to IME and thus could be deleted by IME on android. |
2559 info.value = plainText(EphemeralRange::rangeOfContents(*element), | 2578 info.value = plainText(EphemeralRange::rangeOfContents(*element), |
2560 TextIteratorEmitsObjectReplacementCharacter); | 2579 TextIteratorEmitsObjectReplacementCharacter); |
2561 | 2580 |
(...skipping 27 matching lines...) Expand all Loading... |
2589 WebTextInputType WebViewImpl::textInputType() { | 2608 WebTextInputType WebViewImpl::textInputType() { |
2590 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); | 2609 LocalFrame* focusedFrame = focusedLocalFrameInWidget(); |
2591 if (!focusedFrame) | 2610 if (!focusedFrame) |
2592 return WebTextInputTypeNone; | 2611 return WebTextInputTypeNone; |
2593 | 2612 |
2594 if (!focusedFrame->selection().isAvailable()) { | 2613 if (!focusedFrame->selection().isAvailable()) { |
2595 // "mouse-capture-inside-shadow.html" reaches here. | 2614 // "mouse-capture-inside-shadow.html" reaches here. |
2596 return WebTextInputTypeNone; | 2615 return WebTextInputTypeNone; |
2597 } | 2616 } |
2598 | 2617 |
2599 // It's important to preserve the equivalence of textInputInfo().type and text
InputType(), | 2618 // It's important to preserve the equivalence of textInputInfo().type and |
2600 // so perform the same rootEditableElement() existence check here for consiste
ncy. | 2619 // textInputType(), so perform the same rootEditableElement() existence check |
| 2620 // here for consistency. |
2601 if (!focusedFrame->selection().selection().rootEditableElement()) | 2621 if (!focusedFrame->selection().selection().rootEditableElement()) |
2602 return WebTextInputTypeNone; | 2622 return WebTextInputTypeNone; |
2603 | 2623 |
2604 Document* document = focusedFrame->document(); | 2624 Document* document = focusedFrame->document(); |
2605 if (!document) | 2625 if (!document) |
2606 return WebTextInputTypeNone; | 2626 return WebTextInputTypeNone; |
2607 | 2627 |
2608 Element* element = document->focusedElement(); | 2628 Element* element = document->focusedElement(); |
2609 if (!element) | 2629 if (!element) |
2610 return WebTextInputTypeNone; | 2630 return WebTextInputTypeNone; |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2989 | 3009 |
2990 return m_page->deprecatedLocalMainFrame()->document()->encodingName(); | 3010 return m_page->deprecatedLocalMainFrame()->document()->encodingName(); |
2991 } | 3011 } |
2992 | 3012 |
2993 WebFrame* WebViewImpl::mainFrame() { | 3013 WebFrame* WebViewImpl::mainFrame() { |
2994 return WebFrame::fromFrame(m_page ? m_page->mainFrame() : nullptr); | 3014 return WebFrame::fromFrame(m_page ? m_page->mainFrame() : nullptr); |
2995 } | 3015 } |
2996 | 3016 |
2997 WebFrame* WebViewImpl::findFrameByName(const WebString& name, | 3017 WebFrame* WebViewImpl::findFrameByName(const WebString& name, |
2998 WebFrame* relativeToFrame) { | 3018 WebFrame* relativeToFrame) { |
2999 // FIXME: Either this should only deal with WebLocalFrames or it should move t
o WebFrame. | 3019 // FIXME: Either this should only deal with WebLocalFrames or it should move |
| 3020 // to WebFrame. |
3000 if (!relativeToFrame) | 3021 if (!relativeToFrame) |
3001 relativeToFrame = mainFrame(); | 3022 relativeToFrame = mainFrame(); |
3002 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); | 3023 Frame* frame = toWebLocalFrameImpl(relativeToFrame)->frame(); |
3003 frame = frame->tree().find(name); | 3024 frame = frame->tree().find(name); |
3004 if (!frame || !frame->isLocalFrame()) | 3025 if (!frame || !frame->isLocalFrame()) |
3005 return nullptr; | 3026 return nullptr; |
3006 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); | 3027 return WebLocalFrameImpl::fromFrame(toLocalFrame(frame)); |
3007 } | 3028 } |
3008 | 3029 |
3009 WebLocalFrame* WebViewImpl::focusedFrame() { | 3030 WebLocalFrame* WebViewImpl::focusedFrame() { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3110 if (!isElementEditable(element)) | 3131 if (!isElementEditable(element)) |
3111 return false; | 3132 return false; |
3112 | 3133 |
3113 element->document().updateStyleAndLayoutIgnorePendingStylesheets(); | 3134 element->document().updateStyleAndLayoutIgnorePendingStylesheets(); |
3114 | 3135 |
3115 bool zoomInToLegibleScale = | 3136 bool zoomInToLegibleScale = |
3116 m_webSettings->autoZoomFocusedNodeToLegibleScale() && | 3137 m_webSettings->autoZoomFocusedNodeToLegibleScale() && |
3117 !page()->frameHost().visualViewport().shouldDisableDesktopWorkarounds(); | 3138 !page()->frameHost().visualViewport().shouldDisableDesktopWorkarounds(); |
3118 | 3139 |
3119 if (zoomInToLegibleScale) { | 3140 if (zoomInToLegibleScale) { |
3120 // When deciding whether to zoom in on a focused text box, we should decide
not to | 3141 // When deciding whether to zoom in on a focused text box, we should decide |
3121 // zoom in if the user won't be able to zoom out. e.g if the textbox is with
in a | 3142 // not to zoom in if the user won't be able to zoom out. e.g if the textbox |
3122 // touch-action: none container the user can't zoom back out. | 3143 // is within a touch-action: none container the user can't zoom back out. |
3123 TouchAction action = TouchActionUtil::computeEffectiveTouchAction(*element); | 3144 TouchAction action = TouchActionUtil::computeEffectiveTouchAction(*element); |
3124 if (!(action & TouchActionPinchZoom)) | 3145 if (!(action & TouchActionPinchZoom)) |
3125 zoomInToLegibleScale = false; | 3146 zoomInToLegibleScale = false; |
3126 } | 3147 } |
3127 | 3148 |
3128 float scale; | 3149 float scale; |
3129 IntPoint scroll; | 3150 IntPoint scroll; |
3130 bool needAnimation; | 3151 bool needAnimation; |
3131 computeScaleAndScrollForFocusedNode(element, zoomInToLegibleScale, scale, | 3152 computeScaleAndScrollForFocusedNode(element, zoomInToLegibleScale, scale, |
3132 scroll, needAnimation); | 3153 scroll, needAnimation); |
(...skipping 13 matching lines...) Expand all Loading... |
3146 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, | 3167 void WebViewImpl::computeScaleAndScrollForFocusedNode(Node* focusedNode, |
3147 bool zoomInToLegibleScale, | 3168 bool zoomInToLegibleScale, |
3148 float& newScale, | 3169 float& newScale, |
3149 IntPoint& newScroll, | 3170 IntPoint& newScroll, |
3150 bool& needAnimation) { | 3171 bool& needAnimation) { |
3151 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 3172 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
3152 | 3173 |
3153 WebRect caretInViewport, unusedEnd; | 3174 WebRect caretInViewport, unusedEnd; |
3154 selectionBounds(caretInViewport, unusedEnd); | 3175 selectionBounds(caretInViewport, unusedEnd); |
3155 | 3176 |
3156 // 'caretInDocument' is rect encompassing the blinking cursor relative to the
root document. | 3177 // 'caretInDocument' is rect encompassing the blinking cursor relative to the |
| 3178 // root document. |
3157 IntRect caretInDocument = mainFrameImpl()->frameView()->frameToContents( | 3179 IntRect caretInDocument = mainFrameImpl()->frameView()->frameToContents( |
3158 visualViewport.viewportToRootFrame(caretInViewport)); | 3180 visualViewport.viewportToRootFrame(caretInViewport)); |
3159 IntRect textboxRectInDocument = mainFrameImpl()->frameView()->frameToContents( | 3181 IntRect textboxRectInDocument = mainFrameImpl()->frameView()->frameToContents( |
3160 focusedNode->document().view()->contentsToRootFrame( | 3182 focusedNode->document().view()->contentsToRootFrame( |
3161 pixelSnappedIntRect(focusedNode->Node::boundingBox()))); | 3183 pixelSnappedIntRect(focusedNode->Node::boundingBox()))); |
3162 | 3184 |
3163 if (!zoomInToLegibleScale) { | 3185 if (!zoomInToLegibleScale) { |
3164 newScale = pageScaleFactor(); | 3186 newScale = pageScaleFactor(); |
3165 } else { | 3187 } else { |
3166 // Pick a scale which is reasonably readable. This is the scale at which | 3188 // Pick a scale which is reasonably readable. This is the scale at which |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 m_zoomLevel = m_maximumZoomLevel; | 3295 m_zoomLevel = m_maximumZoomLevel; |
3274 else | 3296 else |
3275 m_zoomLevel = zoomLevel; | 3297 m_zoomLevel = zoomLevel; |
3276 | 3298 |
3277 float zoomFactor = | 3299 float zoomFactor = |
3278 m_zoomFactorOverride | 3300 m_zoomFactorOverride |
3279 ? m_zoomFactorOverride | 3301 ? m_zoomFactorOverride |
3280 : static_cast<float>(zoomLevelToZoomFactor(m_zoomLevel)); | 3302 : static_cast<float>(zoomLevelToZoomFactor(m_zoomLevel)); |
3281 if (m_zoomFactorForDeviceScaleFactor) { | 3303 if (m_zoomFactorForDeviceScaleFactor) { |
3282 if (m_compositorDeviceScaleFactorOverride) { | 3304 if (m_compositorDeviceScaleFactorOverride) { |
3283 // Adjust the page's DSF so that DevicePixelRatio becomes m_zoomFactorForD
eviceScaleFactor. | 3305 // Adjust the page's DSF so that DevicePixelRatio becomes |
| 3306 // m_zoomFactorForDeviceScaleFactor. |
3284 page()->setDeviceScaleFactor(m_zoomFactorForDeviceScaleFactor / | 3307 page()->setDeviceScaleFactor(m_zoomFactorForDeviceScaleFactor / |
3285 m_compositorDeviceScaleFactorOverride); | 3308 m_compositorDeviceScaleFactorOverride); |
3286 zoomFactor *= m_compositorDeviceScaleFactorOverride; | 3309 zoomFactor *= m_compositorDeviceScaleFactorOverride; |
3287 } else { | 3310 } else { |
3288 page()->setDeviceScaleFactor(1.f); | 3311 page()->setDeviceScaleFactor(1.f); |
3289 zoomFactor *= m_zoomFactorForDeviceScaleFactor; | 3312 zoomFactor *= m_zoomFactorForDeviceScaleFactor; |
3290 } | 3313 } |
3291 } | 3314 } |
3292 propagateZoomFactorToLocalFrameRoots(m_page->mainFrame(), zoomFactor); | 3315 propagateZoomFactorToLocalFrameRoots(m_page->mainFrame(), zoomFactor); |
3293 | 3316 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3502 pageScaleConstraintsSet().finalConstraints().initialScale != -1) { | 3525 pageScaleConstraintsSet().finalConstraints().initialScale != -1) { |
3503 newPageScaleFactor = | 3526 newPageScaleFactor = |
3504 pageScaleConstraintsSet().finalConstraints().initialScale; | 3527 pageScaleConstraintsSet().finalConstraints().initialScale; |
3505 pageScaleConstraintsSet().setNeedsReset(false); | 3528 pageScaleConstraintsSet().setNeedsReset(false); |
3506 } | 3529 } |
3507 setPageScaleFactor(newPageScaleFactor); | 3530 setPageScaleFactor(newPageScaleFactor); |
3508 | 3531 |
3509 updateLayerTreeViewport(); | 3532 updateLayerTreeViewport(); |
3510 | 3533 |
3511 // Changes to page-scale during layout may require an additional frame. | 3534 // Changes to page-scale during layout may require an additional frame. |
3512 // We can't update the lifecycle here because we may be in the middle of layou
t in the | 3535 // We can't update the lifecycle here because we may be in the middle of |
3513 // caller of this method. | 3536 // layout in the caller of this method. |
3514 // TODO(chrishtr): clean all this up. All layout should happen in one lifecycl
e run (crbug.com/578239). | 3537 // TODO(chrishtr): clean all this up. All layout should happen in one |
| 3538 // lifecycle run (crbug.com/578239). |
3515 if (mainFrameImpl()->frameView()->needsLayout()) | 3539 if (mainFrameImpl()->frameView()->needsLayout()) |
3516 mainFrameImpl()->frameWidget()->scheduleAnimation(); | 3540 mainFrameImpl()->frameWidget()->scheduleAnimation(); |
3517 } | 3541 } |
3518 | 3542 |
3519 void WebViewImpl::updatePageDefinedViewportConstraints( | 3543 void WebViewImpl::updatePageDefinedViewportConstraints( |
3520 const ViewportDescription& description) { | 3544 const ViewportDescription& description) { |
3521 if (!page() || (!m_size.width && !m_size.height) || | 3545 if (!page() || (!m_size.width && !m_size.height) || |
3522 !page()->mainFrame()->isLocalFrame()) | 3546 !page()->mainFrame()->isLocalFrame()) |
3523 return; | 3547 return; |
3524 | 3548 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 static_cast<DragOperation>(m_operationsAllowed)); | 3916 static_cast<DragOperation>(m_operationsAllowed)); |
3893 | 3917 |
3894 DragSession dragSession; | 3918 DragSession dragSession; |
3895 if (dragAction == DragEnter) | 3919 if (dragAction == DragEnter) |
3896 dragSession = m_page->dragController().dragEntered(&dragData); | 3920 dragSession = m_page->dragController().dragEntered(&dragData); |
3897 else | 3921 else |
3898 dragSession = m_page->dragController().dragUpdated(&dragData); | 3922 dragSession = m_page->dragController().dragUpdated(&dragData); |
3899 | 3923 |
3900 DragOperation dropEffect = dragSession.operation; | 3924 DragOperation dropEffect = dragSession.operation; |
3901 | 3925 |
3902 // Mask the drop effect operation against the drag source's allowed operations
. | 3926 // Mask the drop effect operation against the drag source's allowed |
| 3927 // operations. |
3903 if (!(dropEffect & dragData.draggingSourceOperationMask())) | 3928 if (!(dropEffect & dragData.draggingSourceOperationMask())) |
3904 dropEffect = DragOperationNone; | 3929 dropEffect = DragOperationNone; |
3905 | 3930 |
3906 m_dragOperation = static_cast<WebDragOperation>(dropEffect); | 3931 m_dragOperation = static_cast<WebDragOperation>(dropEffect); |
3907 | 3932 |
3908 return m_dragOperation; | 3933 return m_dragOperation; |
3909 } | 3934 } |
3910 | 3935 |
3911 void WebViewImpl::sendResizeEventAndRepaint() { | 3936 void WebViewImpl::sendResizeEventAndRepaint() { |
3912 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent | 3937 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4470 m_layerTreeView = m_client->widgetClient()->layerTreeView(); | 4495 m_layerTreeView = m_client->widgetClient()->layerTreeView(); |
4471 } | 4496 } |
4472 | 4497 |
4473 if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl()) | 4498 if (WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl()) |
4474 devTools->layerTreeViewChanged(m_layerTreeView); | 4499 devTools->layerTreeViewChanged(m_layerTreeView); |
4475 | 4500 |
4476 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView); | 4501 m_page->settings().setAcceleratedCompositingEnabled(m_layerTreeView); |
4477 if (m_layerTreeView) | 4502 if (m_layerTreeView) |
4478 m_page->layerTreeViewInitialized(*m_layerTreeView); | 4503 m_page->layerTreeViewInitialized(*m_layerTreeView); |
4479 | 4504 |
4480 // FIXME: only unittests, click to play, Android printing, and printing (for h
eaders and footers) | 4505 // FIXME: only unittests, click to play, Android printing, and printing (for |
4481 // make this assert necessary. We should make them not hit this code and then
delete allowsBrokenNullLayerTreeView. | 4506 // headers and footers) make this assert necessary. We should make them not |
| 4507 // hit this code and then delete allowsBrokenNullLayerTreeView. |
4482 DCHECK(m_layerTreeView || !m_client || | 4508 DCHECK(m_layerTreeView || !m_client || |
4483 m_client->widgetClient()->allowsBrokenNullLayerTreeView()); | 4509 m_client->widgetClient()->allowsBrokenNullLayerTreeView()); |
4484 | 4510 |
4485 if (Platform::current()->isThreadedAnimationEnabled() && m_layerTreeView) { | 4511 if (Platform::current()->isThreadedAnimationEnabled() && m_layerTreeView) { |
4486 m_linkHighlightsTimeline = CompositorAnimationTimeline::create(); | 4512 m_linkHighlightsTimeline = CompositorAnimationTimeline::create(); |
4487 attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); | 4513 attachCompositorAnimationTimeline(m_linkHighlightsTimeline.get()); |
4488 } | 4514 } |
4489 } | 4515 } |
4490 | 4516 |
4491 void WebViewImpl::applyViewportDeltas( | 4517 void WebViewImpl::applyViewportDeltas( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4553 void WebViewImpl::updateRootLayerTransform() { | 4579 void WebViewImpl::updateRootLayerTransform() { |
4554 if (m_visualViewportContainerLayer) | 4580 if (m_visualViewportContainerLayer) |
4555 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform); | 4581 m_visualViewportContainerLayer->setTransform(m_rootLayerTransform); |
4556 } | 4582 } |
4557 | 4583 |
4558 bool WebViewImpl::detectContentOnTouch( | 4584 bool WebViewImpl::detectContentOnTouch( |
4559 const GestureEventWithHitTestResults& targetedEvent) { | 4585 const GestureEventWithHitTestResults& targetedEvent) { |
4560 if (!m_page->mainFrame()->isLocalFrame()) | 4586 if (!m_page->mainFrame()->isLocalFrame()) |
4561 return false; | 4587 return false; |
4562 | 4588 |
4563 // Need a local copy of the hit test as setToShadowHostIfInUserAgentShadowRoot
() will modify it. | 4589 // Need a local copy of the hit test as |
| 4590 // setToShadowHostIfInUserAgentShadowRoot() will modify it. |
4564 HitTestResult touchHit = targetedEvent.hitTestResult(); | 4591 HitTestResult touchHit = targetedEvent.hitTestResult(); |
4565 touchHit.setToShadowHostIfInUserAgentShadowRoot(); | 4592 touchHit.setToShadowHostIfInUserAgentShadowRoot(); |
4566 | 4593 |
4567 if (touchHit.isContentEditable()) | 4594 if (touchHit.isContentEditable()) |
4568 return false; | 4595 return false; |
4569 | 4596 |
4570 Node* node = touchHit.innerNode(); | 4597 Node* node = touchHit.innerNode(); |
4571 if (!node || !node->isTextNode()) | 4598 if (!node || !node->isTextNode()) |
4572 return false; | 4599 return false; |
4573 | 4600 |
4574 // Ignore when tapping on links or nodes listening to click events, unless the
click event is on the | 4601 // Ignore when tapping on links or nodes listening to click events, unless |
4575 // body element, in which case it's unlikely that the original node itself was
intended to be clickable. | 4602 // the click event is on the body element, in which case it's unlikely that |
| 4603 // the original node itself was intended to be clickable. |
4576 for (; node && !isHTMLBodyElement(*node); | 4604 for (; node && !isHTMLBodyElement(*node); |
4577 node = LayoutTreeBuilderTraversal::parent(*node)) { | 4605 node = LayoutTreeBuilderTraversal::parent(*node)) { |
4578 if (node->isLink() || node->willRespondToTouchEvents() || | 4606 if (node->isLink() || node->willRespondToTouchEvents() || |
4579 node->willRespondToMouseClickEvents()) | 4607 node->willRespondToMouseClickEvents()) |
4580 return false; | 4608 return false; |
4581 } | 4609 } |
4582 | 4610 |
4583 WebURL intent = m_client->detectContentIntentAt(touchHit); | 4611 WebURL intent = m_client->detectContentIntentAt(touchHit); |
4584 if (!intent.isValid()) | 4612 if (!intent.isValid()) |
4585 return false; | 4613 return false; |
4586 | 4614 |
4587 // This code is called directly after hit test code, with no user code running
in between, | 4615 // This code is called directly after hit test code, with no user code |
4588 // thus it is assumed that the frame pointer is non-null. | 4616 // running in between, thus it is assumed that the frame pointer is non-null. |
4589 bool isMainFrame = node ? node->document().frame()->isMainFrame() : true; | 4617 bool isMainFrame = node ? node->document().frame()->isMainFrame() : true; |
4590 m_client->scheduleContentIntent(intent, isMainFrame); | 4618 m_client->scheduleContentIntent(intent, isMainFrame); |
4591 return true; | 4619 return true; |
4592 } | 4620 } |
4593 | 4621 |
4594 WebViewScheduler* WebViewImpl::scheduler() const { | 4622 WebViewScheduler* WebViewImpl::scheduler() const { |
4595 return m_scheduler.get(); | 4623 return m_scheduler.get(); |
4596 } | 4624 } |
4597 | 4625 |
4598 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, | 4626 void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4673 if (m_pageColorOverlay) | 4701 if (m_pageColorOverlay) |
4674 m_pageColorOverlay->update(); | 4702 m_pageColorOverlay->update(); |
4675 if (InspectorOverlay* overlay = inspectorOverlay()) { | 4703 if (InspectorOverlay* overlay = inspectorOverlay()) { |
4676 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); | 4704 PageOverlay* inspectorPageOverlay = overlay->pageOverlay(); |
4677 if (inspectorPageOverlay) | 4705 if (inspectorPageOverlay) |
4678 inspectorPageOverlay->update(); | 4706 inspectorPageOverlay->update(); |
4679 } | 4707 } |
4680 } | 4708 } |
4681 | 4709 |
4682 float WebViewImpl::deviceScaleFactor() const { | 4710 float WebViewImpl::deviceScaleFactor() const { |
4683 // TODO(oshima): Investigate if this should return the ScreenInfo's scale fact
or rather than | 4711 // TODO(oshima): Investigate if this should return the ScreenInfo's scale |
4684 // page's scale factor, which can be 1 in use-zoom-for-dsf mode. | 4712 // factor rather than page's scale factor, which can be 1 in use-zoom-for-dsf |
| 4713 // mode. |
4685 if (!page()) | 4714 if (!page()) |
4686 return 1; | 4715 return 1; |
4687 | 4716 |
4688 return page()->deviceScaleFactor(); | 4717 return page()->deviceScaleFactor(); |
4689 } | 4718 } |
4690 | 4719 |
4691 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const { | 4720 LocalFrame* WebViewImpl::focusedLocalFrameInWidget() const { |
4692 if (!mainFrameImpl()) | 4721 if (!mainFrameImpl()) |
4693 return nullptr; | 4722 return nullptr; |
4694 | 4723 |
4695 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); | 4724 LocalFrame* focusedFrame = toLocalFrame(focusedCoreFrame()); |
4696 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4725 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
4697 return nullptr; | 4726 return nullptr; |
4698 return focusedFrame; | 4727 return focusedFrame; |
4699 } | 4728 } |
4700 | 4729 |
4701 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4730 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
4702 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4731 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
4703 } | 4732 } |
4704 | 4733 |
4705 } // namespace blink | 4734 } // namespace blink |
OLD | NEW |