Bug 135349 - [CSS3-Text] Add rendering support for text-justify: none
Summary: [CSS3-Text] Add rendering support for text-justify: none
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zoltan Horvath
URL:
Keywords: WebExposed
Depends on:
Blocks: 135940
  Show dependency treegraph
 
Reported: 2014-07-28 13:26 PDT by Zoltan Horvath
Modified: 2014-08-14 08:44 PDT (History)
6 users (show)

See Also:


Attachments
Patch (5.17 KB, patch)
2014-07-28 16:07 PDT, Zoltan Horvath
no flags Details | Formatted Diff | Diff
Patch (6.43 KB, patch)
2014-07-30 10:25 PDT, Zoltan Horvath
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zoltan Horvath 2014-07-28 13:26:11 PDT
Add rendering support for the none value of text-justify property.
Spec: http://dev.w3.org/csswg/css-text-3/#valdef-text-justify.none
Comment 1 Zoltan Horvath 2014-07-28 16:07:49 PDT
Created attachment 235629 [details]
Patch
Comment 2 Darin Adler 2014-07-29 00:56:32 PDT
Comment on attachment 235629 [details]
Patch

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

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:681
> +            if (textAlign == JUSTIFY && r != trailingSpaceRun
> +#if ENABLE(CSS3_TEXT)
> +                && style().textJustify() != TextJustifyNone) {
> +#else
> +            ) {
> +#endif

It’s better to not have repeated ) { characters to confuse code editors. How about this instead?

                if (textAlign == JUSTIFY && r != trailingSpaceRun
    #if ENABLE(CSS3_TEXT)
                    && style().textJustify() != TextJustifyNone
    #endif
                ) {

Does this really need to be done down here at such a low level? Can’t we change the textAlign value at some higher level instead?
Comment 3 Zoltan Horvath 2014-07-29 07:32:09 PDT
I tried to satisfy the style-checker, that's why I did it this way. Probably the best would be to file a bug against it, and use the simpler version. Do you agree?

> Does this really need to be done down here at such a low level? Can’t we change the textAlign value at some higher level instead?

I'll take a look at this.
Comment 4 Myles C. Maxfield 2014-07-29 09:37:01 PDT
I agree with Darin, but other than that, unofficial r=me as well.
Comment 5 Zoltan Horvath 2014-07-30 10:25:48 PDT
Created attachment 235749 [details]
Patch
Comment 6 Zoltan Horvath 2014-07-30 10:26:48 PDT
I moved the logic up into "RenderBlockFlow::textAlignmentForLine".
Comment 7 Dave Hyatt 2014-08-13 10:25:04 PDT
Comment on attachment 235749 [details]
Patch

r=me
Comment 8 WebKit Commit Bot 2014-08-13 11:00:48 PDT
Comment on attachment 235749 [details]
Patch

Clearing flags on attachment: 235749

Committed r172524: <http://trac.webkit.org/changeset/172524>
Comment 9 WebKit Commit Bot 2014-08-13 11:00:52 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Darin Adler 2014-08-13 11:18:13 PDT
Comment on attachment 235749 [details]
Patch

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

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:360
> -#if !ENABLE(CSS3_TEXT)
> -    return (alignment == JUSTIFY) ? TASTART : alignment;
> -#else
> +#if ENABLE(CSS3_TEXT)

We intentionally put the short half of the #if first for easier readability, which is why the !CSS3_TEXT branch came before the #else instead of the other way around. I'm a little disappointed to see that changed in a patch that doesn't give any rationale for the change.
Comment 11 Darin Adler 2014-08-13 11:18:30 PDT
Comment on attachment 235749 [details]
Patch

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

> Source/WebCore/rendering/RenderBlockLineLayout.cpp:353
> +    if (alignment == JUSTIFY &&  textJustify == TextJustifyNone)

Extra space here after the "&&".
Comment 12 Zoltan Horvath 2014-08-13 11:47:42 PDT
(In reply to comment #10)
> We intentionally put the short half of the #if first for easier readability, which is why the !CSS3_TEXT branch came before the #else instead of the other way around. I'm a little disappointed to see that changed in a patch that doesn't give any rationale for the change.

It seemed easier my to read the other way. I'm going to update it in a follow up patch to be consistent with the rest of the code. I will CC you.

(In reply to comment #11)
> (From update of attachment 235749 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=235749&action=review
> 
> > Source/WebCore/rendering/RenderBlockLineLayout.cpp:353
> > +    if (alignment == JUSTIFY &&  textJustify == TextJustifyNone)
> 
> Extra space here after the "&&".

And will remove the extra space.