Migrate line breaking code from ints to Optional<unsigned>s
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 22:39:10 +0000 (22:39 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 16 Aug 2016 22:39:10 +0000 (22:39 +0000)
commit22f032e6bbaed6cd7861c369029bea397b352e0e
treeb515c174397b7f2f2312e9c40a142828773a707b
parente74ed69a7f9d9781106fa6ff039b3258a459e363
Migrate line breaking code from ints to Optional<unsigned>s
https://bugs.webkit.org/show_bug.cgi?id=160859

Reviewed by Darin Adler.

Source/WebCore:

Previously, we were using -1 to mean "before the beginning of the string". Now,
Nullopt means that.

This patch also renames break_lines.{h,cpp} to BreakLines.{h.cpp}. This file was
originally named during the KHTML days.

No new tests because there is no behavior change.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* rendering/BreakLines.cpp: Renamed from Source/WebCore/rendering/break_lines.cpp.
* rendering/BreakLines.h: Renamed from Source/WebCore/rendering/break_lines.h.
(WebCore::isBreakableSpace):
(WebCore::shouldBreakAfter):
(WebCore::needsLineBreakIterator):
(WebCore::nextBreakablePositionNonLoosely):
(WebCore::nextBreakablePositionLoosely):
(WebCore::nextBreakablePositionKeepingAllWords):
(WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP):
(WebCore::nextBreakablePosition):
(WebCore::nextBreakablePositionIgnoringNBSP):
(WebCore::nextBreakablePositionLoose):
(WebCore::nextBreakablePositionIgnoringNBSPLoose):
(WebCore::isBreakable):
* rendering/InlineIterator.h:
(WebCore::InlineIterator::moveTo):
(WebCore::InlineIterator::nextBreakablePosition):
(WebCore::InlineIterator::setNextBreakablePosition):
(WebCore::InlineIterator::InlineIterator): Deleted.
* rendering/InlineTextBox.cpp:
* rendering/RenderText.cpp:
(WebCore::RenderText::computePreferredLogicalWidths):
* rendering/RenderingAllInOne.cpp:
* rendering/SimpleLineLayoutTextFragmentIterator.h:
* rendering/break_lines.h:
(WebCore::isBreakableSpace): Deleted.
(WebCore::shouldBreakAfter): Deleted.
(WebCore::needsLineBreakIterator): Deleted.
(WebCore::nextBreakablePositionNonLoosely): Deleted.
(WebCore::nextBreakablePositionLoosely): Deleted.
(WebCore::nextBreakablePositionKeepingAllWords): Deleted.
(WebCore::nextBreakablePositionKeepingAllWordsIgnoringNBSP): Deleted.
(WebCore::nextBreakablePosition): Deleted.
(WebCore::nextBreakablePositionIgnoringNBSP): Deleted.
(WebCore::nextBreakablePositionLoose): Deleted.
(WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
(WebCore::isBreakable): Deleted.
* rendering/line/BreakingContext.h:
(WebCore::BreakingContext::commitLineBreakAtCurrentWidth):
(WebCore::BreakingContext::InlineIteratorHistory::nextBreakablePosition):
(WebCore::BreakingContext::InlineIteratorHistory::moveTo):
(WebCore::tryHyphenating):
(WebCore::BreakingContext::handleText):
(WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):

Source/WebKit/ios:

* Misc/WebUIKitSupport.mm:
(WebKitGetLastLineBreakInBuffer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WTF/wtf/text/TextBreakIterator.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/rendering/BreakLines.cpp [moved from Source/WebCore/rendering/break_lines.cpp with 96% similarity]
Source/WebCore/rendering/BreakLines.h [new file with mode: 0644]
Source/WebCore/rendering/InlineIterator.h
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebCore/rendering/RenderingAllInOne.cpp
Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp
Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h
Source/WebCore/rendering/break_lines.h [deleted file]
Source/WebCore/rendering/line/BreakingContext.h
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/Misc/WebUIKitSupport.mm