Changeset 202263 in webkit


Ignore:
Timestamp:
Jun 20, 2016 8:07:58 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r202243.
https://bugs.webkit.org/show_bug.cgi?id=158972

Broke Windows build and iOS tests (Requested by ap on
#webkit).

Reverted changeset:

"Focus event dispatched in iframe causes parent document to
scroll incorrectly"
https://bugs.webkit.org/show_bug.cgi?id=158629
http://trac.webkit.org/changeset/202243

Location:
trunk
Files:
4 deleted
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r202251 r202263  
     12016-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
    1162016-06-20  Zalan Bujtas  <zalan@apple.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r202262 r202263  
     12016-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
    1162016-06-20  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/Source/WebCore/dom/Document.h

    r202243 r202263  
    283283};
    284284
     285enum class SelectionRevealMode {
     286    Reveal,
     287    DoNotReveal
     288};
     289
    285290enum class HttpEquivPolicy {
    286291    Enabled,
  • trunk/Source/WebCore/dom/Element.cpp

    r202245 r202263  
    640640    // Align to the top / bottom and to the closest edge.
    641641    if (alignToTop)
    642         renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
     642        renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways);
    643643    else
    644         renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignBottomAlways);
     644        renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignBottomAlways);
    645645}
    646646
     
    654654    LayoutRect bounds = renderer()->anchorRect();
    655655    if (centerIfNeeded)
    656         renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
     656        renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
    657657    else
    658         renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
     658        renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
    659659}
    660660
     
    668668    LayoutRect bounds = renderer()->anchorRect();
    669669    if (centerIfNotVisible)
    670         renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, bounds, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible);
     670        renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible);
    671671    else
    672         renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, bounds, ScrollAlignment::alignToEdgeIfNotVisible, ScrollAlignment::alignToEdgeIfNotVisible);
     672        renderer()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNotVisible, ScrollAlignment::alignToEdgeIfNotVisible);
    673673}
    674674   
     
    22462246       
    22472247    cancelFocusAppearanceUpdate();
    2248 
    2249     SelectionRevealMode revealMode = SelectionRevealMode::Reveal;
    22502248#if PLATFORM(IOS)
    22512249    // Focusing a form element triggers animation in UIKit to scroll to the right position.
    22522250    // Calling updateFocusAppearance() would generate an unnecessary call to ScrollView::setScrollPosition(),
    22532251    // 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);
    22552254    if (isFormControl)
    2256         revealMode = SelectionRevealMode::RevealUpToMainFrame;
     2255        view->setProhibitsScrolling(true);
    22572256#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
    22602262}
    22612263
     
    22892291        if (frame->selection().shouldChangeSelection(newSelection)) {
    22902292            frame->selection().setSelection(newSelection, FrameSelection::defaultSetSelectionOptions(), Element::defaultFocusTextStateChangeIntent());
    2291             frame->selection().revealSelection(revealMode);
     2293            if (revealMode == SelectionRevealMode::Reveal)
     2294                frame->selection().revealSelection();
    22922295        }
    2293     } else if (renderer() && !renderer()->isWidget())
    2294         renderer()->scrollRectToVisible(revealMode, renderer()->anchorRect());
     2296    } else if (renderer() && !renderer()->isWidget() && revealMode == SelectionRevealMode::Reveal)
     2297        renderer()->scrollRectToVisible(renderer()->anchorRect());
    22952298}
    22962299
  • trunk/Source/WebCore/dom/Element.h

    r202245 r202263  
    6161};
    6262
    63 enum class SelectionRevealMode {
    64     Reveal,
    65     RevealUpToMainFrame, // Scroll overflow and iframes, but not the main frame.
    66     DoNotReveal
    67 };
    68 
    6963class Element : public ContainerNode {
    7064public:
  • trunk/Source/WebCore/editing/Editor.cpp

    r202243 r202263  
    12051205            if (Frame* editedFrame = document->frame())
    12061206                if (Page* page = editedFrame->page())
    1207                     page->focusController().focusedOrMainFrame().selection().revealSelection(SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded);
     1207                    page->focusController().focusedOrMainFrame().selection().revealSelection(ScrollAlignment::alignCenterIfNeeded);
    12081208        }
    12091209    }
     
    28002800        return;
    28012801
    2802     m_frame.selection().revealSelection(SelectionRevealMode::Reveal, alignment, revealExtentOption);
     2802    m_frame.selection().revealSelection(alignment, revealExtentOption);
    28032803}
    28042804
     
    31483148        return nullptr;
    31493149
    3150     nextMatch->firstNode()->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, nextMatch->absoluteBoundingBox(),
     3150    nextMatch->firstNode()->renderer()->scrollRectToVisible(nextMatch->absoluteBoundingBox(),
    31513151        ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded);
    31523152
  • trunk/Source/WebCore/editing/FrameSelection.cpp

    r202243 r202263  
    128128    , m_updateAppearanceEnabled(false)
    129129    , m_caretBlinks(true)
     130    , m_scrollingSuppressCount(0)
    130131#endif
    131132{
     
    388389            alignment = m_alwaysAlignCursorOnScrollWhenRevealingSelection ? ScrollAlignment::alignTopAlways : ScrollAlignment::alignToEdgeIfNeeded;
    389390
    390         revealSelection(SelectionRevealMode::Reveal, alignment, RevealExtent);
     391        revealSelection(alignment, RevealExtent);
    391392    }
    392393
     
    22902291}
    22912292
    2292 void FrameSelection::revealSelection(SelectionRevealMode revealMode, const ScrollAlignment& alignment, RevealExtentOption revealExtentOption)
    2293 {
    2294     if (revealMode == SelectionRevealMode::DoNotReveal)
    2295         return;
    2296 
     2293void FrameSelection::revealSelection(const ScrollAlignment& alignment, RevealExtentOption revealExtentOption)
     2294{
    22972295    LayoutRect rect;
    22982296
     
    23152313            if (!m_scrollingSuppressCount) {
    23162314                layer->setAdjustForIOSCaretWhenScrolling(true);
    2317                 layer->scrollRectToVisible(revealMode, rect, alignment, alignment);
     2315                layer->scrollRectToVisible(rect, alignment, alignment);
    23182316                layer->setAdjustForIOSCaretWhenScrolling(false);
    23192317                updateAppearance();
     
    23262324        // the selection rect could intersect more than just that.
    23272325        // See <rdar://problem/4799899>.
    2328         if (start.deprecatedNode()->renderer()->scrollRectToVisible(revealMode, rect, alignment, alignment))
     2326        if (start.deprecatedNode()->renderer()->scrollRectToVisible(rect, alignment, alignment))
    23292327            updateAppearance();
    23302328#endif
  • trunk/Source/WebCore/editing/FrameSelection.h

    r202243 r202263  
    2929#include "AXTextStateChangeIntent.h"
    3030#include "EditingStyle.h"
    31 #include "Element.h"
    3231#include "IntRect.h"
    3332#include "LayoutRect.h"
     
    268267    WEBCORE_EXPORT HTMLFormElement* currentForm() const;
    269268
    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);
    271270    WEBCORE_EXPORT void setSelectionFromNone();
    272271
     
    352351    bool m_caretBlinks : 1;
    353352    Color m_caretColor;
    354     int m_scrollingSuppressCount { 0 };
     353    int m_scrollingSuppressCount;
    355354#endif
    356355};
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r202245 r202263  
    405405        else
    406406            restoreCachedSelection();
    407         if (document().frame())
    408             document().frame()->selection().revealSelection(revealMode);
     407        if (document().frame() && revealMode == SelectionRevealMode::Reveal)
     408            document().frame()->selection().revealSelection();
    409409    } else
    410410        HTMLTextFormControlElement::updateFocusAppearance(restorationMode, revealMode);
  • trunk/Source/WebCore/html/HTMLTextAreaElement.cpp

    r202243 r202263  
    261261        restoreCachedSelection(Element::defaultFocusTextStateChangeIntent());
    262262
    263     if (document().frame())
    264         document().frame()->selection().revealSelection(revealMode);
     263    if (document().frame() && revealMode == SelectionRevealMode::Reveal)
     264        document().frame()->selection().revealSelection();
    265265}
    266266
  • trunk/Source/WebCore/page/ContextMenuController.cpp

    r202243 r202263  
    373373            RefPtr<ReplaceSelectionCommand> command = ReplaceSelectionCommand::create(*document, createFragmentFromMarkup(*document, title, ""), replaceOptions);
    374374            applyCommand(command);
    375             frame->selection().revealSelection(SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded);
     375            frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
    376376        }
    377377        break;
  • trunk/Source/WebCore/page/FrameView.cpp

    r202243 r202263  
    30513051    // Align to the top and to the closest side (this matches other browsers).
    30523052    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);
    30543054    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);
    30563056    else
    3057         anchorNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, rect, ScrollAlignment::alignLeftAlways, ScrollAlignment::alignToEdgeIfNeeded);
     3057        anchorNode->renderer()->scrollRectToVisible(rect, ScrollAlignment::alignLeftAlways, ScrollAlignment::alignToEdgeIfNeeded);
    30583058
    30593059    if (AXObjectCache* cache = frame().document()->existingAXObjectCache())
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r202243 r202263  
    8181#include "HitTestResult.h"
    8282#include "Logging.h"
    83 #include "MainFrame.h"
    8483#include "NoEventDispatchAssertion.h"
    8584#include "OverflowEvent.h"
     
    24922491}
    24932492
    2494 void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
     2493void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
    24952494{
    24962495    LOG_WITH_STREAM(Scrolling, stream << "Layer " << this << " scrollRectToVisible " << rect);
     
    25522551            }
    25532552        } else {
    2554             if (revealMode == SelectionRevealMode::RevealUpToMainFrame && frameView.frame().isMainFrame())
    2555                 return;
    2556 
    25572553#if !PLATFORM(IOS)
    25582554            LayoutRect viewRect = frameView.visibleContentRect();
     
    25792575   
    25802576    if (parentLayer)
    2581         parentLayer->scrollRectToVisible(revealMode, newRect, alignX, alignY);
     2577        parentLayer->scrollRectToVisible(newRect, alignX, alignY);
    25822578}
    25832579
     
    26722668{
    26732669    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);
    26752671}
    26762672
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r202243 r202263  
    206206    void availableContentSizeChanged(AvailableSizeChangeReason) override;
    207207
    208     void scrollRectToVisible(SelectionRevealMode, const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
     208    void scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
    209209
    210210    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  
    359359}
    360360
    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 
     361bool RenderObject::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
     362{
    366363    RenderLayer* enclosingLayer = this->enclosingLayer();
    367364    if (!enclosingLayer)
    368365        return false;
    369366
    370     enclosingLayer->scrollRectToVisible(revealMode, rect, alignX, alignY);
     367    enclosingLayer->scrollRectToVisible(rect, alignX, alignY);
    371368    return true;
    372369}
  • trunk/Source/WebCore/rendering/RenderObject.h

    r202243 r202263  
    156156
    157157    // 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);
    159159
    160160    // Convenience function for getting to the nearest enclosing box of a RenderObject.
  • trunk/Source/WebKit/mac/ChangeLog

    r202243 r202263  
     12016-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
    1162016-06-20  Simon Fraser  <simon.fraser@apple.com>
    217
  • trunk/Source/WebKit/mac/WebView/WebFrame.mm

    r202243 r202263  
    718718    if (startNode && startNode->renderer()) {
    719719#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);
    721721#else
    722722        RenderLayer* layer = startNode->renderer()->enclosingLayer();
    723723        if (layer) {
    724724            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);
    726726            layer->setAdjustForIOSCaretWhenScrolling(false);
    727727            _private->coreFrame->selection().setCaretRectNeedsUpdate();
     
    742742        if (layer) {
    743743            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);
    745745            layer->setAdjustForIOSCaretWhenScrolling(false);
    746746
     
    13761376    WebCore::Frame *frame = core(self);
    13771377    RevealExtentOption revealExtentOption = revealExtent ? RevealExtent : DoNotRevealExtent;
    1378     frame->selection().revealSelection(SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption);
     1378    frame->selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, revealExtentOption);
    13791379}
    13801380
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r202243 r202263  
    31473147
    31483148    if (Frame* coreFrame = core([self _frame]))
    3149         coreFrame->selection().revealSelection(SelectionRevealMode::Reveal, ScrollAlignment::alignCenterAlways);
     3149        coreFrame->selection().revealSelection(ScrollAlignment::alignCenterAlways);
    31503150}
    31513151
     
    53465346
    53475347    if (Frame* coreFrame = core([self _frame]))
    5348         coreFrame->selection().revealSelection(SelectionRevealMode::Reveal, ScrollAlignment::alignCenterAlways);
     5348        coreFrame->selection().revealSelection(ScrollAlignment::alignCenterAlways);
    53495349}
    53505350
  • trunk/Source/WebKit2/ChangeLog

    r202249 r202263  
     12016-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
    1162016-06-20  Brent Fulgham  <bfulgham@apple.com>
    217
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r202243 r202263  
    23972397{
    23982398    Frame& frame = m_page->focusController().focusedOrMainFrame();
    2399     frame.selection().revealSelection(SelectionRevealMode::Reveal, ScrollAlignment::alignCenterAlways);
     2399    frame.selection().revealSelection(ScrollAlignment::alignCenterAlways);
    24002400    m_findController.showFindIndicatorInSelection();
    24012401}
Note: See TracChangeset for help on using the changeset viewer.