Title: [175787] trunk/Source/WebCore
- Revision
- 175787
- Author
- [email protected]
- Date
- 2014-11-08 21:46:59 -0800 (Sat, 08 Nov 2014)
Log Message
Move isEmptyValue() logic from HTMLInputElement to TextFieldInputType
https://bugs.webkit.org/show_bug.cgi?id=138538
Reviewed by Darin Adler.
Move isEmptyValue() logic from HTMLInputElement to TextFieldInputType
as this only makes sense for text field input types.
No new tests, no behavior change.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isEmptyValue):
* html/InputType.cpp:
(WebCore::InputType::isEmptyValue):
* html/InputType.h:
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::isEmptyValue):
* html/TextFieldInputType.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (175786 => 175787)
--- trunk/Source/WebCore/ChangeLog 2014-11-09 03:21:13 UTC (rev 175786)
+++ trunk/Source/WebCore/ChangeLog 2014-11-09 05:46:59 UTC (rev 175787)
@@ -1,3 +1,24 @@
+2014-11-08 Chris Dumez <[email protected]>
+
+ Move isEmptyValue() logic from HTMLInputElement to TextFieldInputType
+ https://bugs.webkit.org/show_bug.cgi?id=138538
+
+ Reviewed by Darin Adler.
+
+ Move isEmptyValue() logic from HTMLInputElement to TextFieldInputType
+ as this only makes sense for text field input types.
+
+ No new tests, no behavior change.
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::isEmptyValue):
+ * html/InputType.cpp:
+ (WebCore::InputType::isEmptyValue):
+ * html/InputType.h:
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::isEmptyValue):
+ * html/TextFieldInputType.h:
+
2014-11-08 Darin Adler <[email protected]>
Replace FileThread class with a single function
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (175786 => 175787)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2014-11-09 03:21:13 UTC (rev 175786)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2014-11-09 05:46:59 UTC (rev 175787)
@@ -62,8 +62,6 @@
#include "SearchInputType.h"
#include "StyleResolver.h"
#include "TextBreakIterator.h"
-#include "TextControlInnerElements.h"
-#include "TextNodeTraversal.h"
#include <wtf/MathExtras.h>
#include <wtf/Ref.h>
@@ -1680,17 +1678,7 @@
bool HTMLInputElement::isEmptyValue() const
{
- if (!isTextField())
- return true;
-
- TextControlInnerTextElement* innerText = innerTextElement();
- ASSERT(innerText);
-
- for (Text* text = TextNodeTraversal::firstWithin(innerText); text; text = TextNodeTraversal::next(text, innerText)) {
- if (text->length())
- return false;
- }
- return true;
+ return m_inputType->isEmptyValue();
}
void HTMLInputElement::parseMaxLengthAttribute(const AtomicString& value)
Modified: trunk/Source/WebCore/html/InputType.cpp (175786 => 175787)
--- trunk/Source/WebCore/html/InputType.cpp 2014-11-09 03:21:13 UTC (rev 175786)
+++ trunk/Source/WebCore/html/InputType.cpp 2014-11-09 05:46:59 UTC (rev 175787)
@@ -717,6 +717,11 @@
return element().value();
}
+bool InputType::isEmptyValue() const
+{
+ return true;
+}
+
String InputType::sanitizeValue(const String& proposedValue) const
{
return proposedValue;
Modified: trunk/Source/WebCore/html/InputType.h (175786 => 175787)
--- trunk/Source/WebCore/html/InputType.h 2014-11-09 03:21:13 UTC (rev 175786)
+++ trunk/Source/WebCore/html/InputType.h 2014-11-09 05:46:59 UTC (rev 175787)
@@ -174,6 +174,7 @@
virtual bool canSetStringValue() const;
virtual String localizeValue(const String&) const;
virtual String visibleValue() const;
+ virtual bool isEmptyValue() const;
// Returing the null string means "use the default value."
// This function must be called only by HTMLInputElement::sanitizeValue().
virtual String sanitizeValue(const String&) const;
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (175786 => 175787)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2014-11-09 03:21:13 UTC (rev 175786)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2014-11-09 05:46:59 UTC (rev 175787)
@@ -51,6 +51,7 @@
#include "TextControlInnerElements.h"
#include "TextEvent.h"
#include "TextIterator.h"
+#include "TextNodeTraversal.h"
#include "WheelEvent.h"
namespace WebCore {
@@ -87,6 +88,18 @@
return true;
}
+bool TextFieldInputType::isEmptyValue() const
+{
+ TextControlInnerTextElement* innerText = innerTextElement();
+ ASSERT(innerText);
+
+ for (Text* text = TextNodeTraversal::firstWithin(innerText); text; text = TextNodeTraversal::next(text, innerText)) {
+ if (text->length())
+ return false;
+ }
+ return true;
+}
+
bool TextFieldInputType::valueMissing(const String& value) const
{
return element().isRequired() && value.isEmpty();
Modified: trunk/Source/WebCore/html/TextFieldInputType.h (175786 => 175787)
--- trunk/Source/WebCore/html/TextFieldInputType.h 2014-11-09 03:21:13 UTC (rev 175786)
+++ trunk/Source/WebCore/html/TextFieldInputType.h 2014-11-09 05:46:59 UTC (rev 175787)
@@ -80,6 +80,7 @@
virtual bool isKeyboardFocusable(KeyboardEvent*) const override final;
virtual bool isMouseFocusable() const override final;
virtual bool isTextField() const override final;
+ virtual bool isEmptyValue() const override final;
virtual bool valueMissing(const String&) const override final;
virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) override final;
virtual void forwardEvent(Event*) override final;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes