| 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 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 DCHECK_LE(scrollOffset.width() + newX + newWidth, maxSize.width); | 1305 DCHECK_LE(scrollOffset.width() + newX + newWidth, maxSize.width); |
| 1306 | 1306 |
| 1307 return WebRect(newX, source.y, newWidth, source.height); | 1307 return WebRect(newX, source.y, newWidth, source.height); |
| 1308 } | 1308 } |
| 1309 | 1309 |
| 1310 float WebViewImpl::maximumLegiblePageScale() const { | 1310 float WebViewImpl::maximumLegiblePageScale() const { |
| 1311 // Pages should be as legible as on desktop when at dpi scale, so no | 1311 // Pages should be as legible as on desktop when at dpi scale, so no |
| 1312 // need to zoom in further when automatically determining zoom level | 1312 // need to zoom in further when automatically determining zoom level |
| 1313 // (after double tap, find in page, etc), though the user should still | 1313 // (after double tap, find in page, etc), though the user should still |
| 1314 // be allowed to manually pinch zoom in further if they desire. | 1314 // be allowed to manually pinch zoom in further if they desire. |
| 1315 if (page()) | 1315 if (page()) { |
| 1316 return m_maximumLegibleScale * | 1316 return m_maximumLegibleScale * |
| 1317 page()->settings().accessibilityFontScaleFactor(); | 1317 page()->settings().getAccessibilityFontScaleFactor(); |
| 1318 } |
| 1318 return m_maximumLegibleScale; | 1319 return m_maximumLegibleScale; |
| 1319 } | 1320 } |
| 1320 | 1321 |
| 1321 void WebViewImpl::computeScaleAndScrollForBlockRect( | 1322 void WebViewImpl::computeScaleAndScrollForBlockRect( |
| 1322 const WebPoint& hitPointInRootFrame, | 1323 const WebPoint& hitPointInRootFrame, |
| 1323 const WebRect& blockRectInRootFrame, | 1324 const WebRect& blockRectInRootFrame, |
| 1324 float padding, | 1325 float padding, |
| 1325 float defaultScaleWhenAlreadyLegible, | 1326 float defaultScaleWhenAlreadyLegible, |
| 1326 float& scale, | 1327 float& scale, |
| 1327 WebPoint& scroll) { | 1328 WebPoint& scroll) { |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1893 if (!mainFrame) | 1894 if (!mainFrame) |
| 1894 return; | 1895 return; |
| 1895 | 1896 |
| 1896 FrameView* view = mainFrame->frameView(); | 1897 FrameView* view = mainFrame->frameView(); |
| 1897 if (!view) | 1898 if (!view) |
| 1898 return; | 1899 return; |
| 1899 | 1900 |
| 1900 VisualViewport& visualViewport = page()->frameHost().visualViewport(); | 1901 VisualViewport& visualViewport = page()->frameHost().visualViewport(); |
| 1901 | 1902 |
| 1902 bool isRotation = | 1903 bool isRotation = |
| 1903 page()->settings().mainFrameResizesAreOrientationChanges() && | 1904 page()->settings().getMainFrameResizesAreOrientationChanges() && |
| 1904 m_size.width && contentsSize().width() && newSize.width != m_size.width && | 1905 m_size.width && contentsSize().width() && newSize.width != m_size.width && |
| 1905 !m_fullscreenController->isFullscreen(); | 1906 !m_fullscreenController->isFullscreen(); |
| 1906 m_size = newSize; | 1907 m_size = newSize; |
| 1907 | 1908 |
| 1908 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); | 1909 FloatSize viewportAnchorCoords(viewportAnchorCoordX, viewportAnchorCoordY); |
| 1909 if (isRotation) { | 1910 if (isRotation) { |
| 1910 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords, | 1911 RotationViewportAnchor anchor(*view, visualViewport, viewportAnchorCoords, |
| 1911 pageScaleConstraintsSet()); | 1912 pageScaleConstraintsSet()); |
| 1912 resizeViewWhileAnchored(view, browserControlsHeight, | 1913 resizeViewWhileAnchored(view, browserControlsHeight, |
| 1913 browserControlsShrinkLayout); | 1914 browserControlsShrinkLayout); |
| (...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 (description.maxWidth.type() == Auto && | 3192 (description.maxWidth.type() == Auto && |
| 3192 pageScaleConstraintsSet().pageDefinedConstraints().initialScale == | 3193 pageScaleConstraintsSet().pageDefinedConstraints().initialScale == |
| 3193 1.0f)) | 3194 1.0f)) |
| 3194 setInitialPageScaleOverride(-1); | 3195 setInitialPageScaleOverride(-1); |
| 3195 } | 3196 } |
| 3196 | 3197 |
| 3197 Settings& pageSettings = page()->settings(); | 3198 Settings& pageSettings = page()->settings(); |
| 3198 pageScaleConstraintsSet().adjustForAndroidWebViewQuirks( | 3199 pageScaleConstraintsSet().adjustForAndroidWebViewQuirks( |
| 3199 adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), | 3200 adjustedDescription, defaultMinWidth.intValue(), deviceScaleFactor(), |
| 3200 settingsImpl()->supportDeprecatedTargetDensityDPI(), | 3201 settingsImpl()->supportDeprecatedTargetDensityDPI(), |
| 3201 pageSettings.wideViewportQuirkEnabled(), pageSettings.useWideViewport(), | 3202 pageSettings.getWideViewportQuirkEnabled(), |
| 3202 pageSettings.loadWithOverviewMode(), | 3203 pageSettings.getUseWideViewport(), pageSettings.getLoadWithOverviewMode(), |
| 3203 settingsImpl()->viewportMetaNonUserScalableQuirk()); | 3204 settingsImpl()->viewportMetaNonUserScalableQuirk()); |
| 3204 float newInitialScale = | 3205 float newInitialScale = |
| 3205 pageScaleConstraintsSet().pageDefinedConstraints().initialScale; | 3206 pageScaleConstraintsSet().pageDefinedConstraints().initialScale; |
| 3206 if (oldInitialScale != newInitialScale && newInitialScale != -1) { | 3207 if (oldInitialScale != newInitialScale && newInitialScale != -1) { |
| 3207 pageScaleConstraintsSet().setNeedsReset(true); | 3208 pageScaleConstraintsSet().setNeedsReset(true); |
| 3208 if (mainFrameImpl() && mainFrameImpl()->frameView()) | 3209 if (mainFrameImpl() && mainFrameImpl()->frameView()) |
| 3209 mainFrameImpl()->frameView()->setNeedsLayout(); | 3210 mainFrameImpl()->frameView()->setNeedsLayout(); |
| 3210 } | 3211 } |
| 3211 | 3212 |
| 3212 if (LocalFrame* frame = page()->deprecatedLocalMainFrame()) { | 3213 if (LocalFrame* frame = page()->deprecatedLocalMainFrame()) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3223 | 3224 |
| 3224 FrameView* view = mainFrameImpl()->frameView(); | 3225 FrameView* view = mainFrameImpl()->frameView(); |
| 3225 if (!view) | 3226 if (!view) |
| 3226 return; | 3227 return; |
| 3227 | 3228 |
| 3228 WebSize layoutSize = m_size; | 3229 WebSize layoutSize = m_size; |
| 3229 | 3230 |
| 3230 if (settings()->viewportEnabled()) | 3231 if (settings()->viewportEnabled()) |
| 3231 layoutSize = pageScaleConstraintsSet().layoutSize(); | 3232 layoutSize = pageScaleConstraintsSet().layoutSize(); |
| 3232 | 3233 |
| 3233 if (page()->settings().forceZeroLayoutHeight()) | 3234 if (page()->settings().getForceZeroLayoutHeight()) |
| 3234 layoutSize.height = 0; | 3235 layoutSize.height = 0; |
| 3235 | 3236 |
| 3236 view->setLayoutSize(layoutSize); | 3237 view->setLayoutSize(layoutSize); |
| 3237 } | 3238 } |
| 3238 | 3239 |
| 3239 IntSize WebViewImpl::contentsSize() const { | 3240 IntSize WebViewImpl::contentsSize() const { |
| 3240 if (!page()->mainFrame()->isLocalFrame()) | 3241 if (!page()->mainFrame()->isLocalFrame()) |
| 3241 return IntSize(); | 3242 return IntSize(); |
| 3242 LayoutViewItem root = page()->deprecatedLocalMainFrame()->contentLayoutItem(); | 3243 LayoutViewItem root = page()->deprecatedLocalMainFrame()->contentLayoutItem(); |
| 3243 if (root.isNull()) | 3244 if (root.isNull()) |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4200 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) | 4201 if (focusedFrame->localFrameRoot() != mainFrameImpl()->frame()) |
| 4201 return nullptr; | 4202 return nullptr; |
| 4202 return focusedFrame; | 4203 return focusedFrame; |
| 4203 } | 4204 } |
| 4204 | 4205 |
| 4205 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { | 4206 LocalFrame* WebViewImpl::focusedLocalFrameAvailableForIme() const { |
| 4206 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; | 4207 return m_imeAcceptEvents ? focusedLocalFrameInWidget() : nullptr; |
| 4207 } | 4208 } |
| 4208 | 4209 |
| 4209 } // namespace blink | 4210 } // namespace blink |
| OLD | NEW |