Changeset 179578 in webkit
- Timestamp:
- Feb 3, 2015, 4:18:40 PM (12 years ago)
- Location:
- trunk/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
-
trunk/Source/WebKit2/ChangeLog
r179574 r179578 1 2015-02-03 Joseph Pecoraro <pecoraro@apple.com> 2 3 [iOS] Selection Callout should not immediately disappear on pages with frequent layouts 4 https://bugs.webkit.org/show_bug.cgi?id=141210 5 6 Reviewed by Enrica Casucci. 7 8 In iOS WebKit2 in order to keep caret refreshes in sync with WebCore layouts 9 the selection assistant is told to update whenever WebKit's layer tree 10 commits. Unfortunately, for pages with JavaScript animation that are 11 frequently doing a layout / layer tree update, this would trigger very 12 frequent selection updates that would keep the caret from blinking and 13 dismiss any selection callouts. 14 15 This change tracks the last selection drawing information so that we can 16 avoid informing the assistant of a selection updates unless it has changed 17 visually or needs to redraw (zoom). 18 19 * Shared/EditorState.cpp: 20 Remove include already in header. 21 22 * UIProcess/ios/WKContentViewInteraction.h: 23 * UIProcess/ios/WKContentViewInteraction.mm: 24 (WebKit::WKSelectionDrawingInfo::WKSelectionDrawingInfo): 25 (WebKit::operator==): 26 (WebKit::operator!=): 27 (-[WKContentView observeValueForKeyPath:ofObject:change:context:]): 28 When zooming, force the selection update, even though the drawing 29 information hasn't changed, the views will need to be updated. 30 31 (-[WKContentView _updateChangedSelection]): 32 (-[WKContentView _updateChangedSelection:]): 33 Monitor EditorState for changes in selection drawing and avoid 34 informing the selection assistant unless necessary. 35 1 36 2015-02-03 Jeremy Jones <jeremyj@apple.com> 2 37 -
trunk/Source/WebKit2/Shared/EditorState.cpp
r171203 r179578 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 { -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
r178080 r179578 29 29 30 30 #import "AssistedNodeInformation.h" 31 #import "EditorState.h" 31 32 #import "GestureTypes.h" 32 33 #import "InteractionInformationAtPosition.h" … … 72 73 73 74 namespace WebKit { 75 struct WKSelectionDrawingInfo { 76 enum class SelectionType { None, Plugin, Range }; 77 WKSelectionDrawingInfo(); 78 explicit WKSelectionDrawingInfo(const EditorState&); 79 SelectionType type; 80 WebCore::IntRect caretRect; 81 Vector<WebCore::SelectionRect> selectionRects; 82 }; 74 83 struct WKAutoCorrectionData { 75 84 String fontName; … … 129 138 130 139 CGPoint _lastInteractionLocation; 140 141 WebKit::WKSelectionDrawingInfo _lastSelectionDrawingInfo; 131 142 132 143 BOOL _isEditable; -
trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
r178980 r179578 66 66 using namespace WebKit; 67 67 68 namespace WebKit { 69 70 WKSelectionDrawingInfo::WKSelectionDrawingInfo() 71 : type(SelectionType::None) 72 { 73 } 74 75 WKSelectionDrawingInfo::WKSelectionDrawingInfo(const EditorState& editorState) 76 { 77 if (editorState.selectionIsNone) { 78 type = SelectionType::None; 79 return; 80 } 81 82 if (editorState.isInPlugin) { 83 type = SelectionType::Plugin; 84 return; 85 } 86 87 type = SelectionType::Range; 88 caretRect = editorState.caretRectAtEnd; 89 selectionRects = editorState.selectionRects; 90 } 91 92 inline bool operator==(const WKSelectionDrawingInfo& a, const WKSelectionDrawingInfo& b) 93 { 94 if (a.type != b.type) 95 return false; 96 97 if (a.type == WKSelectionDrawingInfo::SelectionType::Range) { 98 if (a.caretRect != b.caretRect) 99 return false; 100 101 if (a.selectionRects.size() != b.selectionRects.size()) 102 return false; 103 104 for (unsigned i = 0; i < a.selectionRects.size(); ++i) { 105 if (a.selectionRects[i].rect() != b.selectionRects[i].rect()) 106 return false; 107 } 108 } 109 110 return true; 111 } 112 113 inline bool operator!=(const WKSelectionDrawingInfo& a, const WKSelectionDrawingInfo& b) 114 { 115 return !(a == b); 116 } 117 118 } // namespace WebKit 119 68 120 static const float highlightDelay = 0.12; 69 121 static const float tapAndHoldDelay = 0.75; … … 383 435 384 436 _selectionNeedsUpdate = YES; 385 [self _updateChangedSelection ];437 [self _updateChangedSelection:YES]; 386 438 [self _updateTapHighlight]; 387 439 } … … 2756 2808 - (void)_updateChangedSelection 2757 2809 { 2810 [self _updateChangedSelection:NO]; 2811 } 2812 2813 - (void)_updateChangedSelection:(BOOL)force 2814 { 2758 2815 if (!_selectionNeedsUpdate) 2759 2816 return; 2817 2818 WKSelectionDrawingInfo selectionDrawingInfo(_page->editorState()); 2819 if (!force && selectionDrawingInfo == _lastSelectionDrawingInfo) 2820 return; 2821 2822 _lastSelectionDrawingInfo = selectionDrawingInfo; 2760 2823 2761 2824 // 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.