[webkit-changes] [WebKit/WebKit] 79a60c: [text-wrap-style pretty] Refactor cost function an...

2025-02-07 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 79a60c46a38e1755de8489acaa6349acad80f9cb
  
https://github.com/WebKit/WebKit/commit/79a60c46a38e1755de8489acaa6349acad80f9cb
  Author: Yulun Wu 
  Date:   2025-02-07 (Fri, 07 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp

  Log Message:
  ---
  [text-wrap-style pretty] Refactor cost function and entry data struct.
https://bugs.webkit.org/show_bug.cgi?id=287177


Reviewed by Alan Baradlay.

This is a cleanup/refactor PR that does a couple things:

1) Refactors out the float adjusting text-wrap-style:pretty target line length.
This makes it easier to find and adjust this float in the future.

2) Refactors out `entry` struct into `entryBalance` and `entryPretty` for 
clarity.
This removes duplicate code shared between balanceRangeWithLineRequirement and
balanceRangeWithoutLineRequirement, as well as clarifies that prettifyRange a
different struct. Note that entryPretty:endsWithHyphen is currently not used. 
This
will be fixed in a follow up PR.

3) Refactors out cost computation for pretty, balance, and raggedness.
This clarifies the scoring use for text-wrap-style:balance and 
text-wrap-style:pretty,
making it easier for future authors to understand what heuristics are being used
for different text-wrap-styles and how the differ. Additionally, this also 
clarifies
the use of the raggedness metric which is used by both text-wrap-mode:balance 
as well
as the first line for text-wrap-mode:pretty.

Finally, this PR adds FIXMEs for computeCostPretty, clarifying opportunities 
for future work.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 4fe5fe: [text-wrap balance] InlineContentConstrainer shoul...

2025-02-06 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4fe5fedb57aa0b2e73ceff68013355504e739e25
  
https://github.com/WebKit/WebKit/commit/4fe5fedb57aa0b2e73ceff68013355504e739e25
  Author: Yulun Wu 
  Date:   2025-02-06 (Thu, 06 Feb 2025)

  Changed paths:
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-balance-with-svg-expected.html
A LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-balance-with-svg.html
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap balance] InlineContentConstrainer should populate inline item 
width cache after performing line layouts.
https://bugs.webkit.org/show_bug.cgi?id=284665


Reviewed by Alan Baradlay.

InlineContentConstrainer is caching inline item widths before performing a line 
layout.
This is incorrect as the the width of inline items like as SVGs are not set 
until a
line layout has been performed.

This PR updates the InlineContentConstrainer to cache inline item widths 
exactly once
after performing all line layouts and to calculate item widths explicitly 
beforehand.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] d2d435: [Cleanup] Stylistic changes to inline layout.

2025-01-21 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d2d43541a0ab476ef7f08b3e310a5b3b2aaec6bf
  
https://github.com/WebKit/WebKit/commit/d2d43541a0ab476ef7f08b3e310a5b3b2aaec6bf
  Author: Yulun Wu 
  Date:   2025-01-21 (Tue, 21 Jan 2025)

  Changed paths:
M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
M Source/WebCore/rendering/RenderBlock.cpp

  Log Message:
  ---
  [Cleanup] Stylistic changes to inline layout.
https://bugs.webkit.org/show_bug.cgi?id=285861


Reviewed by Tim Nguyen.

Fix misaligned indentation and removal of unneeded braces.

* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::handleTextContent):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 43470d: [Cleanup] Remove RenderStyle::whiteSpace().

2025-01-23 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 43470dbb41a950390f2d0a7cddcc038c83bf3652
  
https://github.com/WebKit/WebKit/commit/43470dbb41a950390f2d0a7cddcc038c83bf3652
  Author: Yulun Wu 
  Date:   2025-01-23 (Thu, 23 Jan 2025)

  Changed paths:
