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

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

Issue 795173003: Stricter parsing for rows/cols attribute on textarea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 6 years 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/HTMLTextAreaElement/rows-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/HTMLTextAreaElement.cpp
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index 70253fe6a509db4119083d15c49e2b217437c973..11a9f459da0721408112475e6629c678edf57f81 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -156,8 +156,8 @@ void HTMLTextAreaElement::collectStyleForPresentationAttribute(const QualifiedNa
void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == rowsAttr) {
- int rows = value.toInt();
- if (rows <= 0)
+ int rows = 0;
+ if (value.isEmpty() || !parseHTMLInteger(value, rows) || rows <= 0)
rows = defaultRows;
if (m_rows != rows) {
m_rows = rows;
@@ -165,8 +165,8 @@ void HTMLTextAreaElement::parseAttribute(const QualifiedName& name, const Atomic
renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
}
} else if (name == colsAttr) {
- int cols = value.toInt();
- if (cols <= 0)
+ int cols = 0;
+ if (value.isEmpty() || !parseHTMLInteger(value, cols) || cols <= 0)
cols = defaultCols;
if (m_cols != cols) {
m_cols = cols;
« no previous file with comments | « LayoutTests/fast/dom/HTMLTextAreaElement/rows-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698