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

Unified Diff: Source/core/html/HTMLTableColElement.cpp

Issue 802103006: Stricter parsing for span attribute on col element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add a test Created 5 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 | « LayoutTests/fast/dom/HTMLTableColElement/span-attribute-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTableColElement.cpp
diff --git a/Source/core/html/HTMLTableColElement.cpp b/Source/core/html/HTMLTableColElement.cpp
index 5bc7e99f5658710d3cfaf41fac1e6107984ec6b5..ee776b39799f10a871fb9db53d66a3be809697af 100644
--- a/Source/core/html/HTMLTableColElement.cpp
+++ b/Source/core/html/HTMLTableColElement.cpp
@@ -28,6 +28,7 @@
#include "core/CSSPropertyNames.h"
#include "core/HTMLNames.h"
#include "core/html/HTMLTableElement.h"
+#include "core/html/parser/HTMLParserIdioms.h"
#include "core/rendering/RenderTableCol.h"
namespace blink {
@@ -60,10 +61,13 @@ void HTMLTableColElement::collectStyleForPresentationAttribute(const QualifiedNa
void HTMLTableColElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == spanAttr) {
- int newSpan = value.toInt();
- // If the value of span is not a valid non-negative integer greater than zero,
- // set it to 1.
- m_span = newSpan ? newSpan : 1;
+ int newSpan = 0;
+ if (value.isEmpty() || !parseHTMLInteger(value, newSpan) || newSpan < 1) {
+ // If the value of span is not a valid non-negative integer greater than zero,
+ // set it to 1.
+ newSpan = 1;
+ }
+ m_span = newSpan;
if (renderer() && renderer()->isRenderTableCol())
renderer()->updateFromElement();
} else if (name == widthAttr) {
« no previous file with comments | « LayoutTests/fast/dom/HTMLTableColElement/span-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698