M Source/WebCore/editing/cocoa/HTMLConverter.mm
M Source/WebCore/rendering/line/LineInlineHeaders.h
M Source/WebCore/rendering/style/RenderStyle.cpp
M Source/WebCore/rendering/style/RenderStyle.h
M Source/WebCore/rendering/style/RenderStyleInlines.h

  Log Message:
  ---
  [Cleanup] Remove RenderStyle::whiteSpace().
https://bugs.webkit.org/show_bug.cgi?id=286084


Reviewed by Alan Baradlay.

The whiteSpace() shorthand does not represent all combinations of the
longhands textWrapMode() and whiteSpaceCollapse(). whiteSpace() handles
unsupported cases by misclassifying them as WhiteSpace::Normal.

This misclassification and has caused undefinied behavior in the past:

rdar://141021052

This PR removes usage of whiteSpace() in WebCore and
replaces calls to WhiteSpace() with the corresponding
longhand textWrapMode() and whiteSpaceCollapse.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] ef1fc3: [Text Wrapping] Add performance tests for text-wra...

2025-01-23 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ef1fc35073c4a8b898c5ff7eeeb03e46426d2eae
  
https://github.com/WebKit/WebKit/commit/ef1fc35073c4a8b898c5ff7eeeb03e46426d2eae
  Author: Yulun Wu 
  Date:   2025-01-23 (Thu, 23 Jan 2025)

  Changed paths:
A PerformanceTests/Layout/TextWrap/text-wrap-style-auto.html
A PerformanceTests/Layout/TextWrap/text-wrap-style-balance.html

  Log Message:
  ---
  [Text Wrapping] Add performance tests for text-wrap-style auto/balance.
https://bugs.webkit.org/show_bug.cgi?id=286171


Reviewed by Alan Baradlay.

This change adds performance tests for text-wrap-style and will allow
developers to measure relative performance between text-wrap-styles
as well as performance implications of future development.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 1fc3d9: [IFC] Update TextBreakingPositionCache to use Whit...

2025-01-20 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fc3d9918294db0be3dda280ef838328b0e59c0b
  
https://github.com/WebKit/WebKit/commit/1fc3d9918294db0be3dda280ef838328b0e59c0b
  Author: Yulun Wu 
  Date:   2025-01-20 (Mon, 20 Jan 2025)

  Changed paths:
A LayoutTests/fast/text/whitespace/whitespace-trailing-trim-expected.txt
A LayoutTests/fast/text/whitespace/whitespace-trailing-trim.html
M 
Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionCache.cpp
M 
Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionContext.h

  Log Message:
  ---
  [IFC] Update TextBreakingPositionCache to use WhiteSpaceCollapse.
https://bugs.webkit.org/show_bug.cgi?id=285551


Reviewed by Alan Baradlay.

This change fixes a bug where TextBreakingPositionContext was tracking validity 
of
text breaking positions by checking whether RenderStyle::WhiteSpace changed 
between
the calculation and fetching cached breaking points. This causes issues where 
setting
TextWrapMode implicitly changes how white space collapses but RenderText's
RenderStyle is not correctly updated, causing TextBreakingPositionCache to
use stale breaking positions.

This is because there are combinations of textWrapMode() and 
whiteSpaceCollapse()
that are not supported by the whiteSpace() shorthand, causing combinations that
cannot be represented by the whiteSpace() syntax to be incorrectly classified as
WhiteSpace::Normal. Changing layout contexts between unsupported combinations
causes incorrect usage of cached layouts.

The correct way to avoid this is to hash on the longhand 
RenderStyle::WhiteSpaceCollapse.

https://github.com/WebKit/WebKit/blob/e41eca63e27004fb0b1e0a5a3e90e00b134a6d7f/Source/WebCore/rendering/style/RenderStyle.cpp#L2850-L2872

A follow up CL will be sent out to remove RenderStyle()::whiteSpace() from 
WebCore.

