Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7941ccc6aed7f763306c6656d23372061edf0bb4
      
https://github.com/WebKit/WebKit/commit/7941ccc6aed7f763306c6656d23372061edf0bb4
  Author: Ahmad Saleem <[email protected]>
  Date:   2025-12-31 (Wed, 31 Dec 2025)

  Changed paths:
    M Source/WebCore/editing/TextIterator.cpp

  Log Message:
  -----------
  PlainText(): avoid extra buffer allocation for empty ranges
https://bugs.webkit.org/show_bug.cgi?id=264018
rdar://118090616

Reviewed by Chris Dumez.

Merge: 
https://chromium.googlesource.com/chromium/blink/+/0b34a706cb547c672215c108270ffb8d344fb097

The pre-allocation of the StringBuilder is redundant if the range is
empty, hence avoid.

While here, simplify empty string builder testing also.

Check if the TextIterator is at end before allocating the StringBuilder's
initial capacity, avoiding unnecessary 32KB allocation for empty ranges.
Replace bufferLength tracking with builder.isEmpty() check.

* Source/WebCore/editing/TextIterator.cpp:
(WebCore::plainText):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to