Bug 50949

Summary: Add support for unicode-bidi:plaintext CSS property
Product: WebKit Reporter: Xiaomei Ji <xji>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, aharon, dglazkov, leviw, mitz, ofri, playmobil, rniwa, tony, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://dev.w3.org/csswg/css3-writing-modes/#unicode-bidi
Bug Depends on: 57457, 57853    
Bug Blocks: 50910    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-01
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-01
none
Patch
none
Archive of layout-test-results from ec2-cr-linux-01
none
Patch none

Xiaomei Ji
Reported 2010-12-13 11:36:52 PST
Following is from CSS3 spec: plaintext For the purposes of the Unicode bidirectional algorithm, the base directionality of each "paragraph" for which the element is the containing block element is determined not by the element's computed ‘direction’ as usual, but by following rules P1, P2, and P3 of the Unicode bidirectional algorithm. However, if no direction-determining character is found in step P2, then the value of the ‘direction’ property is used instead. Note this value has no effect on inline elements.
Attachments
Patch (44.08 KB, patch)
2011-04-05 10:25 PDT, Levi Weintraub
no flags
Patch (51.01 KB, patch)
2011-04-06 08:02 PDT, Levi Weintraub
no flags
Patch (51.08 KB, patch)
2011-04-27 15:31 PDT, Levi Weintraub
no flags
Patch (50.79 KB, patch)
2011-06-21 17:47 PDT, Levi Weintraub
no flags
Archive of layout-test-results from ec2-cr-linux-01 (1.29 MB, application/zip)
2011-06-21 18:17 PDT, WebKit Review Bot
no flags
Patch (50.80 KB, patch)
2011-06-22 12:02 PDT, Levi Weintraub
no flags
Archive of layout-test-results from ec2-cr-linux-01 (1.25 MB, application/zip)
2011-06-22 12:34 PDT, WebKit Review Bot
no flags
Patch (55.10 KB, patch)
2011-06-23 16:44 PDT, Levi Weintraub
no flags
Archive of layout-test-results from ec2-cr-linux-01 (1.83 MB, application/zip)
2011-06-23 17:16 PDT, WebKit Review Bot
no flags
Patch (55.11 KB, patch)
2011-06-27 11:43 PDT, Levi Weintraub
no flags
Levi Weintraub
Comment 1 2011-04-05 10:25:03 PDT
WebKit Review Bot
Comment 2 2011-04-05 10:27:13 PDT
Attachment 88270 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style']" exit_code: 1 Source/WebCore/rendering/style/RenderStyle.h:259: _unicodeBidi is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Levi Weintraub
Comment 3 2011-04-06 07:55:47 PDT
Comment on attachment 88270 [details] Patch Canceling the review as there were two more changes to make: 1 - check for line breaks and bail in determineParagraphDirection, since in the first layout we don't have an end iterator 2 - properly set unicode-bidi to plaintext for pre and textarea. New patch coming shortly.
Levi Weintraub
Comment 4 2011-04-06 08:02:15 PDT
WebKit Review Bot
Comment 5 2011-04-06 08:05:00 PDT
Attachment 88417 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style']" exit_code: 1 Source/WebCore/rendering/style/RenderStyle.h:259: _unicodeBidi is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Levi Weintraub
Comment 6 2011-04-07 01:40:39 PDT
I'd love a review if anyone gets a chance :)
Eric Seidel (no email)
Comment 7 2011-04-26 16:08:59 PDT
Comment on attachment 88417 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=88417&action=review I'm concerned this is not the only place you want this code. Otherwise seems fine. > Source/WebCore/html/HTMLElement.cpp:170 > + int bidiAttribute; > + if (hasLocalName(bdoTag)) > + bidiAttribute = CSSValueBidiOverride; > + else if (hasLocalName(preTag) || hasLocalName(textareaTag)) > + bidiAttribute = CSSValueWebkitPlaintext; > + else > + bidiAttribute = CSSValueEmbed; > + addCSSProperty(attr, CSSPropertyUnicodeBidi, bidiAttribute); This is a super-weird place for this code! I guess since I we have eto leave his here we should abstract this into a unicodeBidFromDirAuto() helper. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:87 > +static void determineParagraphDirection(Direction& dir, InlineIterator iter) > +{ So this is basically "first strong direction in paragarph"? I'm not sure where this logic goes. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:1266 > + if (style()->unicodeBidi() == Plaintext) > + determineParagraphDirection(direction, InlineIterator(this, bidiFirst(this, 0), pos)); I think we're going to want to start passing unicodeBidi() to BidiContexts :( Are we sure this is the only place this needs to be done? > Source/WebCore/rendering/RenderBlockLineLayout.cpp:1270 > resolver.setLastStrongDir(direction); > resolver.setLastDir(direction); > resolver.setEorDir(direction); > - resolver.setContext(BidiContext::create(ltr ? 0 : 1, direction, style()->unicodeBidi() == Override, FromStyleOrDOM)); > + resolver.setContext(BidiContext::create(direction == LeftToRight ? 0 : 1, direction, style()->unicodeBidi() == Override, FromStyleOrDOM)); I think I have an outstanding conflicting patch here.
Levi Weintraub
Comment 8 2011-04-26 16:30:50 PDT
Comment on attachment 88417 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=88417&action=review >> Source/WebCore/html/HTMLElement.cpp:170 >> + addCSSProperty(attr, CSSPropertyUnicodeBidi, bidiAttribute); > > This is a super-weird place for this code! I guess since I we have eto leave his here we should abstract this into a unicodeBidFromDirAuto() helper. That makes sense. >> Source/WebCore/rendering/RenderBlockLineLayout.cpp:87 >> +{ > > So this is basically "first strong direction in paragarph"? I'm not sure where this logic goes. That's correct. First the first character with a strong directionality is what determines the paragraph's base writing direction. >> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1266 >> + determineParagraphDirection(direction, InlineIterator(this, bidiFirst(this, 0), pos)); > > I think we're going to want to start passing unicodeBidi() to BidiContexts :( > > Are we sure this is the only place this needs to be done? These two cases cover it: when we initially set up the BidiContext for the block, and again after each paragraph separator. >> Source/WebCore/rendering/RenderBlockLineLayout.cpp:1270 >> + resolver.setContext(BidiContext::create(direction == LeftToRight ? 0 : 1, direction, style()->unicodeBidi() == Override, FromStyleOrDOM)); > > I think I have an outstanding conflicting patch here. Link? If it's going to be a blocking issue list it as such so I know when to update this patch.
Levi Weintraub
Comment 9 2011-04-27 15:31:09 PDT
WebKit Review Bot
Comment 10 2011-04-27 15:32:15 PDT
Attachment 91362 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/WebCore/rendering/style/RenderStyle.h:259: _unicodeBidi is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Levi Weintraub
Comment 11 2011-05-02 18:17:44 PDT
@Eric: Following up wondering about the conflicting patch you had on this. When does it land? Could you add it as a blocker so I can track it? I think I cleared up your other issue and appreciate your feedback :)
Levi Weintraub
Comment 12 2011-06-21 17:47:24 PDT
WebKit Review Bot
Comment 13 2011-06-21 17:50:43 PDT
Attachment 98088 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/WebCore/rendering/style/RenderStyle.h:259: _unicodeBidi is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Seidel (no email)
Comment 14 2011-06-21 17:55:56 PDT
Comment on attachment 98088 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98088&action=review I think I need to look at this again later. > Source/WebCore/html/HTMLElement.cpp:129 > +static int unicodeBidiAttributeForDirAuto(HTMLElement* element) Should this be marked inline? > Source/WebCore/rendering/RenderBlockLineLayout.cpp:115 > +static void determineParagraphDirection(TextDirection& dir, InlineIterator iter) Should InlineIterator be passed as a reference? do you actually want it to be copied here? Maybe that would be more clear with a const & which you explicitly copy? > Source/WebCore/rendering/RenderBlockLineLayout.cpp:967 > + bool isNewParagraph = lineInfo.previousLineBrokeCleanly(); is this true? that it's a "new paragraph"? You might want to say isNewUBAParagrah? I'm not sure. Do we need a new accessor on lineInfo which talks about UBA things instead of previous line? They may be backed by the same bool, but I wonder if we shouldn't have a UBA-specific accessor on lineInfo, since it's not clear from previousLineBrokeCleanly what it applies to... > Source/WebCore/rendering/style/RenderStyle.h:261 > - // 50 bits > + // 51 bits Did you validate this count? Sometimes these comments are out of date.
WebKit Review Bot
Comment 15 2011-06-21 18:17:44 PDT
Comment on attachment 98088 [details] Patch Attachment 98088 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8926094 New failing tests: fast/text/international/unicode-bidi-plaintext.html
WebKit Review Bot
Comment 16 2011-06-21 18:17:50 PDT
Created attachment 98093 [details] Archive of layout-test-results from ec2-cr-linux-01 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-01 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Levi Weintraub
Comment 17 2011-06-22 12:02:52 PDT
Levi Weintraub
Comment 18 2011-06-22 12:03:32 PDT
Comment on attachment 98211 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98211&action=review > Source/WebCore/rendering/style/RenderStyle.h:261 > + // 53 bits It really is 53 bits now... The comment was off by 2!
WebKit Review Bot
Comment 19 2011-06-22 12:05:05 PDT
Attachment 98211 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/WebCore/rendering/style/RenderStyle.h:259: _unicodeBidi is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 20 2011-06-22 12:34:38 PDT
Comment on attachment 98211 [details] Patch Attachment 98211 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8925650 New failing tests: fast/text/international/unicode-bidi-plaintext.html
WebKit Review Bot
Comment 21 2011-06-22 12:34:43 PDT
Created attachment 98215 [details] Archive of layout-test-results from ec2-cr-linux-01 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-01 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Eric Seidel (no email)
Comment 22 2011-06-23 14:35:21 PDT
Comment on attachment 98211 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98211&action=review r- for the cr-linux failure. Happy to look again after your replies. > Source/WebCore/html/HTMLElement.cpp:129 > +static inline int unicodeBidiAttributeForDirAuto(HTMLElement* element) So sad that these are ints, and not an enum. > Source/WebCore/rendering/RenderBlockLineLayout.cpp:967 > + bool isNewUBAParagraph = lineInfo.previousLineBrokeCleanly(); I wonder if this shouldn't be an accessor on lineInfo. So that at some point later we might distinguish between nextLineIsNewUBAParagraph and previousLineBrokeCleanly (since I think they're used for separate things a times). > Source/WebCore/rendering/RenderBlockLineLayout.cpp:991 > + if (isNewUBAParagraph && style()->unicodeBidi() == Plaintext && !resolver.context()->parent()) { > + TextDirection direction = style()->direction(); > + determineParagraphDirection(direction, resolver.position()); > + resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); > + } Why is this needed here? I would think you would only need this in determinedStart... below.
Levi Weintraub
Comment 23 2011-06-23 15:00:09 PDT
Comment on attachment 98211 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98211&action=review >> Source/WebCore/rendering/RenderBlockLineLayout.cpp:967 >> + bool isNewUBAParagraph = lineInfo.previousLineBrokeCleanly(); > > I wonder if this shouldn't be an accessor on lineInfo. So that at some point later we might distinguish between nextLineIsNewUBAParagraph and previousLineBrokeCleanly (since I think they're used for separate things a times). I'd agree this should be refactored when another use case crops up. >> Source/WebCore/rendering/RenderBlockLineLayout.cpp:991 >> + } > > Why is this needed here? I would think you would only need this in determinedStart... below. On all other modes, hitting a hard line break resets the UBA to the state at the beginning of the current block, but when in Unicode: plaintext mode, we recalculate the direction of this new paragraph and set the status to an embedding level of 0/1 depending on the first character with strong directionality.
Levi Weintraub
Comment 24 2011-06-23 15:01:31 PDT
(In reply to comment #22) > (From update of attachment 98211 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=98211&action=review > > r- for the cr-linux failure. Happy to look again after your replies. I'm actually really confused by this cr-linux failure... It's failing the new test I uploaded, but I don't have expected results for linux!
Levi Weintraub
Comment 25 2011-06-23 16:15:43 PDT
(In reply to comment #24) > I'm actually really confused by this cr-linux failure... It's failing the new test I uploaded, but I don't have expected results for linux! Can someone with a better understanding of the cr-linux ews bot's layout test functionality help me understand this? Eric, Adam, Dmitry, I'm looking at you ;)
Tony Chang
Comment 26 2011-06-23 16:24:08 PDT
You answered your own question, it failed because the new test you added doesn't have results for Chromium Linux. When the test runs, it falls back to the mac result and it doesn't match, so it fails. You can grab the result out of the zip file and add it to your patch and it should pass. Alternately you could skip the test on Chromium Linux.
Levi Weintraub
Comment 27 2011-06-23 16:28:20 PDT
(In reply to comment #26) > You answered your own question, it failed because the new test you added doesn't have results for Chromium Linux. When the test runs, it falls back to the mac result and it doesn't match, so it fails. > > You can grab the result out of the zip file and add it to your patch and it should pass. Alternately you could skip the test on Chromium Linux. Oof! That seems like like a false-negative to go red for missing platform test expectations. While I love having the expected results generated, it's quite annoying if I'm getting r-'s for not doing my building on Linux Chrome :p
Levi Weintraub
Comment 28 2011-06-23 16:44:41 PDT
Levi Weintraub
Comment 29 2011-06-23 16:45:12 PDT
(In reply to comment #28) > Created an attachment (id=98433) [details] > Patch Including text cr-linux results...
WebKit Review Bot
Comment 30 2011-06-23 16:49:23 PDT
Attachment 98433 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1 Source/WebCore/rendering/style/RenderStyle.h:259: _unicodeBidi is incorrectly named. Don't use underscores in your identifier names. [readability/naming] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 31 2011-06-23 17:16:11 PDT
Comment on attachment 98433 [details] Patch Attachment 98433 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8935190 New failing tests: fast/text/international/unicode-bidi-plaintext.html
WebKit Review Bot
Comment 32 2011-06-23 17:16:18 PDT
Created attachment 98439 [details] Archive of layout-test-results from ec2-cr-linux-01 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-01 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Levi Weintraub
Comment 33 2011-06-27 11:43:11 PDT
Levi Weintraub
Comment 34 2011-06-27 13:31:01 PDT
Woo! Finally made cr-linux happy :)
Eric Seidel (no email)
Comment 35 2011-06-27 14:31:50 PDT
Comment on attachment 98760 [details] Patch Seems OK. You will need to watch the bots, as you may break others than just linux due to font differences. I expect you'll break cr-win.
Levi Weintraub
Comment 36 2011-06-27 14:35:29 PDT
Comment on attachment 98760 [details] Patch Thanks for the review! I'll keep an eye on the bots, I'm sure there'll be different platform expectations :(
WebKit Review Bot
Comment 37 2011-06-27 15:01:51 PDT
Comment on attachment 98760 [details] Patch Clearing flags on attachment: 98760 Committed r89864: <http://trac.webkit.org/changeset/89864>
WebKit Review Bot
Comment 38 2011-06-27 15:02:07 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.