This PR also adds WhiteSpaceCollapseBehavior that groups WhiteSpaceCollapse
types that have the same text breaking positions. This lets us avoid
recalculating breaking points when switching between these
WhiteSpaceCollapse types that would have identical breaking points.

https://drafts.csswg.org/css-text-4/#white-space-collapsing

https://commits.webkit.org/265267@main
https://commits.webkit.org/269613@main

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 7be115: [clang-format]Update clang formatting settings to ...

2025-01-21 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7be11510d4004a90aece72a0d423b4700ed570de
  
https://github.com/WebKit/WebKit/commit/7be11510d4004a90aece72a0d423b4700ed570de
  Author: Yulun Wu 
  Date:   2025-01-21 (Tue, 21 Jan 2025)

  Changed paths:
M .clang-format

  Log Message:
  ---
  [clang-format]Update clang formatting settings to insert space into { }.
https://bugs.webkit.org/show_bug.cgi?id=286304


Reviewed by Yusuke Suzuki and Darin Adler.

Per the style guide, empty braces should contain a space:

https://www.webkit.org/code-style-guidelines/

However, `webkit-patch format` collapses the whitespace between curly braces.

We should add the parameter

`SpaceInEmptyBlock : true`

to insert whitespace into empty curly braces.

Documentation:

https://clang.llvm.org/docs/ClangFormatStyleOptions.html

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] f8cc0a: [text-wrap-mode] update raggedness function to ind...

2025-02-12 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f8cc0a3f00cb0e2da5ff71b7da5c00f6328133f0
  
https://github.com/WebKit/WebKit/commit/f8cc0a3f00cb0e2da5ff71b7da5c00f6328133f0
  Author: Yulun Wu 
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp

  Log Message:
  ---
  [text-wrap-mode] update raggedness function to independently weight 
stretch/shrink.
https://bugs.webkit.org/show_bug.cgi?id=287489


Reviewed by Alan Baradlay.

The current implementation for raggedness uses the square of the difference 
between
the ideal and candidate line width. Knuth-Plass offers a more sophisticated 
raggedness
metric that allows for separate weights for text that is too long or too short
(stretchability vs shrinkability), and is an easy change that will give us more 
control
over how text is laid out relative to our ideal width. This CL lands the full 
implementation
in:

http://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf

Additionally, textWrapPrettyStretchability and textWrapPrettyShrinkability are 
needed
for the hyphenation algorithm definded in the paper which will be landed in a 
follow
up PR.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 363bba: [Text Wrapping] Add performance tests for text-wra...

2025-02-12 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 363bbaad3a38dfadd5f51fb00c4793ef30129f67
  
https://github.com/WebKit/WebKit/commit/363bbaad3a38dfadd5f51fb00c4793ef30129f67
  Author: Yulun Wu 
  Date:   2025-02-12 (Wed, 12 Feb 2025)

  Changed paths:
M PerformanceTests/Layout/TextWrap/text-wrap-style-auto.html
M PerformanceTests/Layout/TextWrap/text-wrap-style-balance.html
A PerformanceTests/Layout/TextWrap/text-wrap-style-pretty.html

  Log Message:
  ---
  [Text Wrapping] Add performance tests for text-wrap-style:pretty.
https://bugs.webkit.org/show_bug.cgi?id=286171


Reviewed by Alan Baradlay.

This change adds performance tests for text-wrap-style:pretty and will allow
developers to measure relative performance between text-wrap-styles
as well as performance implications of future development.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] bbce6e: [text-wrap-style:pretty] lazy hyphenation support.

2025-02-20 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bbce6e1c2c581add31f4c3db328cc7f06d5e9fd8
  
https://github.com/WebKit/WebKit/commit/bbce6e1c2c581add31f4c3db328cc7f06d5e9fd8
  Author: Yulun Wu 
  Date:   2025-02-20 (Thu, 20 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap-style:pretty] lazy hyphenation support.
https://bugs.webkit.org/show_bug.cgi?id=287903


