Changeset 85356 in webkit


Ignore:
Timestamp:
Apr 29, 2011 1:42:11 PM (13 years ago)
Author:
jonlee@apple.com
Message:

2011-04-29 Jon Lee <jonlee@apple.com>

Reviewed by mitzpettel.

REGRESSION (WebKit2): (Mac) Selection is gone after switching tabs (59721)
<rdar://problem/9327332>
https://bugs.webkit.org/show_bug.cgi?id=59721

Removing shouldClearSelectionWhenLosingWebPageFocus(). Reverting changelist 83814.

  • WebCore.exp.in:
  • editing/EditingBehavior.h:

2011-04-29 Jon Lee <jonlee@apple.com>

Reviewed by mitzpettel.

REGRESSION (WebKit2): (Mac) Selection is gone after switching tabs (59721)
<rdar://problem/9327332>
https://bugs.webkit.org/show_bug.cgi?id=59721

When resigning first responder status, check to see if we need to maintain an inactive
selection in the web view. If we don't, we clear the selection.

This also reverts the change made in 83814, since that was a different attempt to solve this same issue.

  • UIProcess/API/C/WKPage.cpp: (WKPageSetMaintainsInactiveSelection): Export setMaintainsInactiveSelection()
  • UIProcess/API/C/WKPage.h:
  • UIProcess/API/mac/WKView.mm: (-[WKView resignFirstResponder]): Check and see if we need to maintain the selection in the view prior to resigning. If not, we clear the selection
  • UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::clearSelection): Send message across process boundary (WebKit::WebPageProxy::setMaintainsInactiveSelection): Sets variable
  • UIProcess/WebPageProxy.h: New member variable to keep track of whether we need to maintain the current selection (WebKit::WebPageProxy::maintainsInactiveSelection): Returns variable
  • WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::setFocused): Reverting code to just set the focused bit instead of also clearing the selection (WebKit::WebPage::clearSelection):
  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in: add new ClearSelection() message
