Bug 155006

Summary: Simple line layout:: Add text-align: justify support.
Product: WebKit Reporter: zalan <zalan>
Component: Layout and RenderingAssignee: zalan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, commit-queue, esprehn+autocc, glenn, koivisto, kondapallykalyan, mmaxfield, rniwa, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ews106 for mac-yosemite-wk2
none
Archive of layout-test-results from ews100 for mac-yosemite
none
Archive of layout-test-results from ews113 for mac-yosemite
none
Patch none

Description zalan 2016-03-03 20:08:16 PST
It is a common property on text content and we can extend simple line layout to support it without regressing performance.
Comment 1 zalan 2016-03-10 11:19:17 PST
Created attachment 273585 [details]
Patch
Comment 2 zalan 2016-03-10 11:21:43 PST
 PerformanceTests/Layout/line-layout-simple.html
 before text-align: justify support -> mean: 86.20513022288704 runs/s 
 after -> mean: 96.73972475626084 runs/s
Comment 3 Build Bot 2016-03-10 11:58:01 PST
Comment on attachment 273585 [details]
Patch

Attachment 273585 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/955522

New failing tests:
fast/regions/overflow/overflow-in-uniform-regions.html
Comment 4 Build Bot 2016-03-10 11:58:06 PST
Created attachment 273592 [details]
Archive of layout-test-results from ews106 for mac-yosemite-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-yosemite-wk2  Platform: Mac OS X 10.10.5
Comment 5 Antti Koivisto 2016-03-10 12:06:09 PST
Comment on attachment 273585 [details]
Patch

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

> Source/WebCore/rendering/SimpleLineLayout.cpp:412
> +    std::pair<unsigned, bool> expansionOpportunityCount(unsigned from, unsigned to) const

It looks like bool is true if and only if unsigned >0. Maybe you could just return unsigned and test if it is nonzero in client?

> Source/WebCore/rendering/SimpleLineLayout.cpp:414
> +        unsigned expansionOportunityCount = 0;

Spelling "Oportunity"

> Source/WebCore/rendering/SimpleLineLayout.cpp:420
> +            auto expansionOportunity = this->expansionOportunity(currentFragmentType, previousFragmentType);

Here too

> Source/WebCore/rendering/SimpleLineLayout.cpp:808
> +    auto textAlign = style.textAlign;
> +    // Fallback to LEFT alignment both for non-collapsable content and for the last line.
> +    if (style.textAlign == JUSTIFY && (!style.collapseWhitespace || lastLine))

You could use the 'textAlign' local here.

> Source/WebCore/rendering/SimpleLineLayout.cpp:814
> +    else {
> +        if (float lineLogicalLeft = computeLineLeft(textAlign, line.availableWidth(), line.width(), line.logicalLeftOffset())) {

Could maybe just say 'else if'

> Source/WebCore/rendering/SimpleLineLayout.h:63
> +    // TODO: Move these optional items out of SimpleLineLayout::Run to a supplementary structure.

Yep.
Comment 6 Build Bot 2016-03-10 12:09:13 PST
Comment on attachment 273585 [details]
Patch

Attachment 273585 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/955629

New failing tests:
fast/regions/overflow/overflow-in-uniform-regions.html
Comment 7 Build Bot 2016-03-10 12:09:17 PST
Created attachment 273594 [details]
Archive of layout-test-results from ews100 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 8 Build Bot 2016-03-10 12:23:35 PST
Comment on attachment 273585 [details]
Patch

Attachment 273585 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/955577

New failing tests:
editing/undo/orphaned-selection-crash-bug32823-2.html
fast/regions/overflow/overflow-in-uniform-regions.html
Comment 9 Build Bot 2016-03-10 12:23:41 PST
Created attachment 273596 [details]
Archive of layout-test-results from ews113 for mac-yosemite

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews113  Port: mac-yosemite  Platform: Mac OS X 10.10.5
Comment 10 zalan 2016-03-10 14:46:40 PST
Created attachment 273623 [details]
Patch
Comment 11 WebKit Commit Bot 2016-03-10 20:03:21 PST
Comment on attachment 273623 [details]
Patch

Clearing flags on attachment: 273623

Committed r197987: <http://trac.webkit.org/changeset/197987>
Comment 12 WebKit Commit Bot 2016-03-10 20:03:30 PST
All reviewed patches have been landed.  Closing bug.