Bug 261984 - [Performance Optimization] Skip non-text SVG elements in Most{For/Back}wardCaretPosition
Summary: [Performance Optimization] Skip non-text SVG elements in Most{For/Back}wardCa...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar, Performance
Depends on:
Blocks:
 
Reported: 2023-09-22 16:25 PDT by Ahmad Saleem
Modified: 2023-09-30 19:02 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-09-22 16:25:43 PDT
Hi Team,

While going through Blink bug, I came across another potential issue, which we face as well and we are slow:

Test Case (Copy paste from crbug.com/822312):

1. Access website http://cwsdemo.hexagonusfederal.com/cwe
2. Click Open
3. Click Choose File
4. Browse to 5672-1.svg (attached)
5. Click open
6. Click Insert Item
7. Click Text
8. Click in map
9. "New Text" should be placed in the map

What is the expected behavior?
Immediate placement of default text.

What went wrong?
Depending on the size of the SVG file it takes seconds to minutes to place the text in the map with the last two official builds of Chrome.  

___

Blink Commit: https://chromium.googlesource.com/chromium/src.git/+/8e793a18ec6358414ffc337b336c93d4f6061c91

GitHub WebKit Source: https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/Position.cpp#L715 & https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/Position.cpp#L823

__

Just wanted to raise so we can track and see if we can apply this optimization without any regression. Haven't tried fixing on my local build (Xcode 15 curse on macOS Ventura - waiting for Sonoma).

Thanks!
Comment 1 Radar WebKit Bug Importer 2023-09-29 16:26:15 PDT
<rdar://problem/116261189>
Comment 2 Ahmad Saleem 2023-09-30 15:07:43 PDT
Need two headers - 

#include "SVGTextElement.h"
#include "SVGElementTypeHelpers.h"

and then following compiles:

 if (currentNode.isSVGElement() && !is<SVGTextElement>(currentNode))
            continue;
Comment 3 EWS 2023-09-30 19:02:45 PDT
Committed 268699@main (13274cf68d90): <https://commits.webkit.org/268699@main>

Reviewed commits have been landed. Closing PR #18464 and removing active labels.