Bug 247718

Summary: REGRESSION (iOS 13.7 - iOS 16.1): range.getClientRects() is extremely slow on Japanese text
Product: WebKit Reporter: skoji
Component: TextAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: mmaxfield, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   

Description skoji 2022-11-10 00:21:33 PST
HTML to reproduce the bug; https://skoji.jp/get-client-rects-extremely-slow.html

getClientRects is extremeley slow with this sambple on iPad OS 16.1 compared to iPadOS 13.7 or iPadOS 14.5.

The result of sample above:

* (Simulator) iPad Pro (12.9-inch 4th gen)/ iPadOS 13.7 : 541 msec
* (Simulator) iPad Pro (12.9-inch 5th gen)/ iPadOS 14.5 : 1629 msec
* (Simulator) iPad Pro (12.9-inch 5th gen)/ iPadOS 16.1 : 46384 msec
* iPad 7th generation / iPadOS 15.5                     : 25274 msec
* iPad Pro (11-inch) 2nd generation                     : 17811 msec
Comment 1 Radar WebKit Bug Importer 2022-11-10 09:37:41 PST
<rdar://problem/102197839>
Comment 2 Simon Fraser (smfr) 2022-11-10 14:42:18 PST
Lots of time under:

+   2096 WebCore::RenderText::absoluteQuadsForRange(unsigned int, unsigned int, bool, bool, bool*) const  (in WebCore) + 669  [0x345bacfed]
+   ! 2095 WebCore::InlineIterator::TextBox::selectionRect(unsigned int, unsigned int) const  (in WebCore) + 909  [0x34558019d]
+   ! : 2087 WebCore::FontCascade::adjustSelectionRectForComplexText(WebCore::TextRun const&, WebCore::LayoutRect&, unsigned int, unsigned int) const  (in WebCore) + 69  [0x345862615]
+   ! : | 1986 WebCore::ComplexTextController::ComplexTextController(WebCore::FontCascade const&, WebCore::TextRun const&, bool, WTF::HashSet<WebCore::Font const*, WTF::DefaultHash<WebCore::Font const*>, WTF::HashTraits<WebCore::Font const*>, WTF::HashTableTraits>*, bool)  (in WebCore) + 1620  [0x34584a004]
+   ! : | + 1982 WebCore::ComplexTextController::collectComplexTextRunsForCharacters(char16_t const*, unsigned int, unsigned int, WebCore::Font const*)  (in WebCore) + 253  [0x3449586bd]
+   ! : | + ! 1982 CTTypesetterCreateWithUniCharProviderAndOptions  (in CoreText) + 112  [0x7ff807e9ebf8]