WebKit Bugzilla
Attachment 359234 Details for
Bug 193475
: VisualViewport API should be updated upon opening of keyboard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes the bug
bug-193475-20190115174653.patch (text/plain), 9.54 KB, created by
Ryosuke Niwa
on 2019-01-15 17:46:53 PST
(
hide
)
Description:
Fixes the bug
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2019-01-15 17:46:53 PST
Size:
9.54 KB
patch
obsolete
>Subversion Revision: 239871 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f7f33131c17ff3d21cb95051381c00d58a605888..5bc28974286010db3f936b2fb6c5eac9d39522c4 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2019-01-15 Ryosuke Niwa <rniwa@webkit.org> >+ >+ VisualViewport API should be updated upon opening of keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=193475 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a function to update the visual viewport API and schedule a resize event to FrameView. >+ >+ Test: fast/visual-viewport/ios/resize-event-for-keyboard.html >+ >+ * page/FrameView.cpp: >+ (WebCore::FrameView::didUpdateViewportOverrideRects): >+ * page/FrameView.h: >+ > 2019-01-11 Miguel Gomez <magomez@igalia.com> > > [GTK] Garbled rendering on Youtube while scrolling under X11. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index d53cc33c6927e61aa4e69dae90da8051257de925..db7a7030145cc7750182aebf3d01ab8a25f25025 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,22 @@ >+2019-01-15 Ryosuke Niwa <rniwa@webkit.org> >+ >+ VisualViewport API should be updated upon opening of keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=193475 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The bug was caused by the changes to unobscuredContentRectRespectingInputViewBounds not updating the visual viewport >+ unless it caused a layout to happen. Added a code to update the visual viewport in WebPage::updateVisibleContentRects. >+ >+ Also fixed the bug that VisibleContentRectUpdateInfo::operator== was not checking differences in >+ unobscuredContentRectRespectingInputViewBounds which resulted in the visual viewport override not getting updated >+ while the keyboard is getting brought up. >+ >+ * Shared/VisibleContentRectUpdateInfo.h: >+ (WebKit::operator==): >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::updateVisibleContentRects): >+ > 2019-01-11 Wenson Hsieh <wenson_hsieh@apple.com> > > Introduce IDL files for runtime-enabled UndoManager and UndoItem JavaScript API >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index d25a7e61a7ae34cb257e14f0e525c73982282de9..4bdf160ec6cf3e530acccfee879e1c2d2b4aa297 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -2803,6 +2803,15 @@ void FrameView::updateTiledBackingAdaptiveSizing() > > #if PLATFORM(IOS_FAMILY) > >+void FrameView::didUpdateViewportOverrideRects() >+{ >+ if (!frame().settings().visualViewportAPIEnabled()) >+ return; >+ >+ if (auto* window = frame().window()) >+ window->visualViewport().update(); >+} >+ > void FrameView::unobscuredContentSizeChanged() > { > updateTiledBackingAdaptiveSizing(); >diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h >index 2976b567dbf0a19789b76e609a117e62b511825b..0d0e1e2a2afe7739b52d2bddf193e359db79243c 100644 >--- a/Source/WebCore/page/FrameView.h >+++ b/Source/WebCore/page/FrameView.h >@@ -593,6 +593,10 @@ public: > void updateTiledBackingAdaptiveSizing(); > TiledBacking::Scrollability computeScrollability() const; > >+#if PLATFORM(IOS_FAMILY) >+ WEBCORE_EXPORT void didUpdateViewportOverrideRects(); >+#endif >+ > void addPaintPendingMilestones(OptionSet<LayoutMilestone>); > void firePaintRelatedMilestonesIfNeeded(); > void fireLayoutRelatedMilestonesIfNeeded(); >diff --git a/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h b/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h >index 5f07c2b8a85970c6c2ead542aeb9c870447eefaa..91c1822a74acdef890fe561205fd1ba87d533ec4 100644 >--- a/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h >+++ b/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h >@@ -121,6 +121,7 @@ inline bool operator==(const VisibleContentRectUpdateInfo& a, const VisibleConte > return a.scale() == b.scale() > && a.exposedContentRect() == b.exposedContentRect() > && a.unobscuredContentRect() == b.unobscuredContentRect() >+ && a.unobscuredContentRectRespectingInputViewBounds() == b.unobscuredContentRectRespectingInputViewBounds() > && a.customFixedPositionRect() == b.customFixedPositionRect() > && a.obscuredInsets() == b.obscuredInsets() > && a.unobscuredSafeAreaInsets() == b.unobscuredSafeAreaInsets() >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 0947f06f45de66e5de841207263db7d62e2e5594..0cf184aad64c44c02d4817beb444ff99838fef8c 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -3040,6 +3040,8 @@ void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visi > frameView.frame().selection().setCaretRectNeedsUpdate(); > sendPartialEditorStateAndSchedulePostLayoutUpdate(); > } >+ >+ frameView.didUpdateViewportOverrideRects(); > } else > frameView.setCustomFixedPositionLayoutRect(enclosingIntRect(visibleContentRectUpdateInfo.customFixedPositionRect())); > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index e2e3768083c5467d58f119d8c1de3f4ca3c21edb..8621e4f3c0729d26fd5c522dcfd3d62ed8ceb363 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,15 @@ >+2019-01-15 Ryosuke Niwa <rniwa@webkit.org> >+ >+ VisualViewport API should be updated upon opening of keyboard >+ https://bugs.webkit.org/show_bug.cgi?id=193475 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a regression test. >+ >+ * fast/visual-viewport/ios/resize-event-for-keyboard-expected.txt: Added. >+ * fast/visual-viewport/ios/resize-event-for-keyboard.html: Added. >+ > 2019-01-11 Dominik Infuehr <dinfuehr@igalia.com> > > Enable DFG on ARM/Linux again >diff --git a/LayoutTests/fast/visual-viewport/ios/resize-event-for-keyboard-expected.txt b/LayoutTests/fast/visual-viewport/ios/resize-event-for-keyboard-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..691ed832d67b000249f982bd92d3bc006428937f >--- /dev/null >+++ b/LayoutTests/fast/visual-viewport/ios/resize-event-for-keyboard-expected.txt >@@ -0,0 +1,19 @@ >+This tests "resize" event on window.visualViewport and height getting updated upon keyboard showing up on iOS >+To manually test, tap the text field below to show the software keyboard then dismiss it. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS resizeCount is 0 >+PASS resizeCount is 1 >+PASS originalWidth is window.visualViewport.width >+PASS window.visualViewport.height is not originalHeight >+PASS window.visualViewport.height < originalHeight is true >+PASS resizeCount is 2 >+PASS originalWidth is window.visualViewport.width >+PASS window.visualViewport.height is originalHeight >+PASS window.visualViewport.height < originalHeight is false >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/fast/visual-viewport/ios/resize-event-for-keyboard.html b/LayoutTests/fast/visual-viewport/ios/resize-event-for-keyboard.html >new file mode 100644 >index 0000000000000000000000000000000000000000..4f267304263f49e2e4e70b55d9e49abd71d7e590 >--- /dev/null >+++ b/LayoutTests/fast/visual-viewport/ios/resize-event-for-keyboard.html >@@ -0,0 +1,67 @@ >+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] --> >+<html> >+<head> >+<meta name="viewport" content="initial-scale=1, user-scalable=no"> >+</head> >+<body onload="runTest()"> >+<input type="text" onclick="didFocus()" placeholder="Tap here to open keyboard"> >+<script src="../../../resources/ui-helper.js"></script> >+<script src="../../../resources/js-test.js"></script> >+<script> >+description('This tests "resize" event on window.visualViewport and height getting updated upon keyboard showing up on iOS<br>' >+ + 'To manually test, tap the text field below to show the software keyboard then dismiss it.'); >+ >+jsTestIsAsync = true; >+ >+function didFocus() { } >+ >+async function runTest() { >+ if (window.testRunner) >+ await UIHelper.ensurePresentationUpdate(); >+ >+ window.originalWidth = window.visualViewport.width; >+ window.originalHeight = window.visualViewport.height; >+ window.resizeCount = 0; >+ window.visualViewport.addEventListener('resize', () => { >+ resizeCount++; >+ }); >+ >+ shouldBe('resizeCount', '0'); >+ >+ const rect = document.querySelector('input').getBoundingClientRect(); >+ >+ if (window.testRunner) { >+ await UIHelper.activateAndWaitForInputSessionAt(rect.left + 5, rect.top + 5); >+ await UIHelper.ensurePresentationUpdate(); >+ } else { >+ await new Promise((resolve) => { >+ window.didFocus = () => setTimeout(resolve, 500); >+ }); >+ } >+ >+ shouldBe('resizeCount', '1'); >+ shouldBe('originalWidth', 'window.visualViewport.width'); >+ shouldNotBe('window.visualViewport.height', 'originalHeight'); >+ shouldBeTrue('window.visualViewport.height < originalHeight'); >+ >+ document.querySelector('input').blur(); >+ if (window.testRunner) { >+ await UIHelper.waitForKeyboardToHide(); >+ await UIHelper.ensurePresentationUpdate(); >+ } else { >+ await new Promise((resolve) => { >+ setTimeout(resolve, 500); >+ }); >+ } >+ >+ shouldBe('resizeCount', '2'); >+ shouldBe('originalWidth', 'window.visualViewport.width'); >+ shouldBe('window.visualViewport.height', 'originalHeight'); >+ shouldBeFalse('window.visualViewport.height < originalHeight'); >+ >+ finishJSTest(); >+} >+ >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
simon.fraser
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193475
: 359234