Changeset 200972 in webkit
- Timestamp:
- May 16, 2016, 3:20:16 PM (9 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r200966 r200972 1 2016-05-13 Enrica Casucci <enrica@apple.com> 2 3 Text selection is basically impossible on plain text pages. 4 https://bugs.webkit.org/show_bug.cgi?id=157681 5 rdar://problem/26065660 6 7 Reviewed by Darin Adler. 8 9 When dealing with a plain text file, the rules for deciding whether 10 a position is selectable should be different and we should never 11 switch to block selection. 12 13 * WebProcess/WebPage/ios/WebPageIOS.mm: 14 (WebKit::WebPage::shouldSwitchToBlockModeForHandle): 15 (WebKit::rectIsTooBigForSelection): Added helper function. 16 (WebKit::WebPage::selectTextWithGranularityAtPoint): 17 (WebKit::WebPage::getPositionInformation): 18 1 19 2016-05-16 Chelsea Pugh <cpugh@apple.com> 2 20 -
trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm
r200858 r200972 1659 1659 bool WebPage::shouldSwitchToBlockModeForHandle(const IntPoint& handlePoint, SelectionHandlePosition handlePosition) 1660 1660 { 1661 if (!m_blockRectForTextSelection.height()) 1662 return false; 1661 1663 switch (handlePosition) { 1662 1664 case SelectionHandlePosition::Top: … … 1860 1862 } 1861 1863 1864 static inline bool rectIsTooBigForSelection(const IntRect& blockRect, const Frame& frame) 1865 { 1866 const float factor = 0.97; 1867 return blockRect.height() > frame.view()->unobscuredContentRect().height() * factor; 1868 } 1869 1862 1870 void WebPage::selectTextWithGranularityAtPoint(const WebCore::IntPoint& point, uint32_t granularity, bool isInteractingWithAssistedNode, uint64_t callbackID) 1863 1871 { … … 1868 1876 m_blockSelectionDesiredSize.setHeight(blockSelectionStartHeight); 1869 1877 m_currentBlockSelection = nullptr; 1870 RefPtr<Range> paragraphRange = enclosingTextUnitOfGranularity(visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode), ParagraphGranularity, DirectionForward); 1871 if (paragraphRange && !paragraphRange->collapsed()) 1872 m_blockRectForTextSelection = selectionBoxForRange(paragraphRange.get()); 1878 auto* renderer = range->startContainer().renderer(); 1879 if (renderer->style().preserveNewline()) 1880 m_blockRectForTextSelection = renderer->absoluteBoundingBoxRect(true); 1881 else { 1882 auto* paragraphRange = enclosingTextUnitOfGranularity(visiblePositionInFocusedNodeForPoint(frame, point, isInteractingWithAssistedNode), ParagraphGranularity, DirectionForward).get(); 1883 if (paragraphRange && !paragraphRange->collapsed()) 1884 m_blockRectForTextSelection = selectionBoxForRange(paragraphRange); 1885 } 1886 1887 if (rectIsTooBigForSelection(m_blockRectForTextSelection, frame)) 1888 m_blockRectForTextSelection.setHeight(0); 1873 1889 } 1874 1890 … … 2389 2405 info.url = downcast<HTMLAttachmentElement>(*hitNode).file()->path(); 2390 2406 } else { 2391 const static CGFloat factor = 0.97; 2392 info.isSelectable = renderer->style().userSelect() != SELECT_NONE && info.bounds.height() < result.innerNodeFrame()->view()->unobscuredContentRect().height() * factor; 2407 info.isSelectable = renderer->style().userSelect() != SELECT_NONE; 2408 if (info.isSelectable && !hitNode->isTextNode()) 2409 info.isSelectable = !rectIsTooBigForSelection(info.bounds, *result.innerNodeFrame()); 2393 2410 } 2394 2411 }
Note:
See TracChangeset
for help on using the changeset viewer.