Changeset 234000 in webkit
- Timestamp:
- Jul 19, 2018 1:36:13 PM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 9 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r233995 r234000 1 2018-07-19 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Introduce simple line breaker. 4 https://bugs.webkit.org/show_bug.cgi?id=187688 5 6 Reviewed by Antti Koivisto. 7 8 This patch takes the simple line layout implementation and refactors it in a way it is no longer requires a RenderBlockFlow object to run on. 9 Also this patch decouples text run generation and line breaking (and this implementation is going to replace the current simple line layout codebase) 10 11 TextContentProvider: Acts both as the container for all the text content (including hard line breaks) and as an iterator for the generated text runs. 12 SimpleTextRunGenerator: TextContentProvider uses it as the text run generator for simple content (in the future we'll have a ComplexTextRunGenerator). 13 SimpleLineBreaker: Input -> text runs + line constraints; Output -> layout runs after line breaking. 14 15 * Sources.txt: 16 * WebCore.xcodeproj/project.pbxproj: 17 * layout/inlineformatting/textlayout/ContentProvider.cpp: Added. 18 (WebCore::Layout::TextContentProvider::TextItem::Style::Style): 19 (WebCore::Layout::TextContentProvider::ContentProvider): 20 (WebCore::Layout::TextContentProvider::~ContentProvider): 21 (WebCore::Layout::TextContentProvider::appendText): 22 (WebCore::Layout::TextContentProvider::appendLineBreak): 23 (WebCore::Layout::TextContentProvider::width const): 24 (WebCore::Layout::TextContentProvider::textWidth const): 25 (WebCore::Layout::TextContentProvider::fixedPitchWidth const): 26 (WebCore::Layout::TextContentProvider::toTextItemIndex const): 27 (WebCore::Layout::TextContentProvider::length const): 28 (WebCore::Layout::TextContentProvider::iterator): 29 (WebCore::Layout::TextContentProvider::findNextRun): 30 (WebCore::Layout::TextContentProvider::current const): 31 * layout/inlineformatting/textlayout/ContentProvider.h: Added. 32 (WebCore::Layout::TextContentProvider::textContent const): 33 (WebCore::Layout::TextContentProvider::hardLineBreaks const): 34 (WebCore::Layout::TextContentProvider::Iterator::current const): 35 (WebCore::Layout::TextContentProvider::contains const): 36 (WebCore::Layout::TextContentProvider::Iterator::Iterator): 37 (WebCore::Layout::TextContentProvider::Iterator::operator++): 38 * layout/inlineformatting/textlayout/Runs.h: Added. 39 (WebCore::Layout::TextRun::isWhitespace const): 40 (WebCore::Layout::TextRun::isNonWhitespace const): 41 (WebCore::Layout::TextRun::isLineBreak const): 42 (WebCore::Layout::TextRun::isSoftLineBreak const): 43 (WebCore::Layout::TextRun::isHardLineBreak const): 44 (WebCore::Layout::TextRun::isValid const): 45 (WebCore::Layout::TextRun::isCollapsed const): 46 (WebCore::Layout::TextRun::type const): 47 (WebCore::Layout::TextRun::setIsCollapsed): 48 (WebCore::Layout::TextRun::setWidth): 49 (WebCore::Layout::LayoutRun::start const): 50 (WebCore::Layout::LayoutRun::end const): 51 (WebCore::Layout::LayoutRun::length const): 52 (WebCore::Layout::LayoutRun::left const): 53 (WebCore::Layout::LayoutRun::right const): 54 (WebCore::Layout::LayoutRun::width const): 55 (WebCore::Layout::LayoutRun::isEndOfLine const): 56 (WebCore::Layout::LayoutRun::setEnd): 57 (WebCore::Layout::LayoutRun::setRight): 58 (WebCore::Layout::LayoutRun::setIsEndOfLine): 59 (WebCore::Layout::LayoutRun::LayoutRun): 60 (WebCore::Layout::TextRun::createWhitespaceRun): 61 (WebCore::Layout::TextRun::createNonWhitespaceRun): 62 (WebCore::Layout::TextRun::createSoftLineBreakRun): 63 (WebCore::Layout::TextRun::createHardLineBreakRun): 64 (WebCore::Layout::TextRun::TextRun): 65 (WebCore::Layout::TextRun::start const): 66 (WebCore::Layout::TextRun::end const): 67 (WebCore::Layout::TextRun::length const): 68 (WebCore::Layout::TextRun::width const): 69 * layout/inlineformatting/textlayout/simple/SimpleContentProvider.cpp: Added. 70 (WebCore::Layout::SimpleContentProvider::SimpleContentProvider): 71 (WebCore::Layout::SimpleContentProvider::current const): 72 (WebCore::Layout::SimpleContentProvider::reset): 73 (WebCore::Layout::SimpleContentProvider::findNextRun): 74 (WebCore::Layout::SimpleContentProvider::moveToNextBreakablePosition): 75 (WebCore::Layout::SimpleContentProvider::moveToNextNonWhitespacePosition): 76 (WebCore::Layout::SimpleContentProvider::isAtLineBreak const): 77 (WebCore::Layout::SimpleContentProvider::isAtSoftLineBreak const): 78 * layout/inlineformatting/textlayout/simple/SimpleContentProvider.h: Added. 79 (WebCore::Layout::SimpleContentProvider::Iterator::reset): 80 (WebCore::Layout::SimpleContentProvider::Position::operator== const): 81 (WebCore::Layout::SimpleContentProvider::Position::operator< const): 82 (WebCore::Layout::SimpleContentProvider::Position::operator ContentPosition const): 83 (WebCore::Layout::SimpleContentProvider::Position::resetItemPosition): 84 (WebCore::Layout::SimpleContentProvider::Position::contentPosition const): 85 (WebCore::Layout::SimpleContentProvider::Position::itemPosition const): 86 (WebCore::Layout::SimpleContentProvider::Iterator<T>::Iterator): 87 (WebCore::Layout::SimpleContentProvider::Iterator<T>::current const): 88 (WebCore::Layout::SimpleContentProvider::Iterator<T>::operator): 89 (WebCore::Layout::SimpleContentProvider::Position::operator++): 90 (WebCore::Layout::SimpleContentProvider::Position::operator+=): 91 * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp: Added. 92 (WebCore::Layout::SimpleLineBreaker::TextRunList::TextRunList): 93 (WebCore::Layout::SimpleLineBreaker::Line::Line): 94 (WebCore::Layout::adjustedEndPosition): 95 (WebCore::Layout::SimpleLineBreaker::Line::append): 96 (WebCore::Layout::SimpleLineBreaker::Line::collapseTrailingWhitespace): 97 (WebCore::Layout::SimpleLineBreaker::Line::reset): 98 (WebCore::Layout::SimpleLineBreaker::Style::Style): 99 (WebCore::Layout::SimpleLineBreaker::SimpleLineBreaker): 100 (WebCore::Layout::SimpleLineBreaker::runs): 101 (WebCore::Layout::SimpleLineBreaker::createRunsForLine): 102 (WebCore::Layout::SimpleLineBreaker::handleOverflownRun): 103 (WebCore::Layout::SimpleLineBreaker::collapseLeadingWhitespace): 104 (WebCore::Layout::SimpleLineBreaker::collapseTrailingWhitespace): 105 (WebCore::Layout::SimpleLineBreaker::splitTextRun): 106 (WebCore::Layout::SimpleLineBreaker::split const): 107 (WebCore::Layout::SimpleLineBreaker::availableWidth const): 108 (WebCore::Layout::SimpleLineBreaker::verticalPosition const): 109 * layout/inlineformatting/textlayout/simple/SimpleLineBreaker.h: Added. 110 (WebCore::Layout::SimpleLineBreaker::TextRunList::overrideCurrent): 111 (WebCore::Layout::SimpleLineBreaker::TextRunList::isCurrentOverridden const): 112 (WebCore::Layout::SimpleLineBreaker::Line::availableWidth const): 113 (WebCore::Layout::SimpleLineBreaker::Line::hasContent const): 114 (WebCore::Layout::SimpleLineBreaker::Line::setAvailableWidth): 115 (WebCore::Layout::SimpleLineBreaker::Line::hasTrailingWhitespace const): 116 (WebCore::Layout::SimpleLineBreaker::Line::isWhitespaceOnly const): 117 (WebCore::Layout::SimpleLineBreaker::wrapContentOnOverflow const): 118 (WebCore::Layout::SimpleLineBreaker::TextRunList::current const): 119 (WebCore::Layout::SimpleLineBreaker::TextRunList::operator++): 120 1 121 2018-07-19 Keith Rollin <krollin@apple.com> 2 122 -
trunk/Source/WebCore/Sources.txt
r233846 r234000 1233 1233 layout/inlineformatting/InlineFormattingState.cpp 1234 1234 layout/inlineformatting/InlineInvalidation.cpp 1235 layout/inlineformatting/textlayout/TextContentProvider.cpp 1236 layout/inlineformatting/textlayout/simple/SimpleTextRunGenerator.cpp 1237 layout/inlineformatting/textlayout/simple/SimpleLineBreaker.cpp 1235 1238 layout/layouttree/LayoutBlockContainer.cpp 1236 1239 layout/layouttree/LayoutBox.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r233995 r234000 5808 5808 11E067EB1E62461300162D16 /* SimpleLineLayoutCoverage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutCoverage.cpp; sourceTree = "<group>"; }; 5809 5809 11E067ED1E6246E500162D16 /* SimpleLineLayoutCoverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutCoverage.h; sourceTree = "<group>"; }; 5810 11EA57FB20FFAFB600311EBB /* SimpleTextRunGenerator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleTextRunGenerator.cpp; sourceTree = "<group>"; }; 5811 11EA57FC20FFAFB700311EBB /* SimpleTextRunGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleTextRunGenerator.h; sourceTree = "<group>"; }; 5810 5812 11FF02D520BA3C810083F25B /* Verification.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Verification.cpp; sourceTree = "<group>"; }; 5811 5813 1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappableInlines.h; sourceTree = "<group>"; }; … … 8917 8919 6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InlineFormattingContext.h; sourceTree = "<group>"; }; 8918 8920 6F7CA3C9208C2B2E002F29AB /* InlineFormattingContext.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineFormattingContext.cpp; sourceTree = "<group>"; }; 8921 6F8304C920FBA5E1004AD5D1 /* SimpleLineBreaker.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineBreaker.cpp; sourceTree = "<group>"; }; 8922 6F8304CA20FBA5E1004AD5D1 /* SimpleLineBreaker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SimpleLineBreaker.h; sourceTree = "<group>"; }; 8919 8923 6F995A091A7070E600A735F4 /* WebGLQuery.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLQuery.idl; sourceTree = "<group>"; }; 8920 8924 6F995A0A1A7070E600A735F4 /* WebGLSampler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGLSampler.idl; sourceTree = "<group>"; }; … … 8943 8947 6F995A301A70833700A735F4 /* JSWebGLVertexArrayObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLVertexArrayObject.h; sourceTree = "<group>"; }; 8944 8948 6FBB860520B464B600DAD938 /* FormattingContextGeometry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FormattingContextGeometry.cpp; sourceTree = "<group>"; }; 8949 6FCD19C120F9727A00FD4529 /* TextContentProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextContentProvider.h; sourceTree = "<group>"; }; 8950 6FCD19C720F9727D00FD4529 /* TextContentProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TextContentProvider.cpp; sourceTree = "<group>"; }; 8951 6FCF975220F02B3500214960 /* Runs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Runs.h; sourceTree = "<group>"; }; 8945 8952 709A01FD1E3D0BCC006B0D4C /* ModuleFetchFailureKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleFetchFailureKind.h; sourceTree = "<group>"; }; 8946 8953 71004B9D1DC1398800A52A38 /* playback-support.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = "playback-support.js"; sourceTree = "<group>"; }; … … 15776 15783 isa = PBXGroup; 15777 15784 children = ( 15785 6FE7DDDD20EC6E8B008B5B4E /* textlayout */, 15778 15786 6F7CA3C9208C2B2E002F29AB /* InlineFormattingContext.cpp */, 15779 15787 6F7CA3C8208C2B2E002F29AB /* InlineFormattingContext.h */, … … 19501 19509 tabWidth = 4; 19502 19510 usesTabs = 0; 19511 }; 19512 6F13A12320F9949C001C025A /* simple */ = { 19513 isa = PBXGroup; 19514 children = ( 19515 6F8304C920FBA5E1004AD5D1 /* SimpleLineBreaker.cpp */, 19516 6F8304CA20FBA5E1004AD5D1 /* SimpleLineBreaker.h */, 19517 11EA57FB20FFAFB600311EBB /* SimpleTextRunGenerator.cpp */, 19518 11EA57FC20FFAFB700311EBB /* SimpleTextRunGenerator.h */, 19519 ); 19520 path = simple; 19521 sourceTree = "<group>"; 19522 }; 19523 6FE7DDDD20EC6E8B008B5B4E /* textlayout */ = { 19524 isa = PBXGroup; 19525 children = ( 19526 6F13A12320F9949C001C025A /* simple */, 19527 6FCF975220F02B3500214960 /* Runs.h */, 19528 6FCD19C720F9727D00FD4529 /* TextContentProvider.cpp */, 19529 6FCD19C120F9727A00FD4529 /* TextContentProvider.h */, 19530 ); 19531 path = textlayout; 19532 sourceTree = "<group>"; 19503 19533 }; 19504 19534 71025EC11F99F096004A250C /* animation */ = {
Note: See TracChangeset
for help on using the changeset viewer.