Changeset 241947 in webkit


Ignore:
Timestamp:
Feb 22, 2019 8:31:17 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
https://bugs.webkit.org/show_bug.cgi?id=160172

Patch by Rob Buis <rbuis@igalia.com> on 2019-02-22
Reviewed by Frédéric Wang.

Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
from HTTPParsers instead.

No new tests, already covered by MathML tests.

  • mathml/MathMLElement.cpp:

(WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.

  • mathml/MathMLElement.h:
  • mathml/MathMLPresentationElement.cpp:

(WebCore::MathMLPresentationElement::parseMathMLLength):

  • mathml/MathMLTokenElement.cpp:

(WebCore::MathMLTokenElement::convertToSingleCodePoint):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r241945 r241947  
     12019-02-22  Rob Buis  <rbuis@igalia.com>
     2
     3        Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=160172
     5
     6        Reviewed by Frédéric Wang.
     7
     8        Remove stripLeadingAndTrailingWhitespace and use stripLeadingAndTrailingHTTPSpaces
     9        from HTTPParsers instead.
     10
     11        No new tests, already covered by MathML tests.
     12
     13        * mathml/MathMLElement.cpp:
     14        (WebCore::MathMLElement::stripLeadingAndTrailingWhitespace): Deleted.
     15        * mathml/MathMLElement.h:
     16        * mathml/MathMLPresentationElement.cpp:
     17        (WebCore::MathMLPresentationElement::parseMathMLLength):
     18        * mathml/MathMLTokenElement.cpp:
     19        (WebCore::MathMLTokenElement::convertToSingleCodePoint):
     20
    1212019-02-22  Eric Carlson  <eric.carlson@apple.com>
    222
  • trunk/Source/WebCore/mathml/MathMLElement.cpp

    r241942 r241947  
    220220}
    221221
    222 StringView MathMLElement::stripLeadingAndTrailingWhitespace(const StringView& stringView)
    223 {
    224     unsigned start = 0, stringLength = stringView.length();
    225     while (stringLength > 0 && isHTMLSpace(stringView[start])) {
    226         start++;
    227         stringLength--;
    228     }
    229     while (stringLength > 0 && isHTMLSpace(stringView[start + stringLength - 1]))
    230         stringLength--;
    231     return stringView.substring(start, stringLength);
    232 }
    233 
    234222}
    235223
  • trunk/Source/WebCore/mathml/MathMLElement.h

    r239427 r241947  
    9494    MathMLElement(const QualifiedName& tagName, Document&);
    9595
    96     static StringView stripLeadingAndTrailingWhitespace(const StringView&);
    97 
    9896    void parseAttribute(const QualifiedName&, const AtomicString&) override;
    9997    bool childShouldCreateRenderer(const Node&) const override;
  • trunk/Source/WebCore/mathml/MathMLPresentationElement.cpp

    r239427 r241947  
    3636#include "HTMLNames.h"
    3737#include "HTMLParserIdioms.h"
     38#include "HTTPParsers.h"
    3839#include "MathMLMathElement.h"
    3940#include "MathMLNames.h"
     
    295296
    296297    // We first skip whitespace from both ends of the string.
    297     StringView stringView = stripLeadingAndTrailingWhitespace(string);
    298 
    299     if (stringView.isEmpty())
     298    StringView stringView = string;
     299    StringView strippedLength = stripLeadingAndTrailingHTTPSpaces(stringView);
     300
     301    if (strippedLength.isEmpty())
    300302        return Length();
    301303
    302304    // We consider the most typical case: a number followed by an optional unit.
    303     UChar firstChar = stringView[0];
     305    UChar firstChar = strippedLength[0];
    304306    if (isASCIIDigit(firstChar) || firstChar == '-' || firstChar == '.')
    305         return parseNumberAndUnit(stringView);
     307        return parseNumberAndUnit(strippedLength);
    306308
    307309    // Otherwise, we try and parse a named space.
    308     return parseNamedSpace(stringView);
     310    return parseNamedSpace(strippedLength);
    309311}
    310312
  • trunk/Source/WebCore/mathml/MathMLTokenElement.cpp

    r239427 r241947  
    3131#if ENABLE(MATHML)
    3232
     33#include "HTTPParsers.h"
    3334#include "MathMLNames.h"
    3435#include "RenderMathMLToken.h"
     
    8384Optional<UChar32> MathMLTokenElement::convertToSingleCodePoint(StringView string)
    8485{
    85     auto codePoints = stripLeadingAndTrailingWhitespace(string).codePoints();
     86    auto codePoints = stripLeadingAndTrailingHTTPSpaces(string).codePoints();
    8687    auto iterator = codePoints.begin();
    8788    if (iterator == codePoints.end())
Note: See TracChangeset for help on using the changeset viewer.