[webkit-changes] [WebKit/WebKit] 0c0e78: [Simple text codepath] Shadow TextRun's direction ...

Myles C. Maxfield noreply at github.com
Sat Sep 2 03:30:19 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0c0e78b43702e1cc5c8d020f90bfcb200182c94b
      https://github.com/WebKit/WebKit/commit/0c0e78b43702e1cc5c8d020f90bfcb200182c94b
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-09-02 (Sat, 02 Sep 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/WidthIterator.cpp
    M Source/WebCore/platform/graphics/WidthIterator.h

  Log Message:
  -----------
  [Simple text codepath] Shadow TextRun's direction within WidthIterator so we can make local changes to it
https://bugs.webkit.org/show_bug.cgi?id=261058
rdar://114857993

Reviewed by Cameron McCormack.

This patch is in preparation for a future patch, where WidthIterator
is going to need to operate on LTR runs and RTL runs at the same time.
For example, when we do line breaking, we haven't done bidi yet (which
is wrong, but that's a whole nother story), which means there are some
circumstances where we have to measure text of different
directionalities before those directionalities can be passed in to
WidthIterator as arguments.

As a temporary fix, WidthIterator can do its own directionality
discovery, similar to how the complex path does right now. This
wouldn't be a long-term fix (the long term fix is to do shaping before
we measure anything), but allowing WidthIterator to have its own
copy of the direction information makes it easy to iterate on
temporary short-term solutions.

There's no memory use concern, because there's only ever a single
WidthIterator alive at a time.

* Source/WebCore/platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::WidthIterator):
(WebCore::WidthIterator::applyFontTransforms):
(WebCore::WidthIterator::applyInitialAdvance):
(WebCore::WidthIterator::advanceInternal):
(WebCore::WidthIterator::calculateAdditionalWidth const):
(WebCore::WidthIterator::applyAdditionalWidth):
(WebCore::WidthIterator::applyExtraSpacingAfterShaping):
(WebCore::WidthIterator::finalize):
* Source/WebCore/platform/graphics/WidthIterator.h:
(WebCore::WidthIterator::direction const):
(WebCore::WidthIterator::rtl const):
(WebCore::WidthIterator::ltr const):

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




More information about the webkit-changes mailing list