RESOLVED FIXED 140757
Simple line layout: Move leading whitespace handling from removeTrailingWhitespace() to initializeNewLine().
https://bugs.webkit.org/show_bug.cgi?id=140757
Summary Simple line layout: Move leading whitespace handling from removeTrailingWhite...
alan
Reported 2015-01-21 20:42:42 PST
This is in preparation to make FlowContents as iterator class.
Attachments
WIP patch. (14.16 KB, patch)
2015-01-21 20:43 PST, alan
no flags
Patch (7.55 KB, patch)
2015-01-22 16:38 PST, alan
no flags
Patch (8.62 KB, patch)
2015-01-22 20:03 PST, alan
no flags
Patch (8.75 KB, patch)
2015-01-22 20:31 PST, alan
no flags
alan
Comment 1 2015-01-21 20:43:50 PST
Created attachment 245112 [details] WIP patch.
alan
Comment 2 2015-01-22 16:38:45 PST
alan
Comment 3 2015-01-22 20:03:25 PST
Antti Koivisto
Comment 4 2015-01-22 20:08:01 PST
Comment on attachment 245198 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=245198&action=review > Source/WebCore/rendering/SimpleLineLayout.cpp:334 > + // Remove collapsed whitespace, or non-collapsed pre-wrap whitepsace, unless it's the only content on the line -so removing the whitesapce would produce an empty line. > + if (!(style.collapseWhitespace || (preWrap(style) && !lineState.hasWhitespaceOnly()))) This is bit difficult to read with all the !s. Maybe have a sensibly named boolean helper? > Source/WebCore/rendering/SimpleLineLayout.cpp:385 > + if (overflowedFragment.isEmpty()) { > unsigned spaceCount = 0; > - lineState.jumpTo(flowContents.style().collapseWhitespace ? flowContents.findNextNonWhitespacePosition(previousLine.position, spaceCount) : previousLine.position, 0); > + lineState.jumpTo(style.collapseWhitespace ? flowContents.findNextNonWhitespacePosition(linePositon, spaceCount) : linePositon, 0); > + } else if (lineState.fits(overflowedFragment.width)) > + lineState.addUncommitted(overflowedFragment); > + else { > + // Start over with this fragment. > + lineState.jumpTo(overflowedFragment.start, 0); > } > return lineState; This would read better with early returns. No need for else branches.
alan
Comment 5 2015-01-22 20:31:00 PST
WebKit Commit Bot
Comment 6 2015-01-22 22:26:25 PST
Comment on attachment 245200 [details] Patch Clearing flags on attachment: 245200 Committed r178983: <http://trac.webkit.org/changeset/178983>
WebKit Commit Bot
Comment 7 2015-01-22 22:26:29 PST
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.