summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordongie.agnir <dongie.agnir@gmail.com>2015-10-09 00:19:28 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-09 07:20:41 +0000
commit76c2c840e69862cc462c16b7909d612fcadbd6c5 (patch)
treed6b374c368791c4e392d742e6b6f5ffa2563e9e0
parent29b714103cae29c0f1f17d49cdababb1a68b3df3 (diff)
downloadchromium_src-76c2c840e69862cc462c16b7909d612fcadbd6c5.zip
chromium_src-76c2c840e69862cc462c16b7909d612fcadbd6c5.tar.gz
chromium_src-76c2c840e69862cc462c16b7909d612fcadbd6c5.tar.bz2
input[type=color]: Update view if value attr set and dirty flag is false.
The value attribute serves as the default value of the input element if its dirty flag is false. If the flag is false, the view should be updated when the attribute is changed. BUG=522815 Review URL: https://codereview.chromium.org/1397693002 Cr-Commit-Position: refs/heads/master@{#353245}
-rw-r--r--AUTHORS1
-rw-r--r--third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update-expected.html1
-rw-r--r--third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update.html6
-rw-r--r--third_party/WebKit/Source/core/html/forms/ColorInputType.cpp6
-rw-r--r--third_party/WebKit/Source/core/html/forms/ColorInputType.h1
5 files changed, 15 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 4615d33..6585142 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -148,6 +148,7 @@ Divya Bansal <divya.bansal@samsung.com>
Dominic Jodoin <dominic.jodoin@gmail.com>
Dominik Röttsches <dominik.rottsches@intel.com>
Don Woodward <woodward@adobe.com>
+Dongie Agnir <dongie.agnir@gmail.com>
Dongjun Kim <djmix.kim@samsung.com>
Dongseong Hwang <dongseong.hwang@intel.com>
Dongwoo Joshua Im <dw.im@samsung.com>
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update-expected.html b/third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update-expected.html
new file mode 100644
index 0000000..e23db2f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update-expected.html
@@ -0,0 +1 @@
+<input type="color" value="#ff0000">
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update.html b/third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update.html
new file mode 100644
index 0000000..29484f1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/forms/color/color-update-view-by-default-value-update.html
@@ -0,0 +1,6 @@
+<input type="color" value="#000000">
+<script>
+var input = document.querySelector('input');
+input.offsetTop;
+input.setAttribute('value', '#ff0000');
+</script>
diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
index 66a1736..1d4876d 100644
--- a/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.cpp
@@ -195,6 +195,12 @@ void ColorInputType::warnIfValueIsInvalid(const String& value) const
}
}
+void ColorInputType::valueAttributeChanged()
+{
+ if (!element().hasDirtyValue())
+ element().updateView();
+}
+
void ColorInputType::didChooseColor(const Color& color)
{
if (element().isDisabledFormControl() || color == valueAsColor())
diff --git a/third_party/WebKit/Source/core/html/forms/ColorInputType.h b/third_party/WebKit/Source/core/html/forms/ColorInputType.h
index 995e7b9..c4f81a5 100644
--- a/third_party/WebKit/Source/core/html/forms/ColorInputType.h
+++ b/third_party/WebKit/Source/core/html/forms/ColorInputType.h
@@ -57,6 +57,7 @@ public:
private:
ColorInputType(HTMLInputElement& element) : BaseClickableWithKeyInputType(element) { }
+ void valueAttributeChanged() override;
void countUsage() override;
const AtomicString& formControlType() const override;
bool supportsRequired() const override;