WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
68773
BDI element should have dir=auto by default
https://bugs.webkit.org/show_bug.cgi?id=68773
Summary
BDI element should have dir=auto by default
Aharon (Vladimir) Lanin
Reported
2011-09-25 01:26:47 PDT
Unless bdi has an explicitly assigned dir=ltr or dir=rtl, it should behave as if it had dir=auto. See
http://dev.w3.org/html5/spec/Overview.html#the-bdi-element
, where it says: Note: The dir global attribute defaults to auto on this element (it never inherits from the parent element like with other elements). BTW, please note related bug
https://bugs.webkit.org/show_bug.cgi?id=63903
(dir=auto should imply unicode-bidi:isolate by default)
Attachments
test case (ref file coming as separate attachment)
(1.90 KB, text/html)
2011-12-13 02:54 PST
,
Aharon (Vladimir) Lanin
no flags
Details
ref file for the test case above
(1.17 KB, text/html)
2011-12-13 02:56 PST
,
Aharon (Vladimir) Lanin
no flags
Details
Patch
(18.38 KB, patch)
2012-03-20 16:59 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed the file ordering in xcodeproj
(18.51 KB, patch)
2012-03-20 17:02 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed GTK & Qt builds
(18.46 KB, patch)
2012-03-20 17:12 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed a bug
(21.07 KB, patch)
2012-03-21 15:16 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Removed the extra change log entry
(19.89 KB, patch)
2012-03-21 15:46 PDT
,
Ryosuke Niwa
dbates
: review+
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Aharon (Vladimir) Lanin
Comment 1
2011-12-13 02:54:54 PST
Created
attachment 118988
[details]
test case (ref file coming as separate attachment) This is one of the tests being submitted to
public-html-testsuite@w3.org
for inclusion into the W3C's HTML5 test suite.
Aharon (Vladimir) Lanin
Comment 2
2011-12-13 02:56:32 PST
Created
attachment 118989
[details]
ref file for the test case above
Ryosuke Niwa
Comment 3
2012-03-20 13:32:35 PDT
It seems like it'll be much easier to do this if dir=auto had a CSS equivalent. I've filed
https://www.w3.org/Bugs/Public/show_bug.cgi?id=16456
to that end.
Aharon (Vladimir) Lanin
Comment 4
2012-03-20 16:11:31 PDT
(In reply to
comment #3
)
> It seems like it'll be much easier to do this if dir=auto had a CSS equivalent. I've filed
https://www.w3.org/Bugs/Public/show_bug.cgi?id=16456
to that end.
I do not think that a CSS equivalent to dir=auto is possible. When Fantasai gets around to responding on that bug, that is what she will say. I do not want this issue to be blocked waiting for that, because it just isn't going to happen.
Ryosuke Niwa
Comment 5
2012-03-20 16:59:54 PDT
Created
attachment 132928
[details]
Patch
Ryosuke Niwa
Comment 6
2012-03-20 17:02:27 PDT
Created
attachment 132930
[details]
Fixed the file ordering in xcodeproj
Gustavo Noronha (kov)
Comment 7
2012-03-20 17:08:41 PDT
Comment on
attachment 132930
[details]
Fixed the file ordering in xcodeproj
Attachment 132930
[details]
did not pass gtk-ews (gtk): Output:
http://queues.webkit.org/results/12090028
Ryosuke Niwa
Comment 8
2012-03-20 17:12:06 PDT
Created
attachment 132937
[details]
Fixed GTK & Qt builds
WebKit Review Bot
Comment 9
2012-03-21 04:38:24 PDT
Comment on
attachment 132937
[details]
Fixed GTK & Qt builds
Attachment 132937
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/12086328
New failing tests: fast/text/international/bdi-dir-default-to-auto.html
Ryosuke Niwa
Comment 10
2012-03-21 12:36:43 PDT
Apparently this failure only manifests in release builds :(
Ryosuke Niwa
Comment 11
2012-03-21 15:16:51 PDT
Created
attachment 133123
[details]
Fixed a bug
Ryosuke Niwa
Comment 12
2012-03-21 15:18:29 PDT
Comment on
attachment 133123
[details]
Fixed a bug View in context:
https://bugs.webkit.org/attachment.cgi?id=133123&action=review
> Source/WebCore/html/HTMLBDIElement.h:40 > + // FIXME: Rename setSelfOrAncestorHasDirAutoAttribute to reflect the fact bdi also uses this flag. > + setSelfOrAncestorHasDirAutoAttribute(true);
I'm more than happy to make the change if anyone can come up with a better name for this function.
Ryosuke Niwa
Comment 13
2012-03-21 15:23:55 PDT
Apparently HTMLElementFactory.cpp is generated from HTMLTagNames.in so I had to modify HTMLTagNames.in instead of HTMLElementFactory.cpp.
Ryosuke Niwa
Comment 14
2012-03-21 15:46:49 PDT
Created
attachment 133130
[details]
Removed the extra change log entry
Ryosuke Niwa
Comment 15
2012-03-21 16:05:35 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
> Source/WebCore/html/HTMLElement.cpp:934 > - if (node->isElementNode() && toElement(node)->hasAttribute(dirAttr)) > + if (node->isElementNode() && elementAffectsDirectionality(toHTMLElement(node)))
This should be checking for isHTMLElement instead; will fix before landing it if this patch gets r+ed.
Ryosuke Niwa
Comment 16
2012-03-21 16:06:10 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
>> Source/WebCore/html/HTMLElement.cpp:934 >> + if (node->isElementNode() && elementAffectsDirectionality(toHTMLElement(node))) > > This should be checking for isHTMLElement instead; will fix before landing it if this patch gets r+ed.
Or rather we should be casting to toElement instead.
Daniel Bates
Comment 17
2012-03-21 16:31:10 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
This patch looks straight forward to me. I had some minor comments.
> Source/WebCore/css/CSSStyleSelector.cpp:1370 > + if ((element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto()) || (m_element->isHTMLElement() && toHTMLElement(m_element)->hasDirectionAuto()))
The disjuncts in this disjunction are the same up to the object they operate on. You may want to consider extracting a disjunct into an inline function, say elementHasDirectionAuto() or doesElementHaveDirectionAuto? inline bool elementHasDirectionAuto(Element* element) { return element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto(); } Then you can write this line as: if (elementHasDirectionAuto(element) || elementHasDirectionAuto(m_element)) { ... }
> Source/WebCore/html/HTMLBDIElement.h:41 > + fprintf(stderr, "HTMLBDIElement:%s\n", selfOrAncestorHasDirAutoAttribute() ? "true" : "false");
Did you mean to have this fprintf() in the patch?
> Source/WebCore/html/HTMLBDIElement.h:45 > +} // namespace
This should read: // namespace WebCore
> Source/WebCore/html/HTMLElement.cpp:945 > + while (oldMarkedNode && oldMarkedNode->isHTMLElement() && elementAffectsDirectionality(toHTMLElement(oldMarkedNode)))
As we talked about on IRC, you may want to consider having elementAffectsDirectionality() take a const Node* instead of a const Element*. And moving the HTMLElement cast (it's sufficient to call toElement()) into elementAffectsDirectionality() such that we can write this line as: while (oldMarkedNode && oldMarkedNode->isHTMLElement() && elementAffectsDirectionality(oldMarkedNode))
Ryosuke Niwa
Comment 18
2012-03-21 16:40:05 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
Thanks for the review!
>> Source/WebCore/css/CSSStyleSelector.cpp:1370 >> + if ((element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto()) || (m_element->isHTMLElement() && toHTMLElement(m_element)->hasDirectionAuto())) > > The disjuncts in this disjunction are the same up to the object they operate on. You may want to consider extracting a disjunct into an inline function, say elementHasDirectionAuto() or doesElementHaveDirectionAuto? > > inline bool elementHasDirectionAuto(Element* element) > { > return element->isHTMLElement() && toHTMLElement(element)->hasDirectionAuto(); > } > > Then you can write this line as: > > if (elementHasDirectionAuto(element) || elementHasDirectionAuto(m_element)) { > ... > }
Added elementHasDirectionAuto.
>> Source/WebCore/html/HTMLBDIElement.h:41 >> + fprintf(stderr, "HTMLBDIElement:%s\n", selfOrAncestorHasDirAutoAttribute() ? "true" : "false"); > > Did you mean to have this fprintf() in the patch?
Oops, definitely not. Removed.
>> Source/WebCore/html/HTMLBDIElement.h:45 >> +} // namespace > > This should read: > > // namespace WebCore
Fixed.
>> Source/WebCore/html/HTMLElement.cpp:945 >> + while (oldMarkedNode && oldMarkedNode->isHTMLElement() && elementAffectsDirectionality(toHTMLElement(oldMarkedNode))) > > As we talked about on IRC, you may want to consider having elementAffectsDirectionality() take a const Node* instead of a const Element*. And moving the HTMLElement cast (it's sufficient to call toElement()) into elementAffectsDirectionality() such that we can write this line as: > > while (oldMarkedNode && oldMarkedNode->isHTMLElement() && elementAffectsDirectionality(oldMarkedNode))
Done.
Eric Seidel (no email)
Comment 19
2012-03-21 16:41:05 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
> Source/WebCore/html/HTMLTagNames.in:18 > +bdi interfaceName=HTMLBDIElement, JSInterfaceName=HTMLElement
I'm surprised you need any interfaceName, I guess HTMLBdiElement would be default.... I think make_names attempts to understand some of these capitalizations, probably with a hard-coded list. I guess we should move more of the hard-coded list items to being in these .in files instead... or maybe we already have. :)
Ryosuke Niwa
Comment 20
2012-03-21 16:55:28 PDT
(In reply to
comment #19
)
> (From update of
attachment 133130
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
> > > Source/WebCore/html/HTMLTagNames.in:18 > > +bdi interfaceName=HTMLBDIElement, JSInterfaceName=HTMLElement > > I'm surprised you need any interfaceName, I guess HTMLBdiElement would be default.... I think make_names attempts to understand some of these capitalizations, probably with a hard-coded list. I guess we should move more of the hard-coded list items to being in these .in files instead... or maybe we already have. :)
I think we've already moved to .in files. e.g. hr interfaceName=HTMLHRElement is there.
WebKit Review Bot
Comment 21
2012-03-21 17:14:34 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry
Attachment 133130
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/12090660
New failing tests: fast/css/default-bidi-css-rules.html
Ryosuke Niwa
Comment 22
2012-03-21 18:04:09 PDT
Comment on
attachment 133130
[details]
Removed the extra change log entry View in context:
https://bugs.webkit.org/attachment.cgi?id=133130&action=review
> Source/WebCore/html/HTMLElement.cpp:834 > + return hasTagName(bdiTag) || equalIgnoringCase(fastGetAttribute(dirAttr), "auto");
Oops, I need to check that the dir attribute isn't set to ltr or rtl when the element is bdi :( Will fix before landing the patch.
Ryosuke Niwa
Comment 23
2012-03-21 18:08:31 PDT
Committed
r111632
: <
http://trac.webkit.org/changeset/111632
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug