<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[205030] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/205030">205030</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-08-26 11:09:01 -0700 (Fri, 26 Aug 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>HTMLAreaElement's coords attributes parsing does not comply with the HTML specification
https://bugs.webkit.org/show_bug.cgi?id=161216
Reviewed by Andreas Kling.
LayoutTests/imported/w3c:
Rebaseline W3C test now that all checks are passing. Chrome is also passing all the checks.
* web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords-expected.txt:
Source/WebCore:
HTMLAreaElement's coords attributes parsing does not comply with the HTML specification:
- https://html.spec.whatwg.org/#attr-area-coords
This patch aligns our parsing of this attribute with the specification and Chrome.
No new tests, rebaselined existing test.
* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::HTMLAreaElement):
(WebCore::HTMLAreaElement::parseAttribute):
(WebCore::HTMLAreaElement::getRegion):
* html/HTMLAreaElement.h:
* html/parser/HTMLParserIdioms.cpp:
(WebCore::isHTMLSpaceOrDelimiter):
(WebCore::isNumberStart):
(WebCore::parseHTMLListOfOfFloatingPointNumberValuesInternal):
(WebCore::parseHTMLListOfOfFloatingPointNumberValues):
(WebCore::parseHTMLNonNegativeInteger): Deleted.
* html/parser/HTMLParserIdioms.h:
LayoutTests:
Unskip web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html
as it is now passing and not longer crashing in debug builds.
* TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontenttheareaelementareacoordsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAreaElementcpp">trunk/Source/WebCore/html/HTMLAreaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLAreaElementh">trunk/Source/WebCore/html/HTMLAreaElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLParserIdiomscpp">trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLParserIdiomsh">trunk/Source/WebCore/html/parser/HTMLParserIdioms.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/LayoutTests/ChangeLog        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2016-08-26 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><ins>+ HTMLAreaElement's coords attributes parsing does not comply with the HTML specification
+ https://bugs.webkit.org/show_bug.cgi?id=161216
+
+ Reviewed by Andreas Kling.
+
+ Unskip web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html
+ as it is now passing and not longer crashing in debug builds.
+
+ * TestExpectations:
+
+2016-08-26 Chris Dumez <cdumez@apple.com>
+
</ins><span class="cx"> Trying to access cross-origin Location properties should throw a SecurityError
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=161248
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/LayoutTests/TestExpectations        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -475,8 +475,6 @@
</span><span class="cx"> # WPT tests that fail after doing full test repository reimport and need further investigation
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/send-entity-body-document.htm [ Pass Failure Timeout ]
</span><span class="cx"> imported/w3c/web-platform-tests/dom/nodes/Document-createElement-namespace.html [ Pass Failure ]
</span><del>-webkit.org/b/155516 [ Debug ] imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html [ Skip ]
-webkit.org/b/155516 [ Release ] imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords.html [ Failure ]
</del><span class="cx">
</span><span class="cx"> # W3C XMLHttpRequest tests
</span><span class="cx"> imported/w3c/web-platform-tests/XMLHttpRequest/xmlhttprequest-timeout-aborted.html [ Slow ]
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-08-26 Chris Dumez <cdumez@apple.com>
+
+ HTMLAreaElement's coords attributes parsing does not comply with the HTML specification
+ https://bugs.webkit.org/show_bug.cgi?id=161216
+
+ Reviewed by Andreas Kling.
+
+ Rebaseline W3C test now that all checks are passing. Chrome is also passing all the checks.
+
+ * web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords-expected.txt:
+
</ins><span class="cx"> 2016-08-25 Johan K. Jensen <johan_jensen@apple.com>
</span><span class="cx">
</span><span class="cx"> Update the Resource Timing implementation
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestshtmlsemanticsembeddedcontenttheareaelementareacoordsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords-expected.txt (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords-expected.txt        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-area-element/area-coords-expected.txt        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -7,9 +7,29 @@
</span><span class="cx"> PASS FORM FEED: "2\f2\f10\f10" (rect)
</span><span class="cx"> PASS LINE FEED: "2\n2\n10\n10" (rect)
</span><span class="cx"> PASS CARRIGAGE RETURN: "2\r2\r10\r10" (rect)
</span><del>-FAIL LINE TABULATION: "2\v2\v10\v10" (rect) assert_equals: elementFromPoint(3, 3) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="rect" coords="221010"></area>
-FAIL LINE NEXT: "2
2
10
10" (rect) assert_equals: elementFromPoint(3, 3) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="rect" coords="2
2
10
10"></area>
-FAIL EN QUAD: "2 2 10 10" (rect) assert_equals: elementFromPoint(3, 3) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="rect" coords="2 2 10 10"></area>
-FAIL abc between numbers: "2a2b20c20,2,10,10" (rect) assert_equals: elementFromPoint(11, 9) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="rect" coords="2a2b20c20,2,10,10"><...
-FAIL COLON between numbers: "2:2:20:20,2,10,10" (rect) assert_equals: elementFromPoint(11, 9) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="rect" coords="2:2:20:20,2,10,10"><...
-FAIL U+0000 between numbers: "2\02\020\020,2,10,10" (rect) assert_equals: elementFromPoint(11, 9) expected Element node <img src="/images/threecolors.png" usemap="#x" id="img" w... but got Element node <area id="area" shape="rect" coords="2
</del><span class="cx">\ No newline at end of file
</span><ins>+PASS LINE TABULATION: "2\v2\v10\v10" (rect)
+PASS LINE NEXT: "2
2
10
10" (rect)
+PASS EN QUAD: "2 2 10 10" (rect)
+PASS abc between numbers: "2a2b20c20,2,10,10" (rect)
+PASS COLON between numbers: "2:2:20:20,2,10,10" (rect)
+PASS U+0000 between numbers: "2\02\020\020,2,10,10" (rect)
+PASS leading COMMA: ",2,2,10,10" (rect)
+PASS leading SPACE: " 2,2,10,10" (rect)
+PASS leading SEMICOLON: ";2,2,10,10" (rect)
+PASS trailing COMMA: "2,2,10," (rect)
+PASS trailing SPACE: "2,2,10 " (rect)
+PASS trailing SEMICOLON: "2,2,10;" (rect)
+PASS PERCENT: "2%,2%,10%,10%" (rect)
+PASS CSS units: "2in,2in,10cm,10cm" (rect)
+PASS float: "1.4,1.4,10,10" (rect)
+PASS number starting with PERIOD: ".4,.4,10,10" (rect)
+PASS sci-not: "2,2,1e1,1e1" (rect)
+PASS leading/trailing garbage: "='2,2,10,10' " (rect)
+PASS non-ascii garbage: "“2,2,10,10\"" (rect)
+PASS URL garbage with number: "2,2,10ls/spain/holidays/regions/10/Canary+Islands/Canary+Islands.html" (rect)
+PASS consecutive COMMAs: "2,,10,10" (rect)
+PASS consecutive SPACEs: "2 10,10" (rect)
+PASS consecutive SEMICOLONs: "2;;10,10" (rect)
+PASS several consecutive separators: ",,2;,;2,;,10 \t\r\n10;;" (rect)
+PASS one too many numbers, trailing COMMA: "100,100,120,100,100,120,300," (poly)
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/Source/WebCore/ChangeLog        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-08-26 Chris Dumez <cdumez@apple.com>
+
+ HTMLAreaElement's coords attributes parsing does not comply with the HTML specification
+ https://bugs.webkit.org/show_bug.cgi?id=161216
+
+ Reviewed by Andreas Kling.
+
+ HTMLAreaElement's coords attributes parsing does not comply with the HTML specification:
+ - https://html.spec.whatwg.org/#attr-area-coords
+
+ This patch aligns our parsing of this attribute with the specification and Chrome.
+
+ No new tests, rebaselined existing test.
+
+ * html/HTMLAreaElement.cpp:
+ (WebCore::HTMLAreaElement::HTMLAreaElement):
+ (WebCore::HTMLAreaElement::parseAttribute):
+ (WebCore::HTMLAreaElement::getRegion):
+ * html/HTMLAreaElement.h:
+ * html/parser/HTMLParserIdioms.cpp:
+ (WebCore::isHTMLSpaceOrDelimiter):
+ (WebCore::isNumberStart):
+ (WebCore::parseHTMLListOfOfFloatingPointNumberValuesInternal):
+ (WebCore::parseHTMLListOfOfFloatingPointNumberValues):
+ (WebCore::parseHTMLNonNegativeInteger): Deleted.
+ * html/parser/HTMLParserIdioms.h:
+
</ins><span class="cx"> 2016-08-26 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix the !ENABLE(WEB_SOCKETS) build
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAreaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAreaElement.cpp (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAreaElement.cpp        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/Source/WebCore/html/HTMLAreaElement.cpp        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "HTMLImageElement.h"
</span><span class="cx"> #include "HTMLMapElement.h"
</span><ins>+#include "HTMLParserIdioms.h"
</ins><span class="cx"> #include "HitTestResult.h"
</span><span class="cx"> #include "Path.h"
</span><span class="cx"> #include "RenderImage.h"
</span><span class="lines">@@ -37,7 +38,6 @@
</span><span class="cx">
</span><span class="cx"> inline HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document& document)
</span><span class="cx"> : HTMLAnchorElement(tagName, document)
</span><del>- , m_coordsLen(0)
</del><span class="cx"> , m_lastSize(-1, -1)
</span><span class="cx"> , m_shape(Unknown)
</span><span class="cx"> {
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> m_shape = Rect;
</span><span class="cx"> invalidateCachedRegion();
</span><span class="cx"> } else if (name == coordsAttr) {
</span><del>- m_coords = newCoordsArray(value.string(), m_coordsLen);
</del><ins>+ m_coords = parseHTMLListOfOfFloatingPointNumberValues(value.string());
</ins><span class="cx"> invalidateCachedRegion();
</span><span class="cx"> } else if (name == altAttr || name == accesskeyAttr) {
</span><span class="cx"> // Do nothing.
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">
</span><span class="cx"> Path HTMLAreaElement::getRegion(const LayoutSize& size) const
</span><span class="cx"> {
</span><del>- if (!m_coords && m_shape != Default)
</del><ins>+ if (m_coords.isEmpty() && m_shape != Default)
</ins><span class="cx"> return Path();
</span><span class="cx">
</span><span class="cx"> LayoutUnit width = size.width();
</span><span class="lines">@@ -138,11 +138,11 @@
</span><span class="cx"> // If element omits the shape attribute, select shape based on number of coordinates.
</span><span class="cx"> Shape shape = m_shape;
</span><span class="cx"> if (shape == Unknown) {
</span><del>- if (m_coordsLen == 3)
</del><ins>+ if (m_coords.size() == 3)
</ins><span class="cx"> shape = Circle;
</span><del>- else if (m_coordsLen == 4)
</del><ins>+ else if (m_coords.size() == 4)
</ins><span class="cx"> shape = Rect;
</span><del>- else if (m_coordsLen >= 6)
</del><ins>+ else if (m_coords.size() >= 6)
</ins><span class="cx"> shape = Poly;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -149,27 +149,26 @@
</span><span class="cx"> Path path;
</span><span class="cx"> switch (shape) {
</span><span class="cx"> case Poly:
</span><del>- if (m_coordsLen >= 6) {
- int numPoints = m_coordsLen / 2;
- path.moveTo(FloatPoint(minimumValueForLength(m_coords[0], width), minimumValueForLength(m_coords[1], height)));
</del><ins>+ if (m_coords.size() >= 6) {
+ int numPoints = m_coords.size() / 2;
+ path.moveTo(FloatPoint(m_coords[0], m_coords[1]));
</ins><span class="cx"> for (int i = 1; i < numPoints; ++i)
</span><del>- path.addLineTo(FloatPoint(minimumValueForLength(m_coords[i * 2], width), minimumValueForLength(m_coords[i * 2 + 1], height)));
</del><ins>+ path.addLineTo(FloatPoint(m_coords[i * 2], m_coords[i * 2 + 1]));
</ins><span class="cx"> path.closeSubpath();
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case Circle:
</span><del>- if (m_coordsLen >= 3) {
- Length radius = m_coords[2];
- int r = std::min(minimumValueForLength(radius, width), minimumValueForLength(radius, height));
- path.addEllipse(FloatRect(minimumValueForLength(m_coords[0], width) - r, minimumValueForLength(m_coords[1], height) - r, 2 * r, 2 * r));
</del><ins>+ if (m_coords.size() >= 3) {
+ double r = m_coords[2];
+ path.addEllipse(FloatRect(m_coords[0] - r, m_coords[1] - r, 2 * r, 2 * r));
</ins><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx"> case Rect:
</span><del>- if (m_coordsLen >= 4) {
- int x0 = minimumValueForLength(m_coords[0], width);
- int y0 = minimumValueForLength(m_coords[1], height);
- int x1 = minimumValueForLength(m_coords[2], width);
- int y1 = minimumValueForLength(m_coords[3], height);
</del><ins>+ if (m_coords.size() >= 4) {
+ double x0 = m_coords[0];
+ double y0 = m_coords[1];
+ double x1 = m_coords[2];
+ double y1 = m_coords[3];
</ins><span class="cx"> path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
</span><span class="cx"> }
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLAreaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLAreaElement.h (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLAreaElement.h        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/Source/WebCore/html/HTMLAreaElement.h        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -65,8 +65,7 @@
</span><span class="cx"> void invalidateCachedRegion();
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<Path> m_region;
</span><del>- std::unique_ptr<Length[]> m_coords;
- int m_coordsLen;
</del><ins>+ Vector<double> m_coords;
</ins><span class="cx"> LayoutSize m_lastSize;
</span><span class="cx"> Shape m_shape;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLParserIdiomscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include <limits>
</span><span class="cx"> #include <wtf/MathExtras.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><ins>+#include <wtf/dtoa.h>
</ins><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -215,6 +216,64 @@
</span><span class="cx"> return signedValue;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template <typename CharacterType>
+static inline bool isHTMLSpaceOrDelimiter(CharacterType character)
+{
+ return isHTMLSpace(character) || character == ',' || character == ';';
+}
+
+template <typename CharacterType>
+static inline bool isNumberStart(CharacterType character)
+{
+ return isASCIIDigit(character) || character == '.' || character == '-';
+}
+
+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-floating-point-number-values
+template <typename CharacterType>
+static Vector<double> parseHTMLListOfOfFloatingPointNumberValuesInternal(const CharacterType* position, const CharacterType* end)
+{
+ Vector<double> numbers;
+
+ // This skips past any leading delimiters.
+ while (position < end && isHTMLSpaceOrDelimiter(*position))
+ ++position;
+
+ while (position < end) {
+ // This skips past leading garbage.
+ while (position < end && !(isHTMLSpaceOrDelimiter(*position) || isNumberStart(*position)))
+ ++position;
+
+ const CharacterType* numberStart = position;
+ while (position < end && !isHTMLSpaceOrDelimiter(*position))
+ ++position;
+
+ size_t parsedLength = 0;
+ double number = parseDouble(numberStart, position - numberStart, parsedLength);
+ numbers.append(parsedLength > 0 && std::isfinite(number) ? number : 0);
+
+ // This skips past the delimiter.
+ while (position < end && isHTMLSpaceOrDelimiter(*position))
+ ++position;
+ }
+
+ return numbers;
+}
+
+Vector<double> parseHTMLListOfOfFloatingPointNumberValues(const String& input)
+{
+ unsigned length = input.length();
+ if (!length)
+ return { };
+
+ if (LIKELY(input.is8Bit())) {
+ auto* start = input.characters8();
+ return parseHTMLListOfOfFloatingPointNumberValuesInternal(start, start + length);
+ }
+
+ auto* start = input.characters16();
+ return parseHTMLListOfOfFloatingPointNumberValuesInternal(start, start + length);
+}
+
</ins><span class="cx"> static bool threadSafeEqual(const StringImpl& a, const StringImpl& b)
</span><span class="cx"> {
</span><span class="cx"> if (&a == &b)
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLParserIdiomsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.h (205029 => 205030)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.h        2016-08-26 18:00:28 UTC (rev 205029)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.h        2016-08-26 18:09:01 UTC (rev 205030)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #include <unicode/uchar.h>
</span><span class="cx"> #include <wtf/Forward.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span><ins>+#include <wtf/Vector.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -66,6 +67,9 @@
</span><span class="cx"> // http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-negative-integers
</span><span class="cx"> WEBCORE_EXPORT Optional<int> parseHTMLNonNegativeInteger(const String&);
</span><span class="cx">
</span><ins>+// https://html.spec.whatwg.org/multipage/infrastructure.html#rules-for-parsing-floating-point-number-values
+Vector<double> parseHTMLListOfOfFloatingPointNumberValues(const String&);
+
</ins><span class="cx"> // https://html.spec.whatwg.org/multipage/infrastructure.html#cors-settings-attribute
</span><span class="cx"> String parseCORSSettingsAttribute(const AtomicString&);
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>