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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241947
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2019-02-22 Rob Buis <rbuis@igalia.com>
+
+ Remove stripLeadingAndTrailingWhitespace from MathMLElement.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=160172
+
+ 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):
+
2019-02-22 Eric Carlson <eric.carlson@apple.com>
Update some media logging
return Element::tabIndex();
}
-StringView MathMLElement::stripLeadingAndTrailingWhitespace(const StringView& stringView)
-{
- unsigned start = 0, stringLength = stringView.length();
- while (stringLength > 0 && isHTMLSpace(stringView[start])) {
- start++;
- stringLength--;
- }
- while (stringLength > 0 && isHTMLSpace(stringView[start + stringLength - 1]))
- stringLength--;
- return stringView.substring(start, stringLength);
-}
-
}
#endif // ENABLE(MATHML)
protected:
MathMLElement(const QualifiedName& tagName, Document&);
- static StringView stripLeadingAndTrailingWhitespace(const StringView&);
-
void parseAttribute(const QualifiedName&, const AtomicString&) override;
bool childShouldCreateRenderer(const Node&) const override;
#include "HTMLMapElement.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
+#include "HTTPParsers.h"
#include "MathMLMathElement.h"
#include "MathMLNames.h"
#include "RenderMathMLBlock.h"
// Instead, we just use isHTMLSpace and toFloat to parse these parts.
// We first skip whitespace from both ends of the string.
- StringView stringView = stripLeadingAndTrailingWhitespace(string);
+ StringView stringView = string;
+ StringView strippedLength = stripLeadingAndTrailingHTTPSpaces(stringView);
- if (stringView.isEmpty())
+ if (strippedLength.isEmpty())
return Length();
// We consider the most typical case: a number followed by an optional unit.
- UChar firstChar = stringView[0];
+ UChar firstChar = strippedLength[0];
if (isASCIIDigit(firstChar) || firstChar == '-' || firstChar == '.')
- return parseNumberAndUnit(stringView);
+ return parseNumberAndUnit(strippedLength);
// Otherwise, we try and parse a named space.
- return parseNamedSpace(stringView);
+ return parseNamedSpace(strippedLength);
}
const MathMLElement::Length& MathMLPresentationElement::cachedMathMLLength(const QualifiedName& name, Optional<Length>& length)
#if ENABLE(MATHML)
+#include "HTTPParsers.h"
#include "MathMLNames.h"
#include "RenderMathMLToken.h"
#include <wtf/IsoMallocInlines.h>
Optional<UChar32> MathMLTokenElement::convertToSingleCodePoint(StringView string)
{
- auto codePoints = stripLeadingAndTrailingWhitespace(string).codePoints();
+ auto codePoints = stripLeadingAndTrailingHTTPSpaces(string).codePoints();
auto iterator = codePoints.begin();
if (iterator == codePoints.end())
return WTF::nullopt;