Changeset 179902 in webkit
- Timestamp:
- Feb 10, 2015, 4:16:50 PM (12 years ago)
- Location:
- branches/safari-600.1.4.15-branch/Source/WebKit2
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
Shared/EditorState.cpp (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.h (modified) (3 diffs)
-
UIProcess/ios/WKContentViewInteraction.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.1.4.15-branch/Source/WebKit2/ChangeLog
r179399 r179902 1 2015-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 1 40 2015-01-28 David Kilzer <ddkilzer@apple.com> 2 41 -
branches/safari-600.1.4.15-branch/Source/WebKit2/Shared/EditorState.cpp
r171585 r179902 29 29 #include "Arguments.h" 30 30 #include "WebCoreArgumentCoders.h" 31 32 #if PLATFORM(IOS)33 #include <WebCore/SelectionRect.h>34 #endif35 31 36 32 namespace WebKit { -
branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r179001 r179902 29 29 30 30 #import "AssistedNodeInformation.h" 31 #import "EditorState.h" 31 32 #import "GestureTypes.h" 32 33 #import "InteractionInformationAtPosition.h" … … 74 75 75 76 namespace WebKit { 77 struct 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 }; 76 85 struct WKAutoCorrectionData { 77 86 String fontName; … … 131 140 132 141 CGPoint _lastInteractionLocation; 142 143 WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo; 133 144 134 145 BOOL _isEditable; -
branches/safari-600.1.4.15-branch/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r179301 r179902 83 83 using namespace WebKit; 84 84 85 namespace WebKit { 86 87 WKSelectionDrawingInfo::WKSelectionDrawingInfo() 88 : type(SelectionType::None) 89 { 90 } 91 92 WKSelectionDrawingInfo::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 109 inline 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 130 inline bool operator!=(const WKSelectionDrawingInfo& a, const WKSelectionDrawingInfo& b) 131 { 132 return !(a == b); 133 } 134 135 } // namespace WebKit 136 85 137 static const float highlightDelay = 0.12; 86 138 static const float tapAndHoldDelay = 0.75; … … 392 444 393 445 _selectionNeedsUpdate = YES; 394 [self _updateChangedSelection ];446 [self _updateChangedSelection:YES]; 395 447 [self _updateTapHighlight]; 396 448 } … … 2660 2712 - (void)_updateChangedSelection 2661 2713 { 2714 [self _updateChangedSelection:NO]; 2715 } 2716 2717 - (void)_updateChangedSelection:(BOOL)force 2718 { 2662 2719 if (!_selectionNeedsUpdate) 2663 2720 return; 2721 2722 WKSelectionDrawingInfo selectionDrawingInfo(_page->editorState()); 2723 if (!force && selectionDrawingInfo == _lastSelectionDrawingInfo) 2724 return; 2725 2726 _lastSelectionDrawingInfo = selectionDrawingInfo; 2664 2727 2665 2728 // 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.