Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 801e9b5ab020287e8be5a18cf5a332c551dce9c5
      
https://github.com/WebKit/WebKit/commit/801e9b5ab020287e8be5a18cf5a332c551dce9c5
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M Source/WebCore/mathml/MathMLOperatorElement.cpp
    M Source/WebCore/mathml/MathMLOperatorElement.h

  Log Message:
  -----------
  MathMLOperatorElement::parseOperatorChar() needlessly allocates a String when 
trimming whitespace
https://bugs.webkit.org/show_bug.cgi?id=320707
rdar://183692683

Reviewed by Chris Dumez and Frédéric Wang Nélar.

String::trim() allocates a new StringImpl whenever there is actually something
to trim, so the common `<mo> + </mo>` allocated on every parse. The function
only needs isEmpty(), length(), two indexed code units and
convertToSingleCodePoint(), so take a StringView and use StringView::trim(),
which returns a view over the existing buffer.

No change in behavior.

* Source/WebCore/mathml/MathMLOperatorElement.cpp:
(WebCore::MathMLOperatorElement::parseOperatorChar):
* Source/WebCore/mathml/MathMLOperatorElement.h:

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



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

Reply via email to