Changeset 247398 in webkit
- Timestamp:
- Jul 12, 2019 2:35:08 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247391 r247398 169 169 https://bugs.webkit.org/show_bug.cgi?id=199644 170 170 https://trac.webkit.org/changeset/247314 171 172 2019-07-11 Simon Fraser <simon.fraser@apple.com> 173 174 [iOS WK2] Can't place caret or select in content that overflows a contenteditable element 175 https://bugs.webkit.org/show_bug.cgi?id=199741 176 rdar://problem/50545233 177 178 Reviewed by Wenson Hsieh. 179 180 Re-enable editing/caret/ios, fixing the result of emoji.html which for some reason was 181 checked in as an html file (the test still fails). 182 183 * editing/caret/ios/caret-in-overflow-area-expected.txt: Added. 184 * editing/caret/ios/caret-in-overflow-area.html: Added. 185 * editing/caret/ios/emoji-expected.txt: Renamed from LayoutTests/editing/caret/ios/emoji-expected.html. 186 * editing/caret/ios/fixed-caret-position-after-scroll-expected.txt: 187 * editing/caret/ios/fixed-caret-position-after-scroll.html: 188 * editing/selection/ios/place-selection-in-overflow-area-expected.txt: Added. 189 * editing/selection/ios/place-selection-in-overflow-area.html: Added. 190 * editing/selection/ios/selection-extends-into-overflow-area-expected.txt: Added. 191 * editing/selection/ios/selection-extends-into-overflow-area.html: Added. 192 * platform/ios-wk2/TestExpectations: 171 193 172 194 2019-07-11 Ryan Haddad <ryanhaddad@apple.com> -
trunk/LayoutTests/editing/caret/ios/fixed-caret-position-after-scroll-expected.txt
r221064 r247398 4 4 PASS initialCaretRect.height is 15 5 5 PASS finalCaretRect.left is 6 6 PASS finalCaretRect.top is 50216 PASS finalCaretRect.top is 4977 7 7 PASS finalCaretRect.width is 3 8 8 PASS finalCaretRect.height is 15 -
trunk/LayoutTests/editing/caret/ios/fixed-caret-position-after-scroll.html
r235893 r247398 52 52 finalCaretRect = rect; 53 53 shouldBe("finalCaretRect.left", "6"); 54 shouldBe("finalCaretRect.top", " 5021");54 shouldBe("finalCaretRect.top", "4977"); 55 55 shouldBe("finalCaretRect.width", "3"); 56 56 shouldBe("finalCaretRect.height", "15"); -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r247371 r247398 19 19 scrollingcoordinator/mac [ Skip ] 20 20 fast/web-share [ Pass ] 21 editing/caret/ios [ Pass ] 21 22 editing/find [ Pass ] 22 23 editing/input/ios [ Pass ] … … 695 696 editing/undo/undo-misspellings.html [ Failure ] 696 697 editing/undo/undo-typing-001.html [ Failure ] 698 editing/caret/ios/emoji.html [ Failure ] 697 699 698 700 # Editing tests that time out: -
trunk/Source/WebCore/ChangeLog
r247397 r247398 498 498 499 499 * platform/graphics/cocoa/IOSurface.h: 500 501 2019-07-11 Simon Fraser <simon.fraser@apple.com> 502 503 [iOS WK2] Can't place caret or select in content that overflows a contenteditable element 504 https://bugs.webkit.org/show_bug.cgi?id=199741 505 rdar://problem/50545233 506 507 Reviewed by Wenson Hsieh. 508 509 Various code paths for editing used renderer->absoluteBoundingBoxRect(), which is the border 510 box of the element (or a set of line boxes for inline elements) converted to absolute 511 coordinates. This excludes overflow content, but contenteditable needs to be able to 512 place the caret in overflow content, and allow selection rects to be in the overflow area 513 (if the element has visible overflow). 514 515 Try to clean this up by adding some static helpers on WebPage for accessing the relevant 516 rects, and use them in code call from visiblePositionInFocusedNodeForPoint(), and 517 code that is input to selectionClipRect. 518 519 This changes selectionClipRect to use the padding box (excluding borders), which is a progression. 520 521 Tests: editing/caret/ios/caret-in-overflow-area.html 522 editing/selection/ios/place-selection-in-overflow-area.html 523 editing/selection/ios/selection-extends-into-overflow-area.html 524 525 * editing/FrameSelection.cpp: 526 (WebCore::DragCaretController::editableElementRectInRootViewCoordinates const): 500 527 501 528 2019-07-11 Jonathan Bedard <jbedard@apple.com> -
trunk/Source/WebCore/editing/FrameSelection.cpp
r246948 r247398 134 134 135 135 if (auto* view = editableContainer->document().view()) 136 return view->contentsToRootView(renderer->absoluteBoundingBoxRect()); 136 return view->contentsToRootView(renderer->absoluteBoundingBoxRect()); // FIXME: Wrong for elements with visible layout overflow. 137 137 138 138 return { }; -
trunk/Source/WebKit/ChangeLog
r247396 r247398 208 208 * UIProcess/ios/WebPageProxyIOS.mm: 209 209 (WebKit::desktopClassBrowsingRecommendedForRequest): 210 211 2019-07-11 Simon Fraser <simon.fraser@apple.com> 212 213 [iOS WK2] Can't place caret or select in content that overflows a contenteditable element 214 https://bugs.webkit.org/show_bug.cgi?id=199741 215 rdar://problem/50545233 216 217 Reviewed by Wenson Hsieh. 218 219 Various code paths for editing used renderer->absoluteBoundingBoxRect(), which is the border 220 box of the element (or a set of line boxes for inline elements) converted to absolute 221 coordinates. This excludes overflow content, but contenteditable needs to be able to 222 place the caret in overflow content, and allow selection rects to be in the overflow area 223 (if the element has visible overflow). 224 225 Try to clean this up by adding some static helpers on WebPage for accessing the relevant 226 rects, and use them in code call from visiblePositionInFocusedNodeForPoint(), and 227 code that is input to selectionClipRect. 228 229 This changes selectionClipRect to use the padding box (excluding borders), which is a progression. 230 231 * WebProcess/WebPage/WebPage.h: 232 * WebProcess/WebPage/ios/WebPageIOS.mm: 233 (WebKit::WebPage::platformEditorState const): 234 (WebKit::elementBoundsInFrame): 235 (WebKit::constrainPoint): 236 (WebKit::WebPage::rootViewBoundsForElement): 237 (WebKit::WebPage::absoluteInteractionBoundsForElement): 238 (WebKit::WebPage::rootViewInteractionBoundsForElement): 239 (WebKit::WebPage::dispatchSyntheticMouseEventsForSelectionGesture): 240 (WebKit::WebPage::getFocusedElementInformation): 241 (WebKit::innerFrameQuad): Deleted. 242 (WebKit::elementRectInRootViewCoordinates): Deleted. 210 243 211 244 2019-07-11 Jonathan Bedard <jbedard@apple.com> -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r247367 r247398 1203 1203 bool firstFlushAfterCommit() const { return m_firstFlushAfterCommit; } 1204 1204 void setFirstFlushAfterCommit(bool f) { m_firstFlushAfterCommit = f; } 1205 1205 1206 #if PLATFORM(IOS_FAMILY) 1207 // This excludes layout overflow, includes borders. 1208 static WebCore::IntRect rootViewBoundsForElement(const WebCore::Element&); 1209 // These include layout overflow for overflow:visible elements, but exclude borders. 1210 static WebCore::IntRect absoluteInteractionBoundsForElement(const WebCore::Element&); 1211 static WebCore::IntRect rootViewInteractionBoundsForElement(const WebCore::Element&); 1212 #endif // PLATFORM(IOS_FAMILY) 1213 1206 1214 private: 1207 1215 WebPage(WebCore::PageIdentifier, WebPageCreationParameters&&); … … 1236 1244 1237 1245 static void convertSelectionRectsToRootView(WebCore::FrameView*, Vector<WebCore::SelectionRect>&); 1246 1238 1247 void getFocusedElementInformation(FocusedElementInformation&); 1239 1248 void platformInitializeAccessibility(); -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r247369 r247398 265 265 if (m_focusedElement && m_focusedElement->renderer()) { 266 266 auto& renderer = *m_focusedElement->renderer(); 267 postLayoutData.focusedElementRect = view->contentsToRootView(renderer.absoluteBoundingBoxRect());267 postLayoutData.focusedElementRect = rootViewInteractionBoundsForElement(*m_focusedElement); 268 268 postLayoutData.caretColor = renderer.style().caretColor(); 269 269 } … … 1249 1249 } 1250 1250 1251 static FloatQuad innerFrameQuad(const Frame& frame, const Element& focusedElement)1251 static IntRect elementBoundsInFrame(const Frame& frame, const Element& focusedElement) 1252 1252 { 1253 1253 frame.document()->updateLayoutIgnorePendingStylesheets(); 1254 RenderElement* renderer = nullptr;1254 1255 1255 if (focusedElement.hasTagName(HTMLNames::textareaTag) || focusedElement.hasTagName(HTMLNames::inputTag) || focusedElement.hasTagName(HTMLNames::selectTag)) 1256 renderer = focusedElement.renderer(); 1257 else if (auto* rootEditableElement = focusedElement.rootEditableElement()) 1258 renderer = rootEditableElement->renderer(); 1259 1260 if (!renderer) 1261 return FloatQuad(); 1262 1263 auto& style = renderer->style(); 1264 IntRect boundingBox = renderer->absoluteBoundingBoxRect(true /* use transforms*/); 1265 1266 boundingBox.move(style.borderLeftWidth(), style.borderTopWidth()); 1267 boundingBox.setWidth(boundingBox.width() - style.borderLeftWidth() - style.borderRightWidth()); 1268 boundingBox.setHeight(boundingBox.height() - style.borderBottomWidth() - style.borderTopWidth()); 1269 1270 return FloatQuad(boundingBox); 1256 return WebPage::absoluteInteractionBoundsForElement(focusedElement); 1257 1258 if (auto* rootEditableElement = focusedElement.rootEditableElement()) 1259 return WebPage::absoluteInteractionBoundsForElement(*rootEditableElement); 1260 1261 return { }; 1271 1262 } 1272 1263 … … 1275 1266 ASSERT(&focusedElement.document() == frame.document()); 1276 1267 const int DEFAULT_CONSTRAIN_INSET = 2; 1277 IntRect innerFrame = innerFrameQuad(frame, focusedElement).enclosingBoundingBox();1268 IntRect innerFrame = elementBoundsInFrame(frame, focusedElement); 1278 1269 IntPoint constrainedPoint = point; 1279 1270 … … 1569 1560 } 1570 1561 1571 static IntRect elementRectInRootViewCoordinates(const Element& element)1562 IntRect WebPage::rootViewBoundsForElement(const Element& element) 1572 1563 { 1573 1564 auto* frame = element.document().frame(); … … 1586 1577 } 1587 1578 1579 IntRect WebPage::absoluteInteractionBoundsForElement(const Element& element) 1580 { 1581 auto* frame = element.document().frame(); 1582 if (!frame) 1583 return { }; 1584 1585 auto* view = frame->view(); 1586 if (!view) 1587 return { }; 1588 1589 auto* renderer = element.renderer(); 1590 if (!renderer) 1591 return { }; 1592 1593 if (is<RenderBox>(*renderer)) { 1594 auto& box = downcast<RenderBox>(*renderer); 1595 1596 FloatRect rect; 1597 // FIXME: want borders or not? 1598 if (box.style().isOverflowVisible()) 1599 rect = box.layoutOverflowRect(); 1600 else 1601 rect = box.clientBoxRect(); 1602 return box.localToAbsoluteQuad(rect).enclosingBoundingBox(); 1603 } 1604 1605 auto& style = renderer->style(); 1606 FloatRect boundingBox = renderer->absoluteBoundingBoxRect(true /* use transforms*/); 1607 // This is wrong. It's subtracting borders after converting to absolute coords on something that probably doesn't represent a rectangular element. 1608 boundingBox.move(style.borderLeftWidth(), style.borderTopWidth()); 1609 boundingBox.setWidth(boundingBox.width() - style.borderLeftWidth() - style.borderRightWidth()); 1610 boundingBox.setHeight(boundingBox.height() - style.borderBottomWidth() - style.borderTopWidth()); 1611 return enclosingIntRect(boundingBox); 1612 } 1613 1614 IntRect WebPage::rootViewInteractionBoundsForElement(const Element& element) 1615 { 1616 auto* frame = element.document().frame(); 1617 if (!frame) 1618 return { }; 1619 1620 auto* view = frame->view(); 1621 if (!view) 1622 return { }; 1623 1624 return view->contentsToRootView(absoluteInteractionBoundsForElement(element)); 1625 } 1626 1588 1627 void WebPage::clearSelection() 1589 1628 { … … 1600 1639 IntRect focusedElementRect; 1601 1640 if (m_focusedElement) 1602 focusedElementRect = elementRectInRootViewCoordinates(*m_focusedElement);1641 focusedElementRect = rootViewInteractionBoundsForElement(*m_focusedElement); 1603 1642 1604 1643 if (focusedElementRect.isEmpty()) … … 2835 2874 2836 2875 if (auto* renderer = m_focusedElement->renderer()) { 2837 information.elementRect = elementRectInRootViewCoordinates(*m_focusedElement);2876 information.elementRect = rootViewInteractionBoundsForElement(*m_focusedElement); 2838 2877 information.nodeFontSize = renderer->style().fontDescription().computedSize(); 2839 2878 … … 2854 2893 information.allowsUserScalingIgnoringAlwaysScalable = m_viewportConfiguration.allowsUserScalingIgnoringAlwaysScalable(); 2855 2894 if (auto* nextElement = nextAssistableElement(m_focusedElement.get(), *m_page, true)) { 2856 information.nextNodeRect = elementRectInRootViewCoordinates(*nextElement);2895 information.nextNodeRect = rootViewBoundsForElement(*nextElement); 2857 2896 information.hasNextNode = true; 2858 2897 } 2859 2898 if (auto* previousElement = nextAssistableElement(m_focusedElement.get(), *m_page, false)) { 2860 information.previousNodeRect = elementRectInRootViewCoordinates(*previousElement);2899 information.previousNodeRect = rootViewBoundsForElement(*previousElement); 2861 2900 information.hasPreviousNode = true; 2862 2901 } -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r246924 r247398 522 522 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.querySelector('input').focus()"]; 523 523 524 EXPECT_EQ(1 0, selectionClipRect.origin.x);525 EXPECT_EQ(1 0, selectionClipRect.origin.y);526 EXPECT_EQ(13 6, selectionClipRect.size.width);527 EXPECT_EQ(2 2, selectionClipRect.size.height);524 EXPECT_EQ(11, selectionClipRect.origin.x); 525 EXPECT_EQ(11, selectionClipRect.origin.y); 526 EXPECT_EQ(134, selectionClipRect.size.width); 527 EXPECT_EQ(20, selectionClipRect.size.height); 528 528 } 529 529
Note: See TracChangeset
for help on using the changeset viewer.