[webkit-changes] [WebKit/WebKit] 7d9c04: [Cocoa] Hook "prior context" infrastructure up to ...

Myles C. Maxfield noreply at github.com
Tue May 30 23:46:38 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7d9c042f3a2b131e83b2fed0647f75c5aff524e5
      https://github.com/WebKit/WebKit/commit/7d9c042f3a2b131e83b2fed0647f75c5aff524e5
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/text/NullTextBreakIterator.h
    M Source/WTF/wtf/text/TextBreakIterator.h
    M Source/WTF/wtf/text/cf/TextBreakIteratorCF.h
    M Source/WTF/wtf/text/cf/TextBreakIteratorCFCharacterCluster.h
    M Source/WTF/wtf/text/cf/TextBreakIteratorCFStringTokenizer.h
    A Source/WTF/wtf/text/cocoa/ContextualizedCFString.h
    A Source/WTF/wtf/text/cocoa/ContextualizedCFString.mm
    M Source/WTF/wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp
    M Source/WTF/wtf/text/icu/TextBreakIteratorICU.h
    M Tools/TestWebKitAPI/Tests/WTF/TextBreakIterator.cpp
    M Tools/TestWebKitAPI/Tests/WTF/cocoa/ContextualizedNSString.mm

  Log Message:
  -----------
  [Cocoa] Hook "prior context" infrastructure up to TextBreakIteratorCF
https://bugs.webkit.org/show_bug.cgi?id=257467
rdar://109983296

Reviewed by Alan Baradlay.

This patch is the next step to being able to use platform text iterators to break lines.
Previously, I implemented ContextualizedNSString, which is a subclass of NSString whose
backing store is 2 StringViews: one for the prior context of the string at hand, and one
for the string at hand itself. This patch hooks up ContextualizedNSString to our
TextBreakIteratorCF class, to allow TextBreakIteratorCF to work with prior context. This
is necessary because our line breaking code requires this prior context to work correctly,
and TextBreakIterator is the object which has a Core Foundation backend. If we want to be
able to do line breaking using Core Foundation, this patch is necessary.

The next patch will do something similar for TextBreakIteratorICU (which we luckily
already have UText support for). Once that's done, we should be able to migrate entirely
from LazyLineBreakIterator to TextBreakIterator.

* Source/WTF/WTF.xcodeproj/project.pbxproj:
* Source/WTF/wtf/text/TextBreakIterator.h:
(WTF::TextBreakIterator::setText):
* Source/WTF/wtf/text/cf/TextBreakIteratorCF.h:
(WTF::TextBreakIteratorCF::TextBreakIteratorCF):
(WTF::TextBreakIteratorCF::setText):
(WTF::TextBreakIteratorCF::mapModeToBackingIterator):
* Source/WTF/wtf/text/cf/TextBreakIteratorCFCharacterCluster.h:
(WTF::TextBreakIteratorCFCharacterCluster::TextBreakIteratorCFCharacterCluster):
(WTF::TextBreakIteratorCFCharacterCluster::setText):
(WTF::TextBreakIteratorCFCharacterCluster::preceding const):
(WTF::TextBreakIteratorCFCharacterCluster::following const):
(WTF::TextBreakIteratorCFCharacterCluster::isBoundary const):
* Source/WTF/wtf/text/cf/TextBreakIteratorCFStringTokenizer.h:
(WTF::TextBreakIteratorCFStringTokenizer::TextBreakIteratorCFStringTokenizer):
(WTF::TextBreakIteratorCFStringTokenizer::setText):
(WTF::TextBreakIteratorCFStringTokenizer::preceding const):
(WTF::TextBreakIteratorCFStringTokenizer::following const):
(WTF::TextBreakIteratorCFStringTokenizer::isBoundary const):
* Source/WTF/wtf/text/cocoa/ContextualizedCFString.h: Added.
* Source/WTF/wtf/text/cocoa/ContextualizedCFString.mm: Added.
(WTF::createContextualizedCFString):
* Source/WTF/wtf/text/cocoa/TextBreakIteratorInternalICUCocoa.cpp:
(WTF::TextBreakIterator::mapModeToBackingIterator):
* Source/WTF/wtf/text/icu/TextBreakIteratorICU.h:
(WTF::TextBreakIteratorICU::setText):
* Tools/TestWebKitAPI/Tests/WTF/TextBreakIterator.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WTF/cocoa/ContextualizedNSString.mm:
(TEST):

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




More information about the webkit-changes mailing list