Bug 220624

Summary: Propagate explicit directionality into the Inspector DOM view
Product: WebKit Reporter: Sam Sneddon [:gsnedders] <gsnedders>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: inspector-bugzilla-changes, rniwa, webkit-bug-importer
Priority: P3 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Sam Sneddon [:gsnedders] 2021-01-14 06:24:43 PST
From Bug 220241:

> There's probably a strong argument that if the page has <span dir=rtl>foo</span> then we want to end up with <span class="html-text-node" dir=rtl>foo</span> in the Inspector, rather than using auto there.

In short, if the page has an explicitly defined directionality we almost certainly want to reuse that.

Even more generally, we may just want to explicitly use the same directionality as the source element, using something like element.matches(":dir(ltr)") ? "ltr" : "rtl", though this would add a dependency on bug 64861. This is _probably_ the best fix, because it means we end up with the same directionality in every case. Adding a depends-on for that, given I think it is what we should do?

I'm not totally sure what we want to do about attribute values here. Maybe always give them dir=auto?
Comment 1 Ryosuke Niwa 2021-01-14 09:45:44 PST
The computed value of direction property can be used. No need to rely on :dir. in fact, that would be wrong because :dir by definition will ignore CSS based directionality changes. Furthermore, Web Inspector backend uses C++ code to figure out the directionality of text. No need to rely on any real web API.
Comment 2 Radar WebKit Bug Importer 2021-01-21 06:25:13 PST
<rdar://problem/73450217>