Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull out LazyLineBreakIterator's prior context handling into a separate class #14169

Conversation

litherum
Copy link
Contributor

@litherum litherum commented May 22, 2023

b5583c5

Pull out LazyLineBreakIterator's prior context handling into a separate class
https://bugs.webkit.org/show_bug.cgi?id=257115
rdar://109646131

Reviewed by Yusuke Suzuki.

LazyLineBreakIterator is really a factory, which holds the necessary parameters to
create line break iterators. But, it also has a bunch of handling for a "prior context"
which is conceptually a prefix to the string being broken.

This patch isn't strictly necessary, but I thought it would be a bit more elegant to
have a class separation between the two pieces of LazyLineBreakIterator.

* Source/WTF/wtf/text/TextBreakIterator.h:
(WTF::LazyLineBreakIterator::PriorContext::PriorContext):
(WTF::LazyLineBreakIterator::PriorContext::lastCharacter const):
(WTF::LazyLineBreakIterator::PriorContext::secondToLastCharacter const):
(WTF::LazyLineBreakIterator::PriorContext::set):
(WTF::LazyLineBreakIterator::PriorContext::update):
(WTF::LazyLineBreakIterator::PriorContext::reset):
(WTF::LazyLineBreakIterator::PriorContext::length const):
(WTF::LazyLineBreakIterator::PriorContext::characters const):
(WTF::LazyLineBreakIterator::LazyLineBreakIterator):
(WTF::LazyLineBreakIterator::get):
(WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
(WTF::LazyLineBreakIterator::priorContext const):
(WTF::LazyLineBreakIterator::priorContext):
(WTF::TextBreakIteratorCache::TextBreakIteratorCache): Deleted.
(WTF::LazyLineBreakIterator::lastCharacter const): Deleted.
(WTF::LazyLineBreakIterator::secondToLastCharacter const): Deleted.
(WTF::LazyLineBreakIterator::setPriorContext): Deleted.
(WTF::LazyLineBreakIterator::updatePriorContext): Deleted.
(WTF::LazyLineBreakIterator::resetPriorContext): Deleted.
(WTF::LazyLineBreakIterator::priorContextLength const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::endsWithSoftWrapOpportunity):
* Source/WebCore/rendering/BreakLines.h:
(WebCore::nextBreakablePosition):
* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::layoutRunsAndFloatsInRange):
* Source/WebCore/rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* Source/WebCore/rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator const):
* Source/WebCore/rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore const):
* Source/WebCore/rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleOutOfFlowPositioned):
(WebCore::BreakingContext::handleFloat):
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::handleText):

Canonical link: https://commits.webkit.org/264444@main

cca0ce9

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl   πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ›  gtk
  πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  πŸ§ͺ jsc   πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv ❌ πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ›  jsc-armv7
βœ… πŸ›  tv-sim βœ… πŸ§ͺ jsc-armv7-tests
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch βœ… πŸ›  jsc-mips
βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-mips-tests

@litherum litherum self-assigned this May 22, 2023
@litherum litherum added the Text For bugs in text layout and rendering, including international text support. label May 22, 2023
@litherum litherum force-pushed the eng/Pull-out-LazyLineBreakIterators-prior-context-handling-into-a-separate-class branch from dc0e4a2 to a533a27 Compare May 22, 2023 08:26
@litherum litherum force-pushed the eng/Pull-out-LazyLineBreakIterators-prior-context-handling-into-a-separate-class branch from a533a27 to 58638dc Compare May 22, 2023 08:28
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 22, 2023
@litherum

This comment was marked as outdated.

@litherum litherum marked this pull request as draft May 23, 2023 08:01
@litherum litherum removed the merging-blocked Applied to prevent a change from being merged label May 23, 2023
@litherum litherum force-pushed the eng/Pull-out-LazyLineBreakIterators-prior-context-handling-into-a-separate-class branch from 58638dc to cca0ce9 Compare May 23, 2023 10:04
@litherum litherum marked this pull request as ready for review May 23, 2023 10:04
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label May 23, 2023
Copy link
Member

@Constellation Constellation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@litherum litherum added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels May 23, 2023
…te class

https://bugs.webkit.org/show_bug.cgi?id=257115
rdar://109646131

Reviewed by Yusuke Suzuki.

LazyLineBreakIterator is really a factory, which holds the necessary parameters to
create line break iterators. But, it also has a bunch of handling for a "prior context"
which is conceptually a prefix to the string being broken.

This patch isn't strictly necessary, but I thought it would be a bit more elegant to
have a class separation between the two pieces of LazyLineBreakIterator.

* Source/WTF/wtf/text/TextBreakIterator.h:
(WTF::LazyLineBreakIterator::PriorContext::PriorContext):
(WTF::LazyLineBreakIterator::PriorContext::lastCharacter const):
(WTF::LazyLineBreakIterator::PriorContext::secondToLastCharacter const):
(WTF::LazyLineBreakIterator::PriorContext::set):
(WTF::LazyLineBreakIterator::PriorContext::update):
(WTF::LazyLineBreakIterator::PriorContext::reset):
(WTF::LazyLineBreakIterator::PriorContext::length const):
(WTF::LazyLineBreakIterator::PriorContext::characters const):
(WTF::LazyLineBreakIterator::LazyLineBreakIterator):
(WTF::LazyLineBreakIterator::get):
(WTF::LazyLineBreakIterator::resetStringAndReleaseIterator):
(WTF::LazyLineBreakIterator::priorContext const):
(WTF::LazyLineBreakIterator::priorContext):
(WTF::TextBreakIteratorCache::TextBreakIteratorCache): Deleted.
(WTF::LazyLineBreakIterator::lastCharacter const): Deleted.
(WTF::LazyLineBreakIterator::secondToLastCharacter const): Deleted.
(WTF::LazyLineBreakIterator::setPriorContext): Deleted.
(WTF::LazyLineBreakIterator::updatePriorContext): Deleted.
(WTF::LazyLineBreakIterator::resetPriorContext): Deleted.
(WTF::LazyLineBreakIterator::priorContextLength const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::endsWithSoftWrapOpportunity):
* Source/WebCore/rendering/BreakLines.h:
(WebCore::nextBreakablePosition):
* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::layoutRunsAndFloatsInRange):
* Source/WebCore/rendering/RenderRubyBase.cpp:
(WebCore::RenderRubyBase::cachePriorCharactersIfNeeded):
* Source/WebCore/rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::updatePriorContextFromCachedBreakIterator const):
* Source/WebCore/rendering/RenderRubyText.cpp:
(WebCore::RenderRubyText::canBreakBefore const):
* Source/WebCore/rendering/line/BreakingContext.h:
(WebCore::BreakingContext::handleOutOfFlowPositioned):
(WebCore::BreakingContext::handleFloat):
(WebCore::BreakingContext::handleReplaced):
(WebCore::BreakingContext::handleText):

Canonical link: https://commits.webkit.org/264444@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Pull-out-LazyLineBreakIterators-prior-context-handling-into-a-separate-class branch from cca0ce9 to b5583c5 Compare May 23, 2023 22:51
@webkit-commit-queue
Copy link
Collaborator

Committed 264444@main (b5583c5): https://commits.webkit.org/264444@main

Reviewed commits have been landed. Closing PR #14169 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit b5583c5 into WebKit:main May 23, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 23, 2023
@litherum litherum deleted the eng/Pull-out-LazyLineBreakIterators-prior-context-handling-into-a-separate-class branch May 23, 2023 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Text For bugs in text layout and rendering, including international text support.
Projects
None yet
5 participants