Reviewed by Alan Baradlay.

This PR adds basic hyphenation support to text-wrap-style:pretty.

our implementation of prettifyRange() uses dynamic programming as described in:

https://www.eprg.org/G53DOC/pdfs/knuth-plass-breaking.pdf

to layout text such that words are not hyphenated and each line is as close to 
its
idealLineWidth as possible, with a maximum positive deviation of:

textWrapPrettyStretchability * textWrapPrettyMaxShrink

and a maximum negative deviation of

textWrapPrettyShrinkability * textWrapPrettyMaxStretch

However, there are certain cases where it is impossible to layout text according
to these hard limits without hyphenation. This PR add the stripped down lazy
hyphenation approach described in the paper to text-wrap-style:pretty.

This approach tries to lay out as many lines as possible using Knuth-Plass DP
until we are no longer able to find a valid (line length within our min-max 
range)
breaking point without hyphenation. We then perform a one line layout using 
greedy
wrapping to fit the idealLineWidth using:

InlineContentConstrainer::buildOneLineLayout()

We then layout the rest of the text using the Knuth-Plass algorithm while 
performing
single-line greedy layouts as needed.

Note that this PR does not currently handle EntryPretty.lineEnd.offset, which 
will be
added in a follow up PR.

* Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp:
(WebCore::Layout::buildPreviousLine):
(WebCore::Layout::InlineContentConstrainer::buildOneLineLayout):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 736258: Grant committer status to Yulun Wu.

2025-02-20 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 736258e70066b86bcd4179a6adde911c5d020a0a
  
https://github.com/WebKit/WebKit/commit/736258e70066b86bcd4179a6adde911c5d020a0a
  Author: Yulun Wu 
  Date:   2025-02-20 (Thu, 20 Feb 2025)

  Changed paths:
M metadata/contributors.json

  Log Message:
  ---
  Grant committer status to Yulun Wu.
https://bugs.webkit.org/show_bug.cgi?id=288064


Reviewed by Alan Baradlay.

Grant committer status to myself after receiving approval.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 9c3efc: [text-wrap-style:pretty] Add feature flag for pretty.

2025-02-26 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9c3efca2ca14b0fcb75f9c8da2236fe894be7805
  
https://github.com/WebKit/WebKit/commit/9c3efca2ca14b0fcb75f9c8da2236fe894be7805
  Author: Yulun Wu 
  Date:   2025-02-26 (Wed, 26 Feb 2025)

  Changed paths:
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/css/CSSProperties.json
M Source/WebCore/css/parser/CSSParserContext.cpp
M Source/WebCore/css/parser/CSSParserContext.h
M Source/WebCore/css/parser/CSSPropertyParser.cpp

  Log Message:
  ---
  [text-wrap-style:pretty] Add feature flag for pretty.
https://bugs.webkit.org/show_bug.cgi?id=288649


Reviewed by Tim Nguyen.

This is a partial revert of https://commits.webkit.org/291092@main

We want to keep the CSSTextWrapPrettyEnabled flag so we can easily
disable text-wrap-style:pretty if needed, but still want to turn it
on by default.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] e8b5a9: [text-wrap-style:pretty] update params to avoid ex...

2025-02-25 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e8b5a96a502af832d998c10ba8a4043acd970a73
  
https://github.com/WebKit/WebKit/commit/e8b5a96a502af832d998c10ba8a4043acd970a73
  Author: Yulun Wu 
  Date:   2025-02-25 (Tue, 25 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp

  Log Message:
  ---
  [text-wrap-style:pretty] update params to avoid excessive hyphenation.
https://bugs.webkit.org/show_bug.cgi?id=288433


Reviewed by Alan Baradlay.

This PR allows for more flexibility in sizing to help pretty avoid excessive
hyphenation. Increasing the max stretch/shrink to increase acceptable range
while maintaining a strong preference for keeping line widths within:

+textWrapPrettyStretchability / -textWrapPrettyShrinkability

Note that the current implementation has the same tolerances for shrinking
and stretching regardless of line width. Future work may adjust these
tolerances dynamically based on factors such as line width, inline item
widths, and font size.

This PR also tunes the orphan avoidance heuristic to be slightly
more aggressive.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] c8726b: [text-wrap-style] Enable text-wrap-style:pretty by...

