⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179902 in webkit


Ignore:
Timestamp:
Feb 10, 2015, 4:16:50 PM (12 years ago)
Author:
bshafiei@apple.com
Message:

Merged r179578. rdar://problem/19709204

Location:
branches/safari-600.1.4.15-branch/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-600.1.4.15-branch/Source/WebKit2/ChangeLog

    r179399 r179902  
     12015-02-10  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Merge r179578.
     4
     5    2015-02-03  Joseph Pecoraro  <pecoraro@apple.com>
     6
     7            [iOS] Selection Callout should not immediately disappear on pages with frequent layouts
     8            https://bugs.webkit.org/show_bug.cgi?id=141210
     9
     10            Reviewed by Enrica Casucci.
     11
     12            In iOS WebKit2 in order to keep caret refreshes in sync with WebCore layouts
     13            the selection assistant is told to update whenever WebKit's layer tree
     14            commits. Unfortunately, for pages with JavaScript animation that are
     15            frequently doing a layout / layer tree update, this would trigger very
     16            frequent selection updates that would keep the caret from blinking and
     17            dismiss any selection callouts.
     18
     19            This change tracks the last selection drawing information so that we can
     20            avoid informing the assistant of a selection updates unless it has changed
     21            visually or needs to redraw (zoom).
     22
     23            * Shared/EditorState.cpp:
     24            Remove include already in header.
     25
     26            * UIProcess/ios/WKContentViewInteraction.h:
     27            * UIProcess/ios/WKContentViewInteraction.mm:
     28            (WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo):
     29            (WebKit::operator==):
     30            (WebKit::operator!=):
     31            (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
     32            When zooming, force the selection update, even though the drawing
     33            information hasn't changed, the views will need to be updated.
     34
     35            (-[WKContentView _updateChangedSelection]):
     36            (-[WKContentView _updateChangedSelection:]):
     37            Monitor EditorState for changes in selection drawing and avoid
     38            informing the selection assistant unless necessary.
     39
    1402015-01-28  David Kilzer  <ddkilzer@apple.com>
    241
  • branches/safari-600.1.4.15-branch/Source/WebKit2/Shared/EditorState.cpp

    r171585 r179902  
    2929#include "Arguments.h"
    3030#include "WebCoreArgumentCoders.h"
    31 
    32 #if PLATFORM(IOS)
    33 #include <WebCore/SelectionRect.h>
    34 #endif
    3531
    3632namespace WebKit {
  • branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h

    r179001 r179902  
    2929
    3030#import "AssistedNodeInformation.h"
     31#import "EditorState.h"
    3132#import "GestureTypes.h"
    3233#import "InteractionInformationAtPosition.h"
     
    7475
    7576namespace WebKit {
     77struct WKSelectionDrawingInfo {
     78    enum class SelectionType { None, Plugin, Range };
     79    WKSelectionDrawingInfo();
     80    explicit WKSelectionDrawingInfo(const EditorState&);
     81    SelectionType type;
     82    WebCore::IntRect caretRect;
     83    Vector<WebCore::SelectionRect> selectionRects;
     84};
    7685struct WKAutoCorrectionData {
    7786    String fontName;
     
    131140
    132141    CGPoint _lastInteractionLocation;
     142
     143    WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo;
    133144
    134145    BOOL _isEditable;
  • branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm

    r179301 r179902  
    8383using namespace WebKit;
    8484
     85namespace WebKit {
     86
     87WKSelectionDrawingInfo::WKSelectionDrawingInfo()
     88    : type(SelectionType::None)
     89{
     90}
     91
     92WKSelectionDrawingInfo::WKSelectionDrawingInfo(const EditorState& editorState)
     93{
     94    if (editorState.selectionIsNone) {
     95        type = SelectionType::None;
     96        return;
     97    }
     98
     99    if (editorState.isInPlugin) {
     100        type = SelectionType::Plugin;
     101        return;
     102    }
     103
     104    type = SelectionType::Range;
     105    caretRect = editorState.caretRectAtEnd;
     106    selectionRects = editorState.selectionRects;
     107}
     108
     109inline bool operator==(const WKSelectionDrawingInfo& a, const WKSelectionDrawingInfo& b)
     110{
     111    if (a.type != b.type)
     112        return false;
     113
     114    if (a.type == WKSelectionDrawingInfo::SelectionType::Range) {
     115        if (a.caretRect != b.caretRect)
     116            return false;
     117
     118        if (a.selectionRects.size() != b.selectionRects.size())
     119            return false;
     120
     121        for (unsigned i = 0; i < a.selectionRects.size(); ++i) {
     122            if (a.selectionRects[i].rect() != b.selectionRects[i].rect())
     123                return false;
     124        }
     125    }
     126
     127    return true;
     128}
     129
     130inline bool operator!=(const WKSelectionDrawingInfo& a, const WKSelectionDrawingInfo& b)
     131{
     132    return !(a == b);
     133}
     134
     135} // namespace WebKit
     136
    85137static const float highlightDelay = 0.12;
    86138static const float tapAndHoldDelay  = 0.75;
     
    392444
    393445    _selectionNeedsUpdate = YES;
    394     [self _updateChangedSelection];
     446    [self _updateChangedSelection:YES];
    395447    [self _updateTapHighlight];
    396448}
     
    26602712- (void)_updateChangedSelection
    26612713{
     2714    [self _updateChangedSelection:NO];
     2715}
     2716
     2717- (void)_updateChangedSelection:(BOOL)force
     2718{
    26622719    if (!_selectionNeedsUpdate)
    26632720        return;
     2721
     2722    WKSelectionDrawingInfo selectionDrawingInfo(_page->editorState());
     2723    if (!force && selectionDrawingInfo == _lastSelectionDrawingInfo)
     2724        return;
     2725
     2726    _lastSelectionDrawingInfo = selectionDrawingInfo;
    26642727
    26652728    // FIXME: We need to figure out what to do if the selection is changed by Javascript.
Note: See TracChangeset for help on using the changeset viewer.