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

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

Issue 796543003: Stricter parsing for size attribute on HTMLInputElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add some subtests that actually make a difference 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/HTMLInputElement/size-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/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index e5a7d3d102172f7c1d032d28ad67c591dc7fada8..a2423bc75fa03a2ee5aa03d619a2bba17ae572a8 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -726,8 +726,10 @@ void HTMLInputElement::parseAttribute(const QualifiedName& name, const AtomicStr
parseMinLengthAttribute(value);
} else if (name == sizeAttr) {
int oldSize = m_size;
- int valueAsInteger = value.toInt();
- m_size = valueAsInteger > 0 ? valueAsInteger : defaultSize;
+ m_size = defaultSize;
+ int valueAsInteger;
+ if (!value.isEmpty() && parseHTMLInteger(value, valueAsInteger) && valueAsInteger > 0)
+ m_size = valueAsInteger;
if (m_size != oldSize && renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
} else if (name == altAttr)
« no previous file with comments | « LayoutTests/fast/dom/HTMLInputElement/size-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698