Changeset 202147 in webkit
- Timestamp:
- Jun 16, 2016, 4:34:17 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/ios/focus-input-in-iframe-expected.txt (added)
-
LayoutTests/fast/forms/ios/focus-input-in-iframe.html (added)
-
LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe-expected.txt (added)
-
LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Element.cpp (modified) (2 diffs)
-
Source/WebCore/history/CachedPage.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202146 r202147 1 2016-06-16 Simon Fraser <simon.fraser@apple.com> 2 3 Focus event dispatched in iframe causes parent document to scroll incorrectly 4 https://bugs.webkit.org/show_bug.cgi?id=158629 5 rdar://problem/26521616 6 7 Reviewed by Enrica Casucci. 8 9 Tests for user-initiated and programmatic focus in frames. 10 11 * fast/forms/ios/focus-input-in-iframe-expected.txt: Added. 12 * fast/forms/ios/focus-input-in-iframe.html: Added. 13 * fast/forms/ios/programmatic-focus-input-in-iframe.html: Added. 14 * fast/forms/ios/programmatic-focus-input-in-iframe-expected.txt: Added. 15 1 16 2016-06-16 Zalan Bujtas <zalan@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r202146 r202147 1 2016-06-16 Simon Fraser <simon.fraser@apple.com> 2 3 [iOS] Focus event dispatched in iframe causes parent document to scroll incorrectly 4 https://bugs.webkit.org/show_bug.cgi?id=158629 5 rdar://problem/26521616 6 7 Reviewed by Enrica Casucci. 8 9 When focussing elements in iframes, the page could scroll to an incorrect location. 10 This happened because code in Element::focus() tried to disable scrolling on focus, 11 but did so only for the current frame, so ancestor frames got programmatically scrolled. 12 On iOS we handle the scrolling in the UI process, so never want the web process to 13 do programmatic scrolling. 14 15 Fix by changing the focus and cache restore code to use SelectionRevealMode::DoNotReveal, 16 rather than manually prohibiting frame scrolling. 17 18 Tests: fast/forms/ios/focus-input-in-iframe.html 19 fast/forms/ios/programmatic-focus-input-in-iframe.html 20 21 * dom/Element.cpp: 22 (WebCore::Element::focus): 23 * history/CachedPage.cpp: 24 (WebCore::CachedPage::restore): 25 1 26 2016-06-16 Zalan Bujtas <zalan@apple.com> 2 27 -
trunk/Source/WebCore/dom/Element.cpp
r202105 r202147 2246 2246 2247 2247 cancelFocusAppearanceUpdate(); 2248 2249 SelectionRevealMode revealMode = SelectionRevealMode::Reveal; 2248 2250 #if PLATFORM(IOS) 2249 2251 // Focusing a form element triggers animation in UIKit to scroll to the right position. … … 2253 2255 bool isFormControl = view && is<HTMLFormControlElement>(*this); 2254 2256 if (isFormControl) 2255 view->setProhibitsScrolling(true);2257 revealMode = SelectionRevealMode::DoNotReveal; 2256 2258 #endif 2257 updateFocusAppearance(restorePreviousSelection ? SelectionRestorationMode::Restore : SelectionRestorationMode::SetDefault); 2258 #if PLATFORM(IOS) 2259 if (isFormControl) 2260 view->setProhibitsScrolling(false); 2261 #endif 2259 updateFocusAppearance(restorePreviousSelection ? SelectionRestorationMode::Restore : SelectionRestorationMode::SetDefault, revealMode); 2262 2260 } 2263 2261 -
trunk/Source/WebCore/history/CachedPage.cpp
r201655 r202147 78 78 79 79 // Restore the focus appearance for the focused element. 80 // FIXME: Right now we don't support pages w / frames in the b/f cache.This may need to be tweaked when we add support for that.80 // FIXME: Right now we don't support pages with frames in the b/f cache. This may need to be tweaked when we add support for that. 81 81 Document* focusedDocument = page.focusController().focusedOrMainFrame().document(); 82 82 if (Element* element = focusedDocument->focusedElement()) { 83 SelectionRevealMode revealMode = SelectionRevealMode::Reveal; 83 84 #if PLATFORM(IOS) 84 85 // We don't want focused nodes changing scroll position when restoring from the cache 85 86 // as it can cause ugly jumps before we manage to restore the cached position. 86 87 page.mainFrame().selection().suppressScrolling(); 87 88 bool hadProhibitsScrolling = false; 89 FrameView* frameView = page.mainFrame().view(); 90 if (frameView) { 91 hadProhibitsScrolling = frameView->prohibitsScrolling(); 92 frameView->setProhibitsScrolling(true); 93 } 88 revealMode = SelectionRevealMode::DoNotReveal; 94 89 #endif 95 element->updateFocusAppearance(SelectionRestorationMode::Restore );90 element->updateFocusAppearance(SelectionRestorationMode::Restore, revealMode); 96 91 #if PLATFORM(IOS) 97 if (frameView)98 frameView->setProhibitsScrolling(hadProhibitsScrolling);99 92 page.mainFrame().selection().restoreScrolling(); 100 93 #endif
Note:
See TracChangeset
for help on using the changeset viewer.