Location:
trunk/Source
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85355 r85356  
     12011-04-29  Jon Lee  <jonlee@apple.com>
     2
     3        Reviewed by mitzpettel.
     4
     5        REGRESSION (WebKit2): (Mac) Selection is gone after switching tabs (59721)
     6        <rdar://problem/9327332>
     7        https://bugs.webkit.org/show_bug.cgi?id=59721
     8
     9        Removing shouldClearSelectionWhenLosingWebPageFocus().  Reverting changelist 83814.
     10
     11        * WebCore.exp.in:
     12        * editing/EditingBehavior.h:
     13
    1142011-04-29  Abhishek Arya  <inferno@chromium.org>
    215
  • trunk/Source/WebCore/WebCore.exp.in

    r85056 r85356  
    12491249__ZNK7WebCore6Editor7canCopyEv
    12501250__ZNK7WebCore6Editor7canEditEv
    1251 __ZNK7WebCore6Editor8behaviorEv
    12521251__ZNK7WebCore6Editor8canPasteEv
    12531252__ZNK7WebCore6Editor9canDeleteEv
  • trunk/Source/WebCore/editing/EditingBehavior.h

    r83814 r85356  
    6060    // On Mac, when processing a contextual click, the object being clicked upon should be selected.
    6161    bool shouldSelectOnContextualMenuClick() const { return m_type == EditingMacBehavior; }
    62    
    63     // On Mac, when the web view loses focus, any active selection clears. On Windows, the selection
    64     // should remain highlighted, just in an inactive state.
    65     bool shouldClearSelectionWhenLosingWebPageFocus() const { return m_type == EditingMacBehavior; }
    6662
    6763private:
  • trunk/Source/WebKit2/ChangeLog

    r85345 r85356  
     12011-04-29  Jon Lee  <jonlee@apple.com>
     2
     3        Reviewed by mitzpettel.
     4
     5        REGRESSION (WebKit2): (Mac) Selection is gone after switching tabs (59721)
     6        <rdar://problem/9327332>
     7        https://bugs.webkit.org/show_bug.cgi?id=59721
     8
     9        When resigning first responder status, check to see if we need to maintain an inactive
     10        selection in the web view. If we don't, we clear the selection.
     11
     12        This also reverts the change made in 83814, since that was a different attempt to solve this same issue.
     13
     14        * UIProcess/API/C/WKPage.cpp:
     15        (WKPageSetMaintainsInactiveSelection): Export setMaintainsInactiveSelection()
     16        * UIProcess/API/C/WKPage.h:
     17        * UIProcess/API/mac/WKView.mm:
     18        (-[WKView resignFirstResponder]): Check and see if we need to maintain the selection in the view prior to resigning.
     19        If not, we clear the selection
     20        * UIProcess/WebPageProxy.cpp:
     21        (WebKit::WebPageProxy::clearSelection): Send message across process boundary
     22        (WebKit::WebPageProxy::setMaintainsInactiveSelection): Sets variable
     23        * UIProcess/WebPageProxy.h: New member variable to keep track of whether we need to maintain the current selection
     24        (WebKit::WebPageProxy::maintainsInactiveSelection): Returns variable
     25        * WebProcess/WebPage/WebPage.cpp:
     26        (WebKit::WebPage::setFocused): Reverting code to just set the focused bit instead of also clearing the selection
     27        (WebKit::WebPage::clearSelection):
     28        * WebProcess/WebPage/WebPage.h:
     29        * WebProcess/WebPage/WebPage.messages.in: add new ClearSelection() message
     30
    1312011-04-29  Anders Carlsson  <andersca@apple.com>
    232
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r84519 r85356  
    335335}
    336336
     337void WKPageSetMaintainsInactiveSelection(WKPageRef pageRef, bool newValue)
     338{
     339    return toImpl(pageRef)->setMaintainsInactiveSelection(newValue);
     340}
     341
    337342void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount)
    338343{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.h

    r85120 r85356  
    347347WK_EXPORT bool WKPageIsContentEditable(WKPageRef page);
    348348
     349WK_EXPORT void WKPageSetMaintainsInactiveSelection(WKPageRef page, bool maintainsInactiveSelection);
     350   
    349351WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
    350352WK_EXPORT void WKPageHideFindUI(WKPageRef page);
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r84598 r85356  
    314314        _data->_page->confirmCompositionWithoutDisturbingSelection();
    315315    [self _resetTextInputState];
     316   
     317    if (!_data->_page->maintainsInactiveSelection())
     318        _data->_page->clearSelection();
    316319   
    317320    _data->_page->viewStateDidChange(WebPageProxy::ViewIsFocused);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r85339 r85356  
    643643    process()->send(Messages::WebPage::SetWindowResizerSize(windowResizerSize), m_pageID);
    644644}
     645   
     646void WebPageProxy::clearSelection()
     647{
     648    if (!isValid())
     649        return;
     650    process()->send(Messages::WebPage::ClearSelection(), m_pageID);
     651}
    645652
    646653void WebPageProxy::validateCommand(const String& commandName, PassRefPtr<ValidateCommandCallback> callback)
     
    654661    m_validateCommandCallbacks.set(callbackID, callback.get());
    655662    process()->send(Messages::WebPage::ValidateCommand(commandName, callbackID), m_pageID);
     663}
     664
     665void WebPageProxy::setMaintainsInactiveSelection(bool newValue)
     666{
     667    m_maintainsInactiveSelection = newValue;
    656668}
    657669   
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r85245 r85356  
    235235    void setInitialFocus(bool);
    236236    void setWindowResizerSize(const WebCore::IntSize&);
     237   
     238    void clearSelection();
    237239
    238240    void setViewNeedsDisplay(const WebCore::IntRect&);
     
    260262    bool hasSelectedRange() const { return m_editorState.selectionIsRange; }
    261263    bool isContentEditable() const { return m_editorState.isContentEditable; }
     264   
     265    bool maintainsInactiveSelection() const { return m_maintainsInactiveSelection; }
     266    void setMaintainsInactiveSelection(bool);
    262267
    263268#if PLATFORM(MAC)
     
    785790    bool m_canGoForward;
    786791    RefPtr<WebBackForwardList> m_backForwardList;
     792   
     793    bool m_maintainsInactiveSelection;
    787794
    788795    String m_toolTip;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r85259 r85356  
    7979#include <WebCore/DragController.h>
    8080#include <WebCore/DragData.h>
    81 #include <WebCore/EditingBehavior.h>
    8281#include <WebCore/EventHandler.h>
    8382#include <WebCore/FocusController.h>
     
    12071206void WebPage::setFocused(bool isFocused)
    12081207{
    1209     if (!isFocused && m_page->focusController()->focusedOrMainFrame()->editor()->behavior().shouldClearSelectionWhenLosingWebPageFocus())
    1210         m_page->focusController()->focusedOrMainFrame()->selection()->clear();
    1211 
    12121208    m_page->focusController()->setFocused(isFocused);
    12131209}
     
    18081804}
    18091805
     1806void WebPage::clearSelection()
     1807{
     1808    m_page->focusController()->focusedOrMainFrame()->selection()->clear();
     1809}
     1810
    18101811bool WebPage::mainFrameHasCustomRepresentation() const
    18111812{
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r84526 r85356  
    365365
    366366    void replaceSelectionWithText(WebCore::Frame*, const String&);
     367    void clearSelection();
    367368#if PLATFORM(WIN)
    368369    void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r84526 r85356  
    6868    DidReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)
    6969
     70    ClearSelection()
     71
    7072    # Callbacks.
    7173    GetContentsAsString(uint64_t callbackID)
Note: See TracChangeset for help on using the changeset viewer.