Changeset 202263 in webkit
- Timestamp:
- Jun 20, 2016 8:07:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202251 r202263 1 2016-06-20 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r202243. 4 https://bugs.webkit.org/show_bug.cgi?id=158972 5 6 Broke Windows build and iOS tests (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Focus event dispatched in iframe causes parent document to 12 scroll incorrectly" 13 https://bugs.webkit.org/show_bug.cgi?id=158629 14 http://trac.webkit.org/changeset/202243 15 1 16 2016-06-20 Zalan Bujtas <zalan@apple.com> 2 17 -
trunk/Source/WebCore/ChangeLog
r202262 r202263 1 2016-06-20 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r202243. 4 https://bugs.webkit.org/show_bug.cgi?id=158972 5 6 Broke Windows build and iOS tests (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Focus event dispatched in iframe causes parent document to 12 scroll incorrectly" 13 https://bugs.webkit.org/show_bug.cgi?id=158629 14 http://trac.webkit.org/changeset/202243 15 1 16 2016-06-20 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebCore/dom/Document.h
r202243 r202263 283 283 }; 284 284 285 enum class SelectionRevealMode { 286 Reveal, 287 DoNotReveal 288 }; 289 285 290 enum class HttpEquivPolicy { 286 291 Enabled, -
trunk/Source/WebCore/dom/Element.cpp
r202245 r202263 640 640 // Align to the top / bottom and to the closest edge. 641 641 if (alignToTop) 642 renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);642 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); 643 643 else 644 renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignBottomAlways);644 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignBottomAlways); 645 645 } 646 646 … … 654 654 LayoutRect bounds = renderer()->anchorRect(); 655 655 if (centerIfNeeded) 656 renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);656 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded); 657 657 else 658 renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);658 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 659 659 } 660 660 … … 668 668 LayoutRect bounds = renderer()->anchorRect(); 669 669 if (centerIfNotVisible) 670 renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,bounds, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible);670 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible); 671 671 else 672 renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,bounds, ScrollAlignment::alignToEdgeIfNotVisible, ScrollAlignment::alignToEdgeIfNotVisible);672 renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNotVisible, ScrollAlignment::alignToEdgeIfNotVisible); 673 673 } 674 674 … … 2246 2246 2247 2247 cancelFocusAppearanceUpdate(); 2248 2249 SelectionRevealMode revealMode = SelectionRevealMode::Reveal;2250 2248 #if PLATFORM(IOS) 2251 2249 // Focusing a form element triggers animation in UIKit to scroll to the right position. 2252 2250 // Calling updateFocusAppearance() would generate an unnecessary call to ScrollView::setScrollPosition(), 2253 2251 // which would jump us around during this animation. See <rdar://problem/6699741>. 2254 bool isFormControl = is<HTMLFormControlElement>(*this); 2252 FrameView* view = document().view(); 2253 bool isFormControl = view && is<HTMLFormControlElement>(*this); 2255 2254 if (isFormControl) 2256 revealMode = SelectionRevealMode::RevealUpToMainFrame;2255 view->setProhibitsScrolling(true); 2257 2256 #endif 2258 2259 updateFocusAppearance(restorePreviousSelection ? SelectionRestorationMode::Restore : SelectionRestorationMode::SetDefault, revealMode); 2257 updateFocusAppearance(restorePreviousSelection ? SelectionRestorationMode::Restore : SelectionRestorationMode::SetDefault); 2258 #if PLATFORM(IOS) 2259 if (isFormControl) 2260 view->setProhibitsScrolling(false); 2261 #endif 2260 2262 } 2261 2263 … … 2289 2291 if (frame->selection().shouldChangeSelection(newSelection)) { 2290 2292 frame->selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), Element::defaultFocusTextStateChangeIntent()); 2291 frame->selection().revealSelection(revealMode); 2293 if (revealMode == SelectionRevealMode::Reveal) 2294 frame->selection().revealSelection(); 2292 2295 } 2293 } else if (renderer() && !renderer()->isWidget() )2294 renderer()->scrollRectToVisible(re vealMode, renderer()->anchorRect());2296 } else if (renderer() && !renderer()->isWidget() && revealMode == SelectionRevealMode::Reveal) 2297 renderer()->scrollRectToVisible(renderer()->anchorRect()); 2295 2298 } 2296 2299 -
trunk/Source/WebCore/dom/Element.h
r202245 r202263 61 61 }; 62 62 63 enum class SelectionRevealMode {64 Reveal,65 RevealUpToMainFrame, // Scroll overflow and iframes, but not the main frame.66 DoNotReveal67 };68 69 63 class Element : public ContainerNode { 70 64 public: -
trunk/Source/WebCore/editing/Editor.cpp
r202243 r202263 1205 1205 if (Frame* editedFrame = document->frame()) 1206 1206 if (Page* page = editedFrame->page()) 1207 page->focusController().focusedOrMainFrame().selection().revealSelection(S electionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded);1207 page->focusController().focusedOrMainFrame().selection().revealSelection(ScrollAlignment::alignCenterIfNeeded); 1208 1208 } 1209 1209 } … … 2800 2800 return; 2801 2801 2802 m_frame.selection().revealSelection( SelectionRevealMode::Reveal,alignment, revealExtentOption);2802 m_frame.selection().revealSelection(alignment, revealExtentOption); 2803 2803 } 2804 2804 … … 3148 3148 return nullptr; 3149 3149 3150 nextMatch->firstNode()->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,nextMatch->absoluteBoundingBox(),3150 nextMatch->firstNode()->renderer()->scrollRectToVisible(nextMatch->absoluteBoundingBox(), 3151 3151 ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded); 3152 3152 -
trunk/Source/WebCore/editing/FrameSelection.cpp
r202243 r202263 128 128 , m_updateAppearanceEnabled(false) 129 129 , m_caretBlinks(true) 130 , m_scrollingSuppressCount(0) 130 131 #endif 131 132 { … … 388 389 alignment = m_alwaysAlignCursorOnScrollWhenRevealingSelection ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded; 389 390 390 revealSelection( SelectionRevealMode::Reveal,alignment, RevealExtent);391 revealSelection(alignment, RevealExtent); 391 392 } 392 393 … … 2290 2291 } 2291 2292 2292 void FrameSelection::revealSelection(SelectionRevealMode revealMode, const ScrollAlignment& alignment, RevealExtentOption revealExtentOption) 2293 { 2294 if (revealMode == SelectionRevealMode::DoNotReveal) 2295 return; 2296 2293 void FrameSelection::revealSelection(const ScrollAlignment& alignment, RevealExtentOption revealExtentOption) 2294 { 2297 2295 LayoutRect rect; 2298 2296 … … 2315 2313 if (!m_scrollingSuppressCount) { 2316 2314 layer->setAdjustForIOSCaretWhenScrolling(true); 2317 layer->scrollRectToVisible(re vealMode, rect, alignment, alignment);2315 layer->scrollRectToVisible(rect, alignment, alignment); 2318 2316 layer->setAdjustForIOSCaretWhenScrolling(false); 2319 2317 updateAppearance(); … … 2326 2324 // the selection rect could intersect more than just that. 2327 2325 // See <rdar://problem/4799899>. 2328 if (start.deprecatedNode()->renderer()->scrollRectToVisible(re vealMode, rect, alignment, alignment))2326 if (start.deprecatedNode()->renderer()->scrollRectToVisible(rect, alignment, alignment)) 2329 2327 updateAppearance(); 2330 2328 #endif -
trunk/Source/WebCore/editing/FrameSelection.h
r202243 r202263 29 29 #include "AXTextStateChangeIntent.h" 30 30 #include "EditingStyle.h" 31 #include "Element.h"32 31 #include "IntRect.h" 33 32 #include "LayoutRect.h" … … 268 267 WEBCORE_EXPORT HTMLFormElement* currentForm() const; 269 268 270 WEBCORE_EXPORT void revealSelection( SelectionRevealMode = SelectionRevealMode::Reveal,const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent);269 WEBCORE_EXPORT void revealSelection(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent); 271 270 WEBCORE_EXPORT void setSelectionFromNone(); 272 271 … … 352 351 bool m_caretBlinks : 1; 353 352 Color m_caretColor; 354 int m_scrollingSuppressCount { 0 };353 int m_scrollingSuppressCount; 355 354 #endif 356 355 }; -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r202245 r202263 405 405 else 406 406 restoreCachedSelection(); 407 if (document().frame() )408 document().frame()->selection().revealSelection( revealMode);407 if (document().frame() && revealMode == SelectionRevealMode::Reveal) 408 document().frame()->selection().revealSelection(); 409 409 } else 410 410 HTMLTextFormControlElement::updateFocusAppearance(restorationMode, revealMode); -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r202243 r202263 261 261 restoreCachedSelection(Element::defaultFocusTextStateChangeIntent()); 262 262 263 if (document().frame() )264 document().frame()->selection().revealSelection( revealMode);263 if (document().frame() && revealMode == SelectionRevealMode::Reveal) 264 document().frame()->selection().revealSelection(); 265 265 } 266 266 -
trunk/Source/WebCore/page/ContextMenuController.cpp
r202243 r202263 373 373 RefPtr<ReplaceSelectionCommand> command = ReplaceSelectionCommand::create(*document, createFragmentFromMarkup(*document, title, ""), replaceOptions); 374 374 applyCommand(command); 375 frame->selection().revealSelection(S electionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded);375 frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded); 376 376 } 377 377 break; -
trunk/Source/WebCore/page/FrameView.cpp
r202243 r202263 3051 3051 // Align to the top and to the closest side (this matches other browsers). 3052 3052 if (anchorNode->renderer()->style().isHorizontalWritingMode()) 3053 anchorNode->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,rect, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);3053 anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); 3054 3054 else if (anchorNode->renderer()->style().isFlippedBlocksWritingMode()) 3055 anchorNode->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,rect, ScrollAlignment::alignRightAlways, ScrollAlignment::alignToEdgeIfNeeded);3055 anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignRightAlways, ScrollAlignment::alignToEdgeIfNeeded); 3056 3056 else 3057 anchorNode->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,rect, ScrollAlignment::alignLeftAlways, ScrollAlignment::alignToEdgeIfNeeded);3057 anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignLeftAlways, ScrollAlignment::alignToEdgeIfNeeded); 3058 3058 3059 3059 if (AXObjectCache* cache = frame().document()->existingAXObjectCache()) -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r202243 r202263 81 81 #include "HitTestResult.h" 82 82 #include "Logging.h" 83 #include "MainFrame.h"84 83 #include "NoEventDispatchAssertion.h" 85 84 #include "OverflowEvent.h" … … 2492 2491 } 2493 2492 2494 void RenderLayer::scrollRectToVisible( SelectionRevealMode revealMode,const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)2493 void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) 2495 2494 { 2496 2495 LOG_WITH_STREAM(Scrolling, stream << "Layer " << this << " scrollRectToVisible " << rect); … … 2552 2551 } 2553 2552 } else { 2554 if (revealMode == SelectionRevealMode::RevealUpToMainFrame && frameView.frame().isMainFrame())2555 return;2556 2557 2553 #if !PLATFORM(IOS) 2558 2554 LayoutRect viewRect = frameView.visibleContentRect(); … … 2579 2575 2580 2576 if (parentLayer) 2581 parentLayer->scrollRectToVisible( revealMode,newRect, alignX, alignY);2577 parentLayer->scrollRectToVisible(newRect, alignX, alignY); 2582 2578 } 2583 2579 … … 2672 2668 { 2673 2669 IntPoint currentDocumentPosition = renderer().view().frameView().windowToContents(position); 2674 scrollRectToVisible( SelectionRevealMode::Reveal,LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);2670 scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 2675 2671 } 2676 2672 -
trunk/Source/WebCore/rendering/RenderLayer.h
r202243 r202263 206 206 void availableContentSizeChanged(AvailableSizeChangeReason) override; 207 207 208 void scrollRectToVisible( SelectionRevealMode,const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY);208 void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY); 209 209 210 210 LayoutRect getRectToExpose(const LayoutRect& visibleRect, const LayoutRect& visibleRectRelativeToDocument, const LayoutRect& exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r202243 r202263 359 359 } 360 360 361 bool RenderObject::scrollRectToVisible(SelectionRevealMode revealMode, const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) 362 { 363 if (revealMode == SelectionRevealMode::DoNotReveal) 364 return false; 365 361 bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY) 362 { 366 363 RenderLayer* enclosingLayer = this->enclosingLayer(); 367 364 if (!enclosingLayer) 368 365 return false; 369 366 370 enclosingLayer->scrollRectToVisible(re vealMode, rect, alignX, alignY);367 enclosingLayer->scrollRectToVisible(rect, alignX, alignY); 371 368 return true; 372 369 } -
trunk/Source/WebCore/rendering/RenderObject.h
r202243 r202263 156 156 157 157 // Scrolling is a RenderBox concept, however some code just cares about recursively scrolling our enclosing ScrollableArea(s). 158 WEBCORE_EXPORT bool scrollRectToVisible( SelectionRevealMode,const LayoutRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded);158 WEBCORE_EXPORT bool scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded); 159 159 160 160 // Convenience function for getting to the nearest enclosing box of a RenderObject. -
trunk/Source/WebKit/mac/ChangeLog
r202243 r202263 1 2016-06-20 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r202243. 4 https://bugs.webkit.org/show_bug.cgi?id=158972 5 6 Broke Windows build and iOS tests (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Focus event dispatched in iframe causes parent document to 12 scroll incorrectly" 13 https://bugs.webkit.org/show_bug.cgi?id=158629 14 http://trac.webkit.org/changeset/202243 15 1 16 2016-06-20 Simon Fraser <simon.fraser@apple.com> 2 17 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r202243 r202263 718 718 if (startNode && startNode->renderer()) { 719 719 #if !PLATFORM(IOS) 720 startNode->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);720 startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 721 721 #else 722 722 RenderLayer* layer = startNode->renderer()->enclosingLayer(); 723 723 if (layer) { 724 724 layer->setAdjustForIOSCaretWhenScrolling(true); 725 startNode->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);725 startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 726 726 layer->setAdjustForIOSCaretWhenScrolling(false); 727 727 _private->coreFrame->selection().setCaretRectNeedsUpdate(); … … 742 742 if (layer) { 743 743 layer->setAdjustForIOSCaretWhenScrolling(true); 744 startNode->renderer()->scrollRectToVisible( SelectionRevealMode::Reveal,enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);744 startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded); 745 745 layer->setAdjustForIOSCaretWhenScrolling(false); 746 746 … … 1376 1376 WebCore::Frame *frame = core(self); 1377 1377 RevealExtentOption revealExtentOption = revealExtent ? RevealExtent : DoNotRevealExtent; 1378 frame->selection().revealSelection(S electionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption);1378 frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption); 1379 1379 } 1380 1380 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r202243 r202263 3147 3147 3148 3148 if (Frame* coreFrame = core([self _frame])) 3149 coreFrame->selection().revealSelection(S electionRevealMode::Reveal, ScrollAlignment::alignCenterAlways);3149 coreFrame->selection().revealSelection(ScrollAlignment::alignCenterAlways); 3150 3150 } 3151 3151 … … 5346 5346 5347 5347 if (Frame* coreFrame = core([self _frame])) 5348 coreFrame->selection().revealSelection(S electionRevealMode::Reveal, ScrollAlignment::alignCenterAlways);5348 coreFrame->selection().revealSelection(ScrollAlignment::alignCenterAlways); 5349 5349 } 5350 5350 -
trunk/Source/WebKit2/ChangeLog
r202249 r202263 1 2016-06-20 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, rolling out r202243. 4 https://bugs.webkit.org/show_bug.cgi?id=158972 5 6 Broke Windows build and iOS tests (Requested by ap on 7 #webkit). 8 9 Reverted changeset: 10 11 "Focus event dispatched in iframe causes parent document to 12 scroll incorrectly" 13 https://bugs.webkit.org/show_bug.cgi?id=158629 14 http://trac.webkit.org/changeset/202243 15 1 16 2016-06-20 Brent Fulgham <bfulgham@apple.com> 2 17 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r202243 r202263 2397 2397 { 2398 2398 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2399 frame.selection().revealSelection(S electionRevealMode::Reveal, ScrollAlignment::alignCenterAlways);2399 frame.selection().revealSelection(ScrollAlignment::alignCenterAlways); 2400 2400 m_findController.showFindIndicatorInSelection(); 2401 2401 }
Note: See TracChangeset
for help on using the changeset viewer.