Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: third_party/WebKit/Source/platform/Length.cpp

Issue 1636333003: Implement specced parsing algorithm for <area coords> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/Length.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/Length.cpp
diff --git a/third_party/WebKit/Source/platform/Length.cpp b/third_party/WebKit/Source/platform/Length.cpp
index b9d8b029c77e830a4f6d825e6080341091b5e350..05efe30447444380b6a084e4a34e4028637e391d 100644
--- a/third_party/WebKit/Source/platform/Length.cpp
+++ b/third_party/WebKit/Source/platform/Length.cpp
@@ -26,85 +26,11 @@
#include "platform/CalculationValue.h"
#include "platform/animation/AnimationUtilities.h"
-#include "wtf/ASCIICType.h"
-#include "wtf/text/StringBuffer.h"
-#include "wtf/text/WTFString.h"
using namespace WTF;
namespace blink {
-template<typename CharType>
-static unsigned splitLength(const CharType* data, unsigned length, unsigned& intLength, unsigned& doubleLength)
-{
- ASSERT(length);
-
- unsigned i = 0;
- while (i < length && isSpaceOrNewline(data[i]))
- ++i;
- if (i < length && (data[i] == '+' || data[i] == '-'))
- ++i;
- while (i < length && isASCIIDigit(data[i]))
- ++i;
- intLength = i;
- while (i < length && (isASCIIDigit(data[i]) || data[i] == '.'))
- ++i;
- doubleLength = i;
-
- // IE quirk: Skip whitespace between the number and the % character (20 % => 20%).
- while (i < length && isSpaceOrNewline(data[i]))
- ++i;
-
- return i;
-}
-
-template<typename CharType>
-static Length parseHTMLAreaCoordinate(const CharType* data, unsigned length)
-{
- unsigned intLength;
- unsigned doubleLength;
- splitLength(data, length, intLength, doubleLength);
-
- return Length(charactersToIntStrict(data, intLength), Fixed);
-}
-
-// FIXME: Per HTML5, this should follow the "rules for parsing a list of integers".
-Vector<Length> parseHTMLAreaElementCoords(const String& string)
-{
- unsigned length = string.length();
- StringBuffer<LChar> spacified(length);
- for (unsigned i = 0; i < length; i++) {
- UChar cc = string[i];
- if (cc > '9' || (cc < '0' && cc != '-' && cc != '.'))
- spacified[i] = ' ';
- else
- spacified[i] = cc;
- }
- RefPtr<StringImpl> str = spacified.release();
- str = str->simplifyWhiteSpace();
- ASSERT(str->is8Bit());
-
- if (!str->length())
- return Vector<Length>();
-
- unsigned len = str->count(' ') + 1;
- Vector<Length> r(len);
-
- unsigned i = 0;
- unsigned pos = 0;
- size_t pos2;
-
- while ((pos2 = str->find(' ', pos)) != kNotFound) {
- r[i++] = parseHTMLAreaCoordinate(str->characters8() + pos, pos2 - pos);
- pos = pos2 + 1;
- }
- r[i] = parseHTMLAreaCoordinate(str->characters8() + pos, str->length() - pos);
-
- ASSERT(i == len - 1);
-
- return r;
-}
-
class CalculationValueHandleMap {
USING_FAST_MALLOC(CalculationValueHandleMap);
WTF_MAKE_NONCOPYABLE(CalculationValueHandleMap);
« no previous file with comments | « third_party/WebKit/Source/platform/Length.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698