2025-02-25 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c8726ba2e942a0af74a502d7a1822300ad162516
  
https://github.com/WebKit/WebKit/commit/c8726ba2e942a0af74a502d7a1822300ad162516
  Author: Yulun Wu 
  Date:   2025-02-25 (Tue, 25 Feb 2025)

  Changed paths:
R LayoutTests/fast/css/text-wrap-pretty-disabled-expected.txt
R LayoutTests/fast/css/text-wrap-pretty-disabled.html
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WebCore/css/CSSProperties.json
M Source/WebCore/css/parser/CSSParserContext.cpp
M Source/WebCore/css/parser/CSSParserContext.h
M Source/WebCore/css/parser/CSSPropertyParser.cpp

  Log Message:
  ---
  [text-wrap-style] Enable text-wrap-style:pretty by default
https://bugs.webkit.org/show_bug.cgi?id=288497


Reviewed by Alan Baradlay.

This PR enables text-wrap-style pretty by default.

Note that text-wrap-style avoid-orphans is not currently implemented.

Additionally, more features work/fine tuning to text-wrap-style pretty
may be landed in the future.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 5e3a00: [text-wrap-style:pretty] improve orphan avoidance ...

2025-02-25 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5e3a00ec453fb5bdcf2db0e4ddb3ae0d9e6eee43
  
https://github.com/WebKit/WebKit/commit/5e3a00ec453fb5bdcf2db0e4ddb3ae0d9e6eee43
  Author: Yulun Wu 
  Date:   2025-02-25 (Tue, 25 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap-style:pretty] improve orphan avoidance heuristic.
https://bugs.webkit.org/show_bug.cgi?id=288236


Reviewed by Alan Baradlay.

This PR improves the orphan avoidance heuristic for text-wrap-style:pretty by
targeting a minimum of 2 inline items for the last line. This is done by 
updating
computeCostPretty to automatically accept breaking points that would create an
acceptable last line without causing excessive line shrinkage. In addition, 
this PR
also updates layoutSingleLineForPretty() support orphan avoidance by shortening 
the
layout range by lastLinePreferredInlineItemCount to prevent it from creating
orphan lines.

This PR also sets a minimum idealLineWidth for prettifyRange() which is based
on the size of the longest inline item to be prettified. When this minimum is
not met, we fall back to using greedy text wrapping.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] dbe441: [text-wrap-style] Add faster algorithm for pretty.

2025-02-18 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: dbe441a76e45df563e5756de4721114bca3a4920
  
https://github.com/WebKit/WebKit/commit/dbe441a76e45df563e5756de4721114bca3a4920
  Author: Yulun Wu 
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap-style] Add faster algorithm for pretty.
https://bugs.webkit.org/show_bug.cgi?id=287596


Reviewed by Alan Baradlay.

[text-wrap-style:pretty] is expected to be more performant than
text-wrap-style:balance as it is intended for use on larger blocks
of text.

However, the current implementation is overly complex and
significantly slower. We should update text-wrap-style:pretty to
be more performant by removing multi solution tracking, as well
as adding minimum/maximum line width heuristics per Knuth-Plass.
This simultaneously reduces search space as well as acts as a
trigger for hyphenation.

Hyphenation support will be landed in a follow up PR.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 26548f: [text-wrap-style:pretty] Refactor line width calcu...

2025-02-17 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 26548fe7a849e8be3133d0b9ff2022e992fddb7b
  
