Bug 126057

Summary: Clearing 'dir' attribute does not correctly set page directionality
Product: WebKit Reporter: Prashant Hiremath <hiremathprashants>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, ap, bfulgham, buildbot, commit-queue, esprehn+autocc, gyuyoung.kim, jose.lejin, rniwa, tonikitoo
Priority: P2 Keywords: BlinkMergeCandidate
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
rniwa: review-, buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion none

Description Prashant Hiremath 2013-12-20 00:25:36 PST
Merge https://chromium.googlesource.com/chromium/blink/+/2d592d1c998bec9438e421e1ce1ee6caba05a884

The dir attribute by default resolves to ltr. After its set to rtl, clearing it should cause it to once again resolve to its default,
ltr. This patch makes this change from the current behavior where the rtl persists the clear.
Comment 1 Prashant Hiremath 2013-12-20 00:43:23 PST
Created attachment 219738 [details]
Patch

proposed patch
Comment 2 Build Bot 2013-12-20 02:06:12 PST
Comment on attachment 219738 [details]
Patch

Attachment 219738 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/49338234

New failing tests:
fast/dom/HTMLElement/set-and-clear-dir-attribute.html
Comment 3 Build Bot 2013-12-20 02:06:14 PST
Created attachment 219743 [details]
Archive of layout-test-results from webkit-ews-07 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-07  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 4 Ryosuke Niwa 2013-12-20 09:06:47 PST
Comment on attachment 219738 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=219738&action=review

> Source/WebCore/html/HTMLElement.cpp:209
> +            AtomicString dirValue = isValidDirAttribute(value) ? value : "ltr";

This is incorrect. When dir="" attribute doesn't parse correctly, it needs to be treated as if it doesn't exist for the purpose of determining the directionality of text.
I've specifically added a test case for this in fast/dom/HTMLElement/set-and-clear-dir-attribute.html

i.e. the blink change is wrong.
Comment 5 Prashant Hiremath 2013-12-22 19:56:53 PST
(In reply to comment #4)
> (From update of attachment 219738 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=219738&action=review
> 
> > Source/WebCore/html/HTMLElement.cpp:209
> > +            AtomicString dirValue = isValidDirAttribute(value) ? value : "ltr";
> 
> This is incorrect. When dir="" attribute doesn't parse correctly, it needs to be treated as if it doesn't exist for the purpose of determining the directionality of text.
> I've specifically added a test case for this in fast/dom/HTMLElement/set-and-clear-dir-attribute.html
> 
> i.e. the blink change is wrong.

Ok, got it :) . will close the bug.
Comment 6 Ryosuke Niwa 2013-12-22 20:05:37 PST
I don't think we should close the bug given that the bug still exists in WebKit.

It's just that the fix is incorrect.
Comment 7 Prashant Hiremath 2013-12-22 22:39:53 PST
(In reply to comment #6)
> I don't think we should close the bug given that the bug still exists in WebKit.
> 
> It's just that the fix is incorrect.

Thanks.
I'll try to look into this issue then :).
Comment 8 Ahmad Saleem 2022-07-26 10:34:19 PDT
This patch was modifying - equalIgnoringCase and it was removed in below:

https://github.com/WebKit/WebKit/commit/507aa34586fdcf0b9a5ea433c2402f295a717da8

-> rniwa@webkit.org - I think you landed 'dir' related changes just recently, have this been addressed or is this something needed? Thanks!
Comment 9 Ryosuke Niwa 2022-07-26 21:58:03 PDT
Yeah, I'm sure I fixed this with my latest patches.