Summary: | Simple line layout: Move leading whitespace handling from removeTrailingWhitespace() to initializeNewLine(). | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | zalan <zalan> | ||||||||||
Component: | Layout and Rendering | Assignee: | zalan <zalan> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | commit-queue, esprehn+autocc, glenn, koivisto, kondapallykalyan, mmaxfield | ||||||||||
Priority: | P2 | ||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Attachments: |
|
Description
zalan
2015-01-21 20:42:42 PST
Created attachment 245112 [details]
WIP patch.
Created attachment 245183 [details]
Patch
Created attachment 245198 [details]
Patch
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. Created attachment 245200 [details]
Patch
Comment on attachment 245200 [details] Patch Clearing flags on attachment: 245200 Committed r178983: <http://trac.webkit.org/changeset/178983> All reviewed patches have been landed. Closing bug. |