Changeset 214174 in webkit
- Timestamp:
- Mar 20, 2017 10:32:48 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r214173 r214174 1 2017-03-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 TextIndicator should support a mode where selection rects are used to size the snapshot 4 https://bugs.webkit.org/show_bug.cgi?id=169845 5 <rdar://problem/31127818> 6 7 Reviewed by Beth Dakin. 8 9 Adds TextIndicator support in iOS for using the would-be selection rects of a given range to determine 10 snapshotting bounds. See below changes for more details. 11 12 * dom/Range.cpp: 13 (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines): 14 (WebCore::Range::collectSelectionRects): 15 16 Mark these helper methods as const. 17 18 * dom/Range.h: 19 * page/TextIndicator.cpp: 20 (WebCore::getSelectionRectsForRange): 21 (WebCore::initializeIndicator): 22 23 If TextIndicatorOptionUseSelectionRectForSizing is enabled, then compute selection rects and set the text rects 24 to be the resulting selection rects. These are in document coordinates. 25 26 * page/TextIndicator.h: 27 1 28 2017-03-20 Simon Fraser <simon.fraser@apple.com> 2 29 -
trunk/Source/WebCore/dom/Range.cpp
r213355 r214174 1267 1267 // This function is similar in spirit to addLineBoxRects, but annotates the returned rectangles 1268 1268 // with additional state which helps iOS draw selections in its unique way. 1269 int Range::collectSelectionRectsWithoutUnionInteriorLines(Vector<SelectionRect>& rects) 1269 int Range::collectSelectionRectsWithoutUnionInteriorLines(Vector<SelectionRect>& rects) const 1270 1270 { 1271 1271 auto& startContainer = this->startContainer(); … … 1427 1427 } 1428 1428 1429 void Range::collectSelectionRects(Vector<SelectionRect>& rects) 1429 void Range::collectSelectionRects(Vector<SelectionRect>& rects) const 1430 1430 { 1431 1431 int maxLineNumber = collectSelectionRectsWithoutUnionInteriorLines(rects); -
trunk/Source/WebCore/dom/Range.h
r211356 r214174 125 125 WEBCORE_EXPORT FloatRect absoluteBoundingRect() const; 126 126 #if PLATFORM(IOS) 127 WEBCORE_EXPORT void collectSelectionRects(Vector<SelectionRect>&) ;128 WEBCORE_EXPORT int collectSelectionRectsWithoutUnionInteriorLines(Vector<SelectionRect>&) ;127 WEBCORE_EXPORT void collectSelectionRects(Vector<SelectionRect>&) const; 128 WEBCORE_EXPORT int collectSelectionRectsWithoutUnionInteriorLines(Vector<SelectionRect>&) const; 129 129 #endif 130 130 -
trunk/Source/WebCore/page/TextIndicator.cpp
r214111 r214174 42 42 #include "RenderObject.h" 43 43 44 #if PLATFORM(IOS) 45 #include "SelectionRect.h" 46 #endif 47 44 48 using namespace WebCore; 45 49 … … 184 188 } 185 189 190 #if PLATFORM(IOS) 191 192 static void getSelectionRectsForRange(Vector<FloatRect>& resultingRects, const Range& range) 193 { 194 Vector<SelectionRect> selectionRectsForRange; 195 Vector<FloatRect> selectionRectsForRangeInBoundingRectCoordinates; 196 range.collectSelectionRects(selectionRectsForRange); 197 for (auto selectionRect : selectionRectsForRange) 198 resultingRects.append(selectionRect.rect()); 199 } 200 201 #endif 202 186 203 static bool initializeIndicator(TextIndicatorData& data, Frame& frame, const Range& range, FloatSize margin, bool indicatesCurrentSelection) 187 204 { … … 198 215 if ((data.options & TextIndicatorOptionUseBoundingRectAndPaintAllContentForComplexRanges) && hasNonInlineOrReplacedElements(range)) 199 216 data.options |= TextIndicatorOptionPaintAllContent; 217 #if PLATFORM(IOS) 218 else if (data.options & TextIndicatorOptionUseSelectionRectForSizing) 219 getSelectionRectsForRange(textRects, range); 220 #endif 200 221 else { 201 222 if (data.options & TextIndicatorOptionDoNotClipToVisibleRect) -
trunk/Source/WebCore/page/TextIndicator.h
r213614 r214174 84 84 // Include an additional snapshot of everything in view, with the exception of nodes within the currently selected range. 85 85 TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection = 1 << 8, 86 87 // By default, TextIndicator uses text rects to size the snapshot. Enabling this flag causes it to use the bounds of the 88 // selection rects that would enclose the given Range instead. 89 // Currently, this is only supported on iOS. 90 TextIndicatorOptionUseSelectionRectForSizing = 1 << 9, 86 91 }; 87 92 typedef uint16_t TextIndicatorOptions; -
trunk/Source/WebKit2/ChangeLog
r214163 r214174 1 2017-03-20 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 TextIndicator should support a mode where selection rects are used to size the snapshot 4 https://bugs.webkit.org/show_bug.cgi?id=169845 5 <rdar://problem/31127818> 6 7 Reviewed by Beth Dakin. 8 9 Adopt the new TextIndicatorOptionUseSelectionRectForSizing flag when generating an edit data interaction snapshot. 10 11 * WebProcess/WebPage/ios/WebPageIOS.mm: 12 (WebKit::WebPage::didConcludeEditDataInteraction): 13 1 14 2017-03-20 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r214003 r214174 632 632 std::optional<TextIndicatorData> textIndicatorData; 633 633 634 static auto defaultEditDragTextIndicatorOptions = TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection | TextIndicatorOptionDoNotClipToVisibleRect | TextIndicatorOptionPaintAllContent | TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionPaintBackgrounds | TextIndicatorOption IncludeSnapshotWithSelectionHighlight;634 static auto defaultEditDragTextIndicatorOptions = TextIndicatorOptionIncludeSnapshotOfAllVisibleContentWithoutSelection | TextIndicatorOptionDoNotClipToVisibleRect | TextIndicatorOptionPaintAllContent | TextIndicatorOptionIncludeMarginIfRangeMatchesSelection | TextIndicatorOptionPaintBackgrounds | TextIndicatorOptionUseSelectionRectForSizing | TextIndicatorOptionIncludeSnapshotWithSelectionHighlight; 635 635 auto& frame = m_page->focusController().focusedOrMainFrame(); 636 636 if (auto range = frame.selection().selection().toNormalizedRange()) {
Note: See TracChangeset
for help on using the changeset viewer.