| 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 mainFrame.eventHandler().takeLastMouseDownGestureToken(); | 522 mainFrame.eventHandler().takeLastMouseDownGestureToken(); |
| 523 | 523 |
| 524 if (m_pagePopup && pagePopup && | 524 if (m_pagePopup && pagePopup && |
| 525 m_pagePopup->hasSamePopupClient(pagePopup.get())) { | 525 m_pagePopup->hasSamePopupClient(pagePopup.get())) { |
| 526 // That click triggered a page popup that is the same as the one we just | 526 // That click triggered a page popup that is the same as the one we just |
| 527 // closed. It needs to be closed. | 527 // closed. It needs to be closed. |
| 528 cancelPagePopup(); | 528 cancelPagePopup(); |
| 529 } | 529 } |
| 530 | 530 |
| 531 // Dispatch the contextmenu event regardless of if the click was swallowed. | 531 // Dispatch the contextmenu event regardless of if the click was swallowed. |
| 532 if (!page()->settings().showContextMenuOnMouseUp()) { | 532 if (!page()->settings().GetShowContextMenuOnMouseUp()) { |
| 533 #if OS(MACOSX) | 533 #if OS(MACOSX) |
| 534 if (event.button == WebMouseEvent::Button::Right || | 534 if (event.button == WebMouseEvent::Button::Right || |
| 535 (event.button == WebMouseEvent::Button::Left && | 535 (event.button == WebMouseEvent::Button::Left && |
| 536 event.modifiers & WebMouseEvent::ControlKey)) | 536 event.modifiers & WebMouseEvent::ControlKey)) |
| 537 mouseContextMenu(event); | 537 mouseContextMenu(event); |
| 538 #else | 538 #else |
| 539 if (event.button == WebMouseEvent::Button::Right) | 539 if (event.button == WebMouseEvent::Button::Right) |
| 540 mouseContextMenu(event); | 540 mouseContextMenu(event); |
| 541 #endif | 541 #endif |
| 542 } | 542 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 targetLocalFrame->eventHandler().sendContextMenuEvent(pme, nullptr); | 580 targetLocalFrame->eventHandler().sendContextMenuEvent(pme, nullptr); |
| 581 } | 581 } |
| 582 // Actually showing the context menu is handled by the ContextMenuClient | 582 // Actually showing the context menu is handled by the ContextMenuClient |
| 583 // implementation... | 583 // implementation... |
| 584 } | 584 } |
| 585 | 585 |
| 586 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, | 586 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, |
| 587 const WebMouseEvent& event) { | 587 const WebMouseEvent& event) { |
| 588 PageWidgetEventHandler::handleMouseUp(mainFrame, event); | 588 PageWidgetEventHandler::handleMouseUp(mainFrame, event); |
| 589 | 589 |
| 590 if (page()->settings().showContextMenuOnMouseUp()) { | 590 if (page()->settings().GetShowContextMenuOnMouseUp()) { |
| 591 // Dispatch the contextmenu event regardless of if the click was swallowed. | 591 // Dispatch the contextmenu event regardless of if the click was swallowed. |
| 592 // On Mac/Linux, we handle it on mouse down, not up. | 592 // On Mac/Linux, we handle it on mouse down, not up. |
| 593 if (event.button == WebMouseEvent::Button::Right) | 593 if (event.button == WebMouseEvent::Button::Right) |
| 594 mouseContextMenu(event); | 594 mouseContextMenu(event); |
| 595 } | 595 } |
| 596 } | 596 } |
| 597 | 597 |
| 598 WebInputEventResult WebViewImpl::handleMouseWheel( | 598 WebInputEventResult WebViewImpl::handleMouseWheel( |
| 599 LocalFrame& mainFrame, | 599 LocalFrame& mainFrame, |
| 600 const WebMouseWheelEvent& event) { | 600 const WebMouseWheelEvent& event) { |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 DCHECK_LE(scrollOffset.width() + newX + newWidth, maxSize.width); | 1308 DCHECK_LE(scrollOffset.width() + newX + newWidth, maxSize.width); |
| 1309 | 1309 |
| 1310 return WebRect(newX, source.y, newWidth, source.height); | 1310 return WebRect(newX, source.y, newWidth, source.height); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 float WebViewImpl::maximumLegiblePageScale() const { | 1313 float WebViewImpl::maximumLegiblePageScale() const { |
| 1314 // Pages should be as legible as on desktop when at dpi scale, so no | 1314 // Pages should be as legible as on desktop when at dpi scale, so no |
| 1315 // need to zoom in further when automatically determining zoom level | 1315 // need to zoom in further when automatically determining zoom level |
| 1316 // (after double tap, find in page, etc), though the user should still | 1316 // (after double tap, find in page, etc), though the user should still |
| 1317 // be allowed to manually pinch zoom in further if they desire. | 1317 // be allowed to manually pinch zoom in further if they desire. |
| 1318 if (page()) | 1318 if (page()) { |
| 1319 return m_maximumLegibleScale * | 1319 return m_maximumLegibleScale * |
| 1320 page()->settings().accessibilityFontScaleFactor(); | 1320 page()->settings().GetAccessibilityFontScaleFactor(); |
| 1321 } |
| 1321 return m_maximumLegibleScale; | 1322 return m_maximumLegibleScale; |
| 1322 } | 1323 } |
| 1323 | 1324 |
| 1324 void WebViewImpl::computeScaleAndScrollForBlockRect( | 1325 void WebViewImpl::computeScaleAndScrollForBlockRect( |
| 1325 const WebPoint& hitPointInRootFrame, | 1326 const WebPoint& hitPointInRootFrame, |
| 1326 const WebRect& blockRectInRootFrame, | 1327 const WebRect& blockRectInRootFrame, |
| 1327 float padding, | 1328 float padding, |
| 1328 float defaultScaleWhenAlreadyLegible, | 1329 float defaultScaleWhenAlreadyLegible, |
| 1329 float& scale, | 1330 float& scale, |
| 1330 WebPoint& scroll) { | 1331 WebPoint& scroll) { |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 if (!mainFrame) | 1897 if (!mainFrame) |
| 1897 return; | 1898 return; |
| 1898 | 1899 |
| 1899 FrameView* view = mainFrame->frameView(); | 1900 FrameView* view = mainFrame->frameView(); |
| 1900 if (!view) | 1901 if (!view) |
| 1901 return; | 1902 return; |
| 1902 | 1903 |
| 1903 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 1904 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 1904 | 1905 |
| 1905 bool isRotation = | 1906 bool isRotation = |
| 1906 page()->settings().mainFrameResizesAreOrientationChanges() && | 1907 page()->settings().GetMainFrameResizesAreOrientationChanges() && |
| 1907 m_size.width && contentsSize().width() && newSize.width != m_size.width && | 1908 m_size.width && contentsSize().width() && newSize.width != m_size.width && |
| 1908 !m_fullscreenController->isFullscreen(); | 1909 !m_fullscreenController->isFullscreen(); |
| 1909 m_size = newSize; | 1910 m_size = newSize; |
| 1910 | 1911 |
| 1911 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); | 1912 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); |
| 1912 if (isRotation) { | 1913 if (isRotation) { |
| 1913 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords, | 1914 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords, |
| 1914 pageScaleConstraintsSet()); | 1915 pageScaleConstraintsSet()); |
| 1915 resizeViewWhileAnchored(view, browserControlsHeight, | 1916 resizeViewWhileAnchored(view, browserControlsHeight, |
| 1916 browserControlsShrinkLayout); | 1917 browserControlsShrinkLayout); |
| (...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3194 (description.maxWidth.type() == Auto && | 3195 (description.maxWidth.type() == Auto && |
| 3195 pageScaleConstraintsSet().pageDefinedConstraints().initialScale == | 3196 pageScaleConstraintsSet().pageDefinedConstraints().initialScale == |
| 3196 1.0f)) | 3197 1.0f)) |
| 3197 setInitialPageScaleOverride(-1); | 3198 setInitialPageScaleOverride(-1); |
| 3198 } | 3199 } |
| 3199 | 3200 |
| 3200 Settings& pageSettings = page()->settings(); | 3201 Settings& pageSettings = page()->settings(); |
| 3201 pageScaleConstraintsSet().adjustForAndroidWebViewQuirks( | 3202 pageScaleConstraintsSet().adjustForAndroidWebViewQuirks( |
| 3202 adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), | 3203 adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), |
| 3203 settingsImpl()->supportDeprecatedTargetDensityDPI(), | 3204 settingsImpl()->supportDeprecatedTargetDensityDPI(), |
| 3204 pageSettings.wideViewportQuirkEnabled(), pageSettings.useWideViewport(), | 3205 pageSettings.GetWideViewportQuirkEnabled(), |
| 3205 pageSettings.loadWithOverviewMode(), | 3206 pageSettings.GetUseWideViewport(), pageSettings.GetLoadWithOverviewMode(), |
| 3206 settingsImpl()->viewportMetaNonUserScalableQuirk()); | 3207 settingsImpl()->viewportMetaNonUserScalableQuirk()); |
| 3207 float newInitialScale = | 3208 float newInitialScale = |
| 3208 pageScaleConstraintsSet().pageDefinedConstraints().initialScale; | 3209 pageScaleConstraintsSet().pageDefinedConstraints().initialScale; |
| 3209 if (oldInitialScale != newInitialScale && newInitialScale != -1) { | 3210 if (oldInitialScale != newInitialScale && newInitialScale != -1) { |
| 3210 pageScaleConstraintsSet().setNeedsReset(true); | 3211 pageScaleConstraintsSet().setNeedsReset(true); |
| 3211 if (mainFrameImpl() && mainFrameImpl()->frameView()) | 3212 if (mainFrameImpl() && mainFrameImpl()->frameView()) |
| 3212 mainFrameImpl()->frameView()->setNeedsLayout(); | 3213 mainFrameImpl()->frameView()->setNeedsLayout(); |
| 3213 } | 3214 } |
| 3214 | 3215 |
| 3215 if (LocalFrame* frame = page()->deprecatedLocalMainFrame()) { | 3216 if (LocalFrame* frame = page()->deprecatedLocalMainFrame()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3226 | 3227 |
| 3227 FrameView* view = mainFrameImpl()->frameView(); | 3228 FrameView* view = mainFrameImpl()->frameView(); |
| 3228 if (!view) | 3229 if (!view) |
| 3229 return; | 3230 return; |
| 3230 | 3231 |
| 3231 WebSize layoutSize = m_size; | 3232 WebSize layoutSize = m_size; |
| 3232 | 3233 |
| 3233 if (settings()->viewportEnabled()) | 3234 if (settings()->viewportEnabled()) |
| 3234 layoutSize = pageScaleConstraintsSet().layoutSize(); | 3235 layoutSize = pageScaleConstraintsSet().layoutSize(); |
| 3235 | 3236 |
| 3236 if (page()->settings().forceZeroLayoutHeight()) | 3237 if (page()->settings().GetForceZeroLayoutHeight()) |
| 3237 layoutSize.height = 0; | 3238 layoutSize.height = 0; |
| 3238 | 3239 |
| 3239 view->setLayoutSize(layoutSize); | 3240 view->setLayoutSize(layoutSize); |
| 3240 } | 3241 } |
| 3241 | 3242 |
| 3242 IntSize WebViewImpl::contentsSize() const { | 3243 IntSize WebViewImpl::contentsSize() const { |
| 3243 if (!page()->mainFrame()->isLocalFrame()) | 3244 if (!page()->mainFrame()->isLocalFrame()) |
| 3244 return IntSize(); | 3245 return IntSize(); |
| 3245 LayoutViewItem root = page()->deprecatedLocalMainFrame()->contentLayoutItem(); | 3246 LayoutViewItem root = page()->deprecatedLocalMainFrame()->contentLayoutItem(); |
| 3246 if (root.isNull()) | 3247 if (root.isNull()) |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4202 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4203 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4203 return nullptr; | 4204 return nullptr; |
| 4204 return focusedFrame; | 4205 return focusedFrame; |
| 4205 } | 4206 } |
| 4206 | 4207 |
| 4207 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4208 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4208 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4209 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4209 } | 4210 } |
| 4210 | 4211 |
| 4211 } // namespace blink | 4212 } // namespace blink |
| OLD | NEW |