https://github.com/WebKit/WebKit/commit/26548fe7a849e8be3133d0b9ff2022e992fddb7b
  Author: Yulun Wu 
  Date:   2025-02-17 (Mon, 17 Feb 2025)

  Changed paths:
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap-style:pretty] Refactor line width calculations.
https://bugs.webkit.org/show_bug.cgi?id=287764


Reviewed by Alan Baradlay.

This PR refactors out the logic for computing line width from sliding width and
updates text-wrap-style:pretty and text-wrap-style:balance to use correct widths
of the inline items when performing cost/raggedness calculations.

This will also remove duplicate code and functionality. This will also enable 
use to
backtrack line widths for text-wrap-style:pretty.

Finally, line width backtracking is necessary to enable hyphenation: these will 
be
landed in a follow up PR.

* Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp:
(WebCore::Layout::InlineContentConstrainer::balanceRangeWithLineRequirement):
(WebCore::Layout::InlineContentConstrainer::balanceRangeWithNoLineRequirement):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 29076a: [text-wrap-style:pretty] Fix edge case where orpha...

2025-03-06 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 29076a47162d0c2dee2f141443ad73c3ae094f46
  
https://github.com/WebKit/WebKit/commit/29076a47162d0c2dee2f141443ad73c3ae094f46
  Author: Yulun Wu 
  Date:   2025-03-06 (Thu, 06 Mar 2025)

  Changed paths:
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-1-expected.html
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-1.html
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp

  Log Message:
  ---
  [text-wrap-style:pretty] Fix edge case where orphan avoidance heuristics 
conflict.
https://bugs.webkit.org/show_bug.cgi?id=289116


Reviewed by Alan Baradlay.

Text-wrap-style:pretty does not correctly prevent orphans in some edge cases.
This is caused by the usage of two separate orphan minimization heuristics
which may interact in undexpected ways.

This PR combines them and simplifies this heuristic to avoid unexpected
edge cases. This PR also fixes an orphan minimization off-by-one error.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 12e2a1: [text-wrap-style:pretty] track index of last valid...

2025-03-01 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 12e2a141d2c28e2c77da13d718d110ca447ab12e
  
https://github.com/WebKit/WebKit/commit/12e2a141d2c28e2c77da13d718d110ca447ab12e
  Author: Yulun Wu 
  Date:   2025-02-28 (Fri, 28 Feb 2025)

  Changed paths:
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-crash-2-expected.txt
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-crash-2.html
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-crash-expected.txt
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-crash.html
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap-style:pretty] track index of last valid state instead of 
breakpoint.
https://bugs.webkit.org/show_bug.cgi?id=288615


Reviewed by Alan Baradlay.

InlineContentConstrainer::prettifyRange() should track the lastValidStateindex
instead of the lastValidBreakpoint. We were writting the EntryPretty from
layoutSingleLineForPretty() to the incorrect place in state[]. This was causing
an index out of bounds exception in the attached test case.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[webkit-changes] [WebKit/WebKit] 155542: [text-wrap-style:pretty] InlineContentConstrainer ...

2025-03-21 Thread Yulun Wu
  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 155542db670e41647d4771f60b65be5898be97a8
  
https://github.com/WebKit/WebKit/commit/155542db670e41647d4771f60b65be5898be97a8
  Author: Yulun Wu 
  Date:   2025-03-21 (Fri, 21 Mar 2025)

  Changed paths:
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-crash-1-expected.txt
A 
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-pretty-line-break-crash-1.html
M 
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
M Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.h

  Log Message:
  ---
  [text-wrap-style:pretty] InlineContentConstrainer should save value of 
HorizontalConstraints.
https://bugs.webkit.org/show_bug.cgi?id=290083
rdar://147213249

Reviewed by Alan Baradlay.

This PR prevents a stack-use-after-scope issue caused by 
constraints.horizontal(), which
returns by value, going out of scope. This causes issues when computing 
paragraph level
constraints which needs to know the horizontal constraints.

This PR acomplishes this by updating the constructor to copy by value instead 
of using a
const ref.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
___
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes