Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Issue 524593003: Resolve direction correctly when dir attribute is not in a defined state

Created:
6 years, 3 months ago by Sunil Ratnu
Modified:
6 years ago
Reviewers:
tkent, keishi, esprehn
CC:
blink-reviews, blink-reviews-html_chromium.org, dglazkov+blink
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Resolve direction correctly when dir attribute is not in a defined state The current spec for directionality: http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#the-directionality says that: "If the element has a parent element and the dir attribute is not in a defined state (i.e. it is not present or has an invalid value), The directionality of the element is the same as the element's parent element's directionality." BUG=411865

Patch Set 1 #

Patch Set 2 : Added code for resolving direction #

Total comments: 2

Patch Set 3 : Splitting CL into 2 #

Total comments: 11

Patch Set 4 : Incorporating review comments #

Total comments: 4

Patch Set 5 : Let style resolver take care of direction #

Total comments: 9

Patch Set 6 : #

Patch Set 7 : Fix failing test #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+90 lines, -29 lines) Patch
A LayoutTests/fast/html/direction-in-case-of-invalid-dir-attribute.html View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
A LayoutTests/fast/html/direction-in-case-of-invalid-dir-attribute-expected.html View 1 2 3 1 chunk +25 lines, -0 lines 0 comments Download
M Source/core/html/HTMLElement.h View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/html/HTMLElement.cpp View 1 2 3 4 5 6 2 chunks +29 lines, -3 lines 5 comments Download
M Source/core/html/HTMLTextAreaElement.cpp View 1 2 3 4 5 6 2 chunks +5 lines, -2 lines 0 comments Download
M Source/core/html/HTMLTextFormControlElement.h View 1 2 3 4 5 6 1 chunk +0 lines, -2 lines 0 comments Download
M Source/core/html/HTMLTextFormControlElement.cpp View 1 2 3 4 5 6 1 chunk +0 lines, -20 lines 0 comments Download
M Source/core/html/forms/TextFieldInputType.cpp View 1 2 3 4 5 6 2 chunks +5 lines, -2 lines 0 comments Download

Messages

Total messages: 38 (5 generated)
Sunil Ratnu
Please review this. Thanks!
6 years, 3 months ago (2014-09-02 09:47:26 UTC) #2
tkent
Need tests. What about other browser behavior?
6 years, 3 months ago (2014-09-02 09:53:34 UTC) #3
Sunil Ratnu
On 2014/09/02 09:53:34, tkent wrote: > Need tests. > > What about other browser behavior? ...
6 years, 3 months ago (2014-09-08 14:47:08 UTC) #4
tkent
Let's split the CL to - a change for HTMLElement - a change for input/textarea. ...
6 years, 3 months ago (2014-09-09 01:42:28 UTC) #5
Sunil Ratnu
Thanks tkent for the quick review. I will soon upload new patches with your suggested ...
6 years, 3 months ago (2014-09-09 01:54:14 UTC) #6
Sunil Ratnu
Hi tkent, I've made the suggested changes. Please have a look. Thanks! https://codereview.chromium.org/524593003/diff/20001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp ...
6 years, 3 months ago (2014-09-09 03:31:03 UTC) #7
tkent
https://codereview.chromium.org/524593003/diff/40001/LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html File LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html (right): https://codereview.chromium.org/524593003/diff/40001/LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html#newcode1 LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html:1: <html> The CL is independent from forms. Probably this ...
6 years, 3 months ago (2014-09-09 06:37:01 UTC) #8
esprehn
https://codereview.chromium.org/524593003/diff/40001/LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute-expected.html File LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute-expected.html (right): https://codereview.chromium.org/524593003/diff/40001/LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute-expected.html#newcode1 LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute-expected.html:1: <html> Missing doctype. https://codereview.chromium.org/524593003/diff/40001/LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html File LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html (right): https://codereview.chromium.org/524593003/diff/40001/LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html#newcode1 LayoutTests/fast/forms/direction-in-case-of-invalid-dir-attribute.html:1: ...
6 years, 3 months ago (2014-09-09 10:20:13 UTC) #10
Sunil Ratnu
Thanks tkent and esprehn for the review. I've made the suggested changes, please take a ...
6 years, 3 months ago (2014-09-09 10:41:57 UTC) #11
tkent
https://codereview.chromium.org/524593003/diff/60001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/60001/Source/core/html/HTMLElement.cpp#newcode192 Source/core/html/HTMLElement.cpp:192: const AtomicString& dirValue = determineDirection() == RTL ? "rtl" ...
6 years, 3 months ago (2014-09-10 01:08:53 UTC) #12
Sunil Ratnu
Thanks tkent for the review. I've made the suggested changes. Please have a look. Thanks! ...
6 years, 3 months ago (2014-09-10 04:33:00 UTC) #13
Sunil Ratnu
Gentle ping. Please review the latest changes. Thanks!
6 years, 3 months ago (2014-09-11 04:48:59 UTC) #14
tkent
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp#newcode191 Source/core/html/HTMLElement.cpp:191: if (isValidDirAttribute(value)) If |value| is "auto", this code sets ...
6 years, 3 months ago (2014-09-12 06:33:55 UTC) #15
Sunil Ratnu
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp#newcode191 Source/core/html/HTMLElement.cpp:191: if (isValidDirAttribute(value)) On 2014/09/12 06:33:55, tkent (overloaded) wrote: > ...
6 years, 3 months ago (2014-09-12 07:16:13 UTC) #16
Sunil Ratnu
Hi tkent, can you please have a look?
6 years, 3 months ago (2014-09-18 03:00:30 UTC) #17
Sunil Ratnu
On 2014/09/18 03:00:30, Sunil Ratnu wrote: > Hi tkent, can you please have a look? ...
6 years, 3 months ago (2014-09-23 19:50:50 UTC) #18
Sunil Ratnu
On 2014/09/23 19:50:50, Sunil Ratnu wrote: > On 2014/09/18 03:00:30, Sunil Ratnu wrote: > > ...
6 years, 2 months ago (2014-09-30 06:47:41 UTC) #19
Sunil Ratnu
Hi tkent, Could you please review this. Thanks! Sunil
6 years, 2 months ago (2014-10-06 10:33:24 UTC) #20
Sunil Ratnu
On 2014/10/06 10:33:24, Sunil Ratnu wrote: > Hi tkent, > > Could you please review ...
6 years, 2 months ago (2014-10-09 06:59:54 UTC) #22
Sunil Ratnu
On 2014/10/09 06:59:54, Sunil Ratnu wrote: > On 2014/10/06 10:33:24, Sunil Ratnu wrote: > > ...
6 years, 1 month ago (2014-11-06 05:32:26 UTC) #23
tkent
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp#newcode191 Source/core/html/HTMLElement.cpp:191: if (isValidDirAttribute(value)) On 2014/09/12 07:16:12, Sunil Ratnu wrote: > ...
6 years, 1 month ago (2014-11-07 01:01:53 UTC) #24
Sunil Ratnu
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp#newcode191 Source/core/html/HTMLElement.cpp:191: if (isValidDirAttribute(value)) On 2014/11/07 01:01:53, tkent wrote: > On ...
6 years, 1 month ago (2014-11-12 13:49:32 UTC) #25
tkent
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp#newcode191 Source/core/html/HTMLElement.cpp:191: if (isValidDirAttribute(value)) On 2014/09/12 07:16:12, Sunil Ratnu wrote: > ...
6 years, 1 month ago (2014-11-19 03:32:19 UTC) #26
tkent
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.cpp#newcode684 Source/core/html/HTMLElement.cpp:684: // FIXME: Implement directionality for input type='tel' when it ...
6 years, 1 month ago (2014-11-19 03:38:34 UTC) #27
Sunil Ratnu
Hi tkent, Please have a look. Thanks! Sunil https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.h File Source/core/html/HTMLElement.h (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.h#newcode84 Source/core/html/HTMLElement.h:84: TextDirection ...
6 years, 1 month ago (2014-11-19 05:33:25 UTC) #28
tkent
lgtm
6 years, 1 month ago (2014-11-19 08:12:05 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/524593003/100001
6 years, 1 month ago (2014-11-19 08:12:16 UTC) #31
tkent
https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.h File Source/core/html/HTMLElement.h (right): https://codereview.chromium.org/524593003/diff/80001/Source/core/html/HTMLElement.h#newcode84 Source/core/html/HTMLElement.h:84: TextDirection determineDirection() const; On 2014/11/19 05:33:25, Sunil Ratnu wrote: ...
6 years, 1 month ago (2014-11-19 08:17:29 UTC) #32
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/34388)
6 years, 1 month ago (2014-11-19 09:06:02 UTC) #34
Sunil Ratnu
Hi tkent, The previous change was breaking fast/dom/Attr/direction-attribute-set-and-cleared.html, so I've made a few changes (i.e. ...
6 years, 1 month ago (2014-11-21 12:21:08 UTC) #35
tkent
https://codereview.chromium.org/524593003/diff/120001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (left): https://codereview.chromium.org/524593003/diff/120001/Source/core/html/HTMLElement.cpp#oldcode217 Source/core/html/HTMLElement.cpp:217: addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, "ltr"); On 2014/11/21 12:21:08, Sunil Ratnu wrote: ...
6 years ago (2014-11-25 01:27:24 UTC) #36
Sunil Ratnu
https://codereview.chromium.org/524593003/diff/120001/Source/core/html/HTMLElement.cpp File Source/core/html/HTMLElement.cpp (left): https://codereview.chromium.org/524593003/diff/120001/Source/core/html/HTMLElement.cpp#oldcode217 Source/core/html/HTMLElement.cpp:217: addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, "ltr"); On 2014/11/25 01:27:24, tkent wrote: > ...
6 years ago (2014-11-25 05:43:25 UTC) #37
tkent
6 years ago (2014-11-25 05:56:09 UTC) #38
https://codereview.chromium.org/524593003/diff/120001/Source/core/html/HTMLEl...
File Source/core/html/HTMLElement.cpp (left):

https://codereview.chromium.org/524593003/diff/120001/Source/core/html/HTMLEl...
Source/core/html/HTMLElement.cpp:217:
addPropertyToPresentationAttributeStyle(style, CSSPropertyDirection, "ltr");
On 2014/11/25 05:43:25, Sunil Ratnu wrote:
> On 2014/11/25 01:27:24, tkent wrote:
> > On 2014/11/21 12:21:08, Sunil Ratnu wrote:
> > > Hi tkent, We need to keep this else check here because removing it breaks
> > > fast/dom/Attr/direction-attribute-set-and-cleared.html test. The parent
> lookup
> > > fails here and keeps the direction "rtl" even after clearing it to "" as
> > > mentioned in the test. So, we need to make sure that we consider parent
> > > element's directionality and resolve accordingly. The mentioned test fails
> no
> > > more now.
> > 
> > I don't think parent lookup is a right solution.
> > How about
> >     style->removeProperty(CSSPropertyDirection);
> > ?
> 
> The above approach does not work here. The above mentioned test still fails.
> Since this is the only place where we are checking for invalid dirAttr or
> clearing of dirAttr and finally adding the direction to CSSPropertyDirection,
we
> need parent lookup so sa to resolve the direction and that seems reasonable.

Please investigate why it didn't work, and find another solution without parent
lookup.  Adding parent lookup is not acceptable.  Style resolution already
contains parent lookup, and adding DOM parent lookup will introduce
inconsistency and confusion.

Powered by Google App Engine
This is Rietveld 408576698