Bug 94475 - CSS 3 ‘overflow-wrap’ property implementation
Summary: CSS 3 ‘overflow-wrap’ property implementation
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mikhail Pozdnyakov
URL:
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2012-08-20 06:05 PDT by Mikhail Pozdnyakov
Modified: 2012-09-06 07:00 PDT (History)
15 users (show)

See Also:


Attachments
preliminary patch. (6.15 KB, patch)
2012-08-20 06:17 PDT, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff
patch (10.06 KB, patch)
2012-08-20 06:58 PDT, Mikhail Pozdnyakov
jchaffraix: review-
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from gce-cr-linux-06 (325.03 KB, application/zip)
2012-08-20 08:08 PDT, WebKit Review Bot
no flags Details
Archive of layout-test-results from gce-cr-linux-05 (335.54 KB, application/zip)
2012-08-20 09:06 PDT, WebKit Review Bot
no flags Details
patch v2 (10.90 KB, patch)
2012-08-21 13:05 PDT, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff
patch v3 (10.89 KB, patch)
2012-08-21 13:16 PDT, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff
patch v4 (24.57 KB, patch)
2012-08-22 05:15 PDT, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff
patch v5 (25.54 KB, patch)
2012-08-22 05:56 PDT, Mikhail Pozdnyakov
ojan: review+
ojan: commit-queue-
Details | Formatted Diff | Diff
to be landed (25.60 KB, patch)
2012-09-06 00:44 PDT, Mikhail Pozdnyakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Pozdnyakov 2012-08-20 06:05:50 PDT
WebKit is missing ‘overflow-wrap’ property.

http://www.w3.org/TR/2012/WD-css3-text-20120814/#overflow-wrap

The specification says that ‘overflow-wrap’ is actually just another name for the currently implemented 
'word-wrap' property (which also should be supported for legacy reasons).
Comment 1 Mikhail Pozdnyakov 2012-08-20 06:17:40 PDT
Created attachment 159408 [details]
preliminary patch.

Preliminary patch. Dedicated test case and ChangeLog description are coming.
Comment 2 Mikhail Pozdnyakov 2012-08-20 06:58:43 PDT
Created attachment 159417 [details]
patch

Patch with layout test added.
Comment 3 Kenneth Rohde Christiansen 2012-08-20 07:01:03 PDT
Comment on attachment 159417 [details]
patch

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

> LayoutTests/ChangeLog:8
> +        Added âoverflow-wrapâ property implementation according to

â something wrong with the changelog?
Comment 4 Kenneth Rohde Christiansen 2012-08-20 07:02:23 PDT
Comment on attachment 159417 [details]
patch

Maybe Jullien wants wants a look before you commit
Comment 5 WebKit Review Bot 2012-08-20 08:08:54 PDT
Comment on attachment 159417 [details]
patch

Attachment 159417 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13528994

New failing tests:
fast/text/overflow-wrap.html
Comment 6 WebKit Review Bot 2012-08-20 08:08:58 PDT
Created attachment 159433 [details]
Archive of layout-test-results from gce-cr-linux-06

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-06  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 7 WebKit Review Bot 2012-08-20 09:06:51 PDT
Comment on attachment 159417 [details]
patch

Attachment 159417 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13537749

New failing tests:
fast/text/overflow-wrap.html
Comment 8 WebKit Review Bot 2012-08-20 09:06:56 PDT
Created attachment 159445 [details]
Archive of layout-test-results from gce-cr-linux-05

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: gce-cr-linux-05  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Comment 9 Julien Chaffraix 2012-08-20 09:43:17 PDT
Comment on attachment 159417 [details]
patch

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

> LayoutTests/fast/text/overflow-wrap-expected.txt:20
> +          text run at (2,110) width 127: "word CSS property."

First you are missing the image result (png) which is why the cq is rejecting your patch. Now my question is: why do we need a pixel test here? Couldn't we get away with a ref-test?

See http://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree for writing good pixel tests (hint: adding this test is platform-dependent which is bad) and http://trac.webkit.org/wiki/Writing%20Reftests about ref-tests. Also it would be nice to state better what you expect from the test: basically you are only testing "longlonglonglonglongword" wrapping, the rest of the explanations are just here to confuse.

> Source/WebCore/ChangeLog:9
> +        http://www.w3.org/TR/2012/WD-css3-text-20120814/#overflow-wrap.

Where do you implement the following sentence?

For legacy reasons, UAs must treat ‘word-wrap’ as an alternate name for the ‘overflow-wrap’ property, as if it were a shorthand of ‘overflow-wrap’.

> Source/WebCore/ChangeLog:26
> +        (WebCore::StyleResolver::collectMatchingRulesForList):

Those entries should be filled with details about the implementation.

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:162
> +    CSSPropertyOverflowWrap,

What's the rationale behind landing this unprefixed and without a compile time flag?

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1925
> +        case CSSPropertyOverflowWrap:
> +            return cssValuePool().createValue(style->wordWrap());

This is not covered by any test you have. You should add more testing to cover setting the style through JS / CSS and getting it via getComputedStyle. This *does* include testing that inheritance is properly implemented.
Comment 10 Julien Chaffraix 2012-08-20 09:46:18 PDT
Tab, if I am reading http://lists.w3.org/Archives/Public/www-style/2012May/0541.html properly, we shouldn't be implementing 'overflow-wrap' in WebKit as it will be made an alias of 'word-wrap' in a follow-up version of CSS3 text.
Comment 11 Mikhail Pozdnyakov 2012-08-21 13:05:02 PDT
Created attachment 159746 [details]
patch v2

Julien's feedback is taken into consideration. Improved the added layout test and ChangeLog description.
Comment 12 Mikhail Pozdnyakov 2012-08-21 13:16:18 PDT
Created attachment 159748 [details]
patch v3

Fixed typo in ChangeLog.
Comment 13 Mikhail Pozdnyakov 2012-08-21 13:20:07 PDT
Comment on attachment 159417 [details]
patch

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

>> LayoutTests/fast/text/overflow-wrap-expected.txt:20
>> +          text run at (2,110) width 127: "word CSS property."
> 
> First you are missing the image result (png) which is why the cq is rejecting your patch. Now my question is: why do we need a pixel test here? Couldn't we get away with a ref-test?
> 
> See http://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree for writing good pixel tests (hint: adding this test is platform-dependent which is bad) and http://trac.webkit.org/wiki/Writing%20Reftests about ref-tests. Also it would be nice to state better what you expect from the test: basically you are only testing "longlonglonglonglongword" wrapping, the rest of the explanations are just here to confuse.

Thanks for the hint and links!

>> Source/WebCore/ChangeLog:9
>> +        http://www.w3.org/TR/2012/WD-css3-text-20120814/#overflow-wrap.
> 
> Where do you implement the following sentence?
> 
> For legacy reasons, UAs must treat ‘word-wrap’ as an alternate name for the ‘overflow-wrap’ property, as if it were a shorthand of ‘overflow-wrap’.

It is implemented by applying the same handlers for both properties.

>> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:162
>> +    CSSPropertyOverflowWrap,
> 
> What's the rationale behind landing this unprefixed and without a compile time flag?

It's defined the same way as "word-wrap" property.
Comment 14 Tab Atkins 2012-08-21 13:29:53 PDT
(In reply to comment #10)
> Tab, if I am reading http://lists.w3.org/Archives/Public/www-style/2012May/0541.html properly, we shouldn't be implementing 'overflow-wrap' in WebKit as it will be made an alias of 'word-wrap' in a follow-up version of CSS3 text.

We've gone ahead and formalized the aliasing method (treat one of them as a shorthand for the "good" one), and so that's just been folded into the current draft of CSS3 Text.  So, we're okay to proceed on this bug.


(In reply to comment #13)
> >> Source/WebCore/ChangeLog:9
> >> +        http://www.w3.org/TR/2012/WD-css3-text-20120814/#overflow-wrap.
> > 
> > Where do you implement the following sentence?
> > 
> > For legacy reasons, UAs must treat ‘word-wrap’ as an alternate name for the ‘overflow-wrap’ property, as if it were a shorthand of ‘overflow-wrap’.
> 
> It is implemented by applying the same handlers for both properties.

It looks like you handle the "shorthand" behavior with your addition to StyleBuilder.cpp, right?  If so, I think you have it backwards - word-wrap is the shorthand for overflow-wrap, but you've implemented it as overflow-wrap being the shorthand for word-wrap.
 
> >> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:162
> >> +    CSSPropertyOverflowWrap,
> > 
> > What's the rationale behind landing this unprefixed and without a compile time flag?
> 
> It's defined the same way as "word-wrap" property.

Yes, it has zero new behavior, and is just a rename.  That's acceptable to land without prefixing, I think.
Comment 15 Mikhail Pozdnyakov 2012-08-22 05:15:12 PDT
Created attachment 159906 [details]
patch v4

Tab, thanks for your comments. I have made 'overflow-wrap' essential and 'text-wrap' a shorthand.
Comment 16 WebKit Review Bot 2012-08-22 05:18:37 PDT
Attachment 159906 [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/css/CSSPrimitiveValueMappings.h:2621:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Total errors found: 1 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 17 Kenneth Rohde Christiansen 2012-08-22 05:20:04 PDT
Comment on attachment 159906 [details]
patch v4

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

> LayoutTests/fast/text/overflow-wrap-expected.html:1
> +<script>

where is the html5 doctype, html, head? Also please link to the releavant part of the spec as suggested by http://wiki.csswg.org/test/format
Comment 18 Mikhail Pozdnyakov 2012-08-22 05:24:49 PDT
(In reply to comment #16)
> Attachment 159906 [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/css/CSSPrimitiveValueMappings.h:2621:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
> Total errors found: 1 in 19 files
> 
> 
> If any of these errors are false positives, please file a bug against check-webkit-style.

Such indentation is everywhere inside Source/WebCore/css/CSSPrimitiveValueMappings.h, it might worth aligning with style guides, however think it's out of this bug's scope.
Comment 19 Mikhail Pozdnyakov 2012-08-22 05:56:07 PDT
Created attachment 159916 [details]
patch v5

Kenneth, thanks for review and for the link!
Comment 20 WebKit Review Bot 2012-08-22 05:59:22 PDT
Attachment 159916 [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/css/CSSPrimitiveValueMappings.h:2621:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Total errors found: 1 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 21 Mikhail Pozdnyakov 2012-08-24 03:24:15 PDT
Any further comments? review?
Comment 22 Ojan Vafai 2012-09-05 16:49:07 PDT
Comment on attachment 159916 [details]
patch v5

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

> Source/WebCore/css/StyleBuilder.cpp:2065
> +    setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());

This could probably use a comment explaining why we are setting EOverflowWrap for CSSPropertyWordWrap.
Comment 23 Mikhail Pozdnyakov 2012-09-06 00:44:37 PDT
Created attachment 162438 [details]
to be landed

Added required comment. Rebased to master.
Comment 24 WebKit Review Bot 2012-09-06 00:51:29 PDT
Attachment 162438 [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/css/CSSPrimitiveValueMappings.h:2626:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Total errors found: 1 in 19 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 25 WebKit Review Bot 2012-09-06 06:05:07 PDT
Comment on attachment 162438 [details]
to be landed

Rejecting attachment 162438 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2

Last 500 characters of output:
mit-queue/Source/WebKit/chromium/third_party/skia/gyp --revision 5398 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
45>At revision 5398.

________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'

________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
Updating webkit projects from gyp files...

Full output: http://queues.webkit.org/results/13768374
Comment 26 Mikhail Pozdnyakov 2012-09-06 06:08:06 PDT
(In reply to comment #25)
> (From update of attachment 162438 [details])
> Rejecting attachment 162438 [details] from commit-queue.
> 
> Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2
> 
> Last 500 characters of output:
> mit-queue/Source/WebKit/chromium/third_party/skia/gyp --revision 5398 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
> 45>At revision 5398.
> 
> ________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
> 
> ________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium'
> Updating webkit projects from gyp files...
> 
> Full output: http://queues.webkit.org/results/13768374

Merge conflict during commit: Conflict at '/trunk/LayoutTests/ChangeLog' at /usr/lib/git-core/git-svn line 570 
Sound weird...
Comment 27 Dominik Röttsches (drott) 2012-09-06 06:22:17 PDT
Let's try again.
Comment 28 WebKit Review Bot 2012-09-06 07:00:11 PDT
Comment on attachment 162438 [details]
to be landed

Clearing flags on attachment: 162438

Committed r127737: <http://trac.webkit.org/changeset/127737>
Comment 29 WebKit Review Bot 2012-09-06 07:00:18 PDT
All reviewed patches have been landed.  Closing bug.