[CherryPick] Refactoring: Move the content of HTMLInputElement::subtreeHasChanged...
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2012 00:38:30 +0000 (00:38 +0000)
committerjinwoo jeong <jw00.jeong@samsung.com>
Thu, 28 Mar 2013 03:52:38 +0000 (12:52 +0900)
[Title] Refactoring: Move the content of HTMLInputElement::subtreeHasChanged to TextFieldInputType
[Issues] N_SE-28998
[Problem] Input type number not showing any error message in Jquery mobile single page application
[Solution] Cherry picked.
[Cherry-Picker] Jinwoo Jeong <jw00.jeong@samsung.com>

Refactoring: Move the content of HTMLInputElement::subtreeHasChanged to TextFieldInputType
https://bugs.webkit.org/show_bug.cgi?id=103195

Reviewed by Kentaro Hara.

HTMLInputElement::subtreeHasChanged is called only if the input is
a text field. The code should be moved to TextFieldInputType.

No new tests. This should not change any behavior.

* html/HTMLInputElement.cpp:
- Remove unnecessary NumberInputType.h inclusion.
- Remove convertFromVisibleValue. It was used only by subtreeHasChanged.
(WebCore::HTMLInputElement::subtreeHasChanged):
Move the code to TextFieldInputType::subtreeHasChanged except
calculateAndAdjustDirectionality, which is a protected member of
HTMLElement.
* html/HTMLInputElement.h:
(HTMLInputElement): Remove convertFromVisibleValue.

* html/InputType.cpp:
Move convertFromVisibleValue to TextFieldInputType.
(WebCore::InputType::subtreeHasChanged):
Add ASSERT_NOT_REACHED.
* html/InputType.h:
(InputType): Remove convertFromVisibleValue.

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::convertFromVisibleValue):
Moved from InputType.
(WebCore::TextFieldInputType::subtreeHasChanged):
Moved from HTMLInputElement. A latter part is moved to
didSetValueByUserEdit to be hooked by SearchInputType.
(WebCore::TextFieldInputType::didSetValueByUserEdit):
Moved from HTMLInputElement::subtreeHasChanged, and clean up the code.
* html/TextFieldInputType.h:
(TextFieldInputType):
- Move convertFromVisibleValue from InputType.
- Add didSetValueByUserEdit and subtreeHasChanged.

* html/SearchInputType.cpp:
(WebCore::SearchInputType::didSetValueByUserEdit):
Renamed from subtreeHasChanged, and calls TextFieldInputType::didSetValueByUserEdit.
* html/SearchInputType.h:
(SearchInputType): Rename subtreeHasChanged to didSetValueByUserEdit.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135675 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Conflicts:

Source/WebCore/ChangeLog

Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/html/SearchInputType.cpp
Source/WebCore/html/SearchInputType.h
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/html/TextFieldInputType.h

index 84477bf..d82382c 100644 (file)
@@ -1,4 +1,240 @@
+<<<<<<< HEAD
 2012-11-23  Kent Tamura  <tkent@chromium.org>
+=======
+2012-11-25  Kent Tamura  <tkent@chromium.org>
+
+        Refactoring: Move the content of HTMLInputElement::subtreeHasChanged to TextFieldInputType
+        https://bugs.webkit.org/show_bug.cgi?id=103195
+
+        Reviewed by Kentaro Hara.
+
+        HTMLInputElement::subtreeHasChanged is called only if the input is
+        a text field. The code should be moved to TextFieldInputType.
+
+        No new tests. This should not change any behavior.
+
+        * html/HTMLInputElement.cpp:
+        - Remove unnecessary NumberInputType.h inclusion.
+        - Remove convertFromVisibleValue. It was used only by subtreeHasChanged.
+        (WebCore::HTMLInputElement::subtreeHasChanged):
+        Move the code to TextFieldInputType::subtreeHasChanged except
+        calculateAndAdjustDirectionality, which is a protected member of
+        HTMLElement.
+        * html/HTMLInputElement.h:
+        (HTMLInputElement): Remove convertFromVisibleValue.
+
+        * html/InputType.cpp:
+        Move convertFromVisibleValue to TextFieldInputType.
+        (WebCore::InputType::subtreeHasChanged):
+        Add ASSERT_NOT_REACHED.
+        * html/InputType.h:
+        (InputType): Remove convertFromVisibleValue.
+
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::convertFromVisibleValue):
+        Moved from InputType.
+        (WebCore::TextFieldInputType::subtreeHasChanged):
+        Moved from HTMLInputElement. A latter part is moved to
+        didSetValueByUserEdit to be hooked by SearchInputType.
+        (WebCore::TextFieldInputType::didSetValueByUserEdit):
+        Moved from HTMLInputElement::subtreeHasChanged, and clean up the code.
+        * html/TextFieldInputType.h:
+        (TextFieldInputType):
+        - Move convertFromVisibleValue from InputType.
+        - Add didSetValueByUserEdit and subtreeHasChanged.
+
+        * html/SearchInputType.cpp:
+        (WebCore::SearchInputType::didSetValueByUserEdit):
+        Renamed from subtreeHasChanged, and calls TextFieldInputType::didSetValueByUserEdit.
+        * html/SearchInputType.h:
+        (SearchInputType): Rename subtreeHasChanged to didSetValueByUserEdit.
+
+2012-11-22  Kentaro Hara  <haraken@chromium.org>
+
+        [V8] Move WorkerExecutionContextProxy::initializeIfNeeded() to V8Initializer
+        https://bugs.webkit.org/show_bug.cgi?id=103061
+
+        Reviewed by Adam Barth.
+
+        This is an incremental step to remove WorkerExecutionContextProxy.
+        This patch moves WorkerExecutionContextProxy::initializeIfNeeded() to V8Initializer.
+        This patch also renames methods so that the names become consistent
+        between the main thread and workers.
+
+        No tests. No change in behavior.
+
+        * bindings/v8/V8Initializer.cpp:
+        (WebCore::reportFatalErrorInMainThread):
+        (WebCore::messageHandlerInMainThread):
+        (WebCore::failedAccessCheckCallbackInMainThread):
+        (WebCore::V8Initializer::initializeMainThreadIfNeeded):
+        (WebCore::reportFatalErrorInWorker):
+        (WebCore):
+        (WebCore::messageHandlerInWorker):
+        (WebCore::V8Initializer::initializeWorkerIfNeeded):
+        * bindings/v8/V8Initializer.h:
+        (V8Initializer):
+        * bindings/v8/WorkerContextExecutionProxy.cpp:
+        (WebCore::WorkerContextExecutionProxy::WorkerContextExecutionProxy):
+        * bindings/v8/WorkerContextExecutionProxy.h:
+        (WorkerContextExecutionProxy):
+
+2012-11-25  Christophe Dumez  <christophe.dumez@intel.com>
+
+        [EFL] Refactor RenderThemeEfl::ThemePartCacheEntry::reuse()
+        https://bugs.webkit.org/show_bug.cgi?id=103189
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Check if the entry size and type changed in
+        RenderThemeEfl::ThemePartCacheEntry::reuse() to avoid
+        useless processing if one of them did not change.
+
+        Remove useless call to cairo_surface_finish() since
+        we are using a smart pointer for the surface.
+
+        Resize the edge object *after* loading its content
+        from the theme file as it seems more logical this
+        way.
+
+        No new tests, no behavior change for layout tests.
+
+        * platform/efl/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::ThemePartCacheEntry::reuse):
+        * platform/efl/RenderThemeEfl.h:
+        (ThemePartCacheEntry):
+
+2012-11-25  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Rename DynamicNodeList to LiveNodeList
+        https://bugs.webkit.org/show_bug.cgi?id=103197
+
+        Reviewed by Ojan Vafai.
+
+        Rename DynamicNodeList to LiveNodeList to match the terminology used in DOM4 working draft:
+        http://www.w3.org/TR/2012/WD-dom-20120405/#concept-collection-live
+        "A collection (either NodeList or HTMLCollection) can be either live or static".
+
+        Also rename DynamicNodeListCacheBase to LiveNodeListBase, and merge DynamicSubtreeNodeList
+        into LiveNodeList (old DynamicNodeList) now that the only difference between those two classes
+        is the former calling registerNodeListCache and unregisterNodeListCache on Document.
+
+        This patch completes the series of simplification of NodeList/HTMLCollection classes.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
+        (WebCore::getNamedItems):
+        * bindings/js/JSNodeListCustom.cpp:
+        (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
+        * bindings/v8/custom/V8NodeListCustom.cpp:
+        (WebCore::V8NodeList::opaqueRootForGC):
+        * dom/ChildNodeList.cpp:
+        (WebCore::ChildNodeList::ChildNodeList):
+        (WebCore::ChildNodeList::nodeMatches):
+        * dom/ChildNodeList.h:
+        * dom/ClassNodeList.cpp:
+        (WebCore::ClassNodeList::ClassNodeList):
+        * dom/ClassNodeList.h:
+        * dom/DOMAllInOne.cpp:
+        * dom/Document.cpp:
+        (WebCore::Document::registerNodeListCache):
+        (WebCore::Document::unregisterNodeListCache):
+        (WebCore):
+        * dom/Document.h:
+        (WebCore):
+        (Document):
+        * dom/DynamicNodeList.cpp: Removed.
+        * dom/DynamicNodeList.h: Removed.
+        * dom/LiveNodeList.cpp: Copied from Source/WebCore/dom/DynamicNodeList.cpp.
+        (WebCore::LiveNodeListBase::rootNode):
+        (WebCore::LiveNodeListBase::invalidateCache):
+        (WebCore::LiveNodeListBase::invalidateIdNameCacheMaps):
+        (WebCore::LiveNodeListBase::reportMemoryUsage):
+        (WebCore::LiveNodeList::namedItem):
+        * dom/LiveNodeList.h: Copied from Source/WebCore/dom/DynamicNodeList.h.
+        (WebCore::LiveNodeListBase::LiveNodeListBase):
+        (WebCore::LiveNodeListBase::shouldInvalidateTypeOnAttributeChange):
+        (WebCore::LiveNodeList::LiveNodeList):
+        (WebCore::LiveNodeList::~LiveNodeList):
+        (LiveNodeList):
+        * dom/MicroDataItemList.cpp:
+        (WebCore::MicroDataItemList::MicroDataItemList):
+        * dom/MicroDataItemList.h:
+        * dom/NameNodeList.cpp:
+        (WebCore::NameNodeList::NameNodeList):
+        * dom/NameNodeList.h:
+        * dom/Node.cpp:
+        (WebCore::shouldInvalidateNodeListCachesForAttr):
+        (WebCore::Document::invalidateNodeListCaches):
+        * dom/Node.h:
+        (WebCore):
+        * dom/NodeList.h:
+        (WebCore::NodeList::isLiveNodeList):
+        * dom/NodeRareData.h:
+        (NodeListsNodeData):
+        (WebCore::NodeListsNodeData::removeCacheWithAtomicName):
+        (WebCore::NodeListsNodeData::removeCacheWithName):
+        (WebCore::NodeListsNodeData::removeCacheWithQualifiedName):
+        (WebCore::NodeListsNodeData::adoptTreeScope):
+        * dom/PropertyNodeList.cpp:
+        (WebCore::PropertyNodeList::PropertyNodeList):
+        * dom/PropertyNodeList.h:
+        * dom/TagNodeList.cpp:
+        (WebCore::TagNodeList::TagNodeList):
+        * dom/TagNodeList.h:
+        * html/HTMLCollection.cpp:
+        (WebCore::HTMLCollection::HTMLCollection):
+        (WebCore::LiveNodeListBase::iterateForNextNode):
+        (WebCore::LiveNodeListBase::itemBeforeOrAfter):
+        (WebCore::LiveNodeListBase::itemBefore):
+        (WebCore::LiveNodeListBase::itemAfter):
+        (WebCore::LiveNodeListBase::isLastItemCloserThanLastOrCachedItem):
+        (WebCore::LiveNodeListBase::isFirstItemCloserThanCachedItem):
+        (WebCore::LiveNodeListBase::setItemCache):
+        (WebCore::LiveNodeListBase::length):
+        (WebCore::LiveNodeListBase::item):
+        (WebCore::LiveNodeListBase::itemBeforeOrAfterCachedItem):
+        * html/HTMLCollection.h:
+        * html/LabelsNodeList.cpp:
+        (WebCore::LabelsNodeList::LabelsNodeList):
+        * html/LabelsNodeList.h:
+        * html/RadioNodeList.cpp:
+        (WebCore::RadioNodeList::RadioNodeList):
+        * html/RadioNodeList.h:
+
+2012-10-08  Robert Hogan  <robert@webkit.org>
+
+        Changing position:relative to position:static results in mis-positioned div
+        https://bugs.webkit.org/show_bug.cgi?id=26397
+
+        Reviewed by Ojan Vafai.
+
+        When a block changes position from relative to static it is no longer the containing block for any
+        positioned objects it may have. If any of those positioned objects actually have a position specified
+        they are going to need a layout as their new containing block will likely have a different location they
+        need to offset from. Positioned objects without a specified position always get a layout anyway 
+        in layoutPositionedObjects() so no need to worry about them in this situation. 
+
+        Test: fast/block/abspos-child-container-changes-from-relative-to-static-expected.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::styleWillChange):
+        (WebCore::RenderBlock::layoutPositionedObjects):
+        (WebCore::RenderBlock::removePositionedObjects):
+        * rendering/RenderBlock.h:
+        (RenderBlock):
+
+2012-11-24  Antti Koivisto  <antti@apple.com>
+
+        Make renderer construction less generic
+        https://bugs.webkit.org/show_bug.cgi?id=103175
+
+        Reviewed by Ojan Vafai.
+>>>>>>> fdba644... Refactoring: Move the content of HTMLInputElement::subtreeHasChanged to TextFieldInputType
 
         Correct input[type=number] value sanitization for user-input
         https://bugs.webkit.org/show_bug.cgi?id=103018
index a763d1b..094bc89 100755 (executable)
@@ -50,7 +50,6 @@
 #include "KeyboardEvent.h"
 #include "LocalizedStrings.h"
 #include "MouseEvent.h"
-#include "NumberInputType.h"
 #include "RenderTextControlSingleLine.h"
 #include "RenderTheme.h"
 #include "SearchInputType.h"
@@ -491,35 +490,9 @@ void HTMLInputElement::updateType()
 
 void HTMLInputElement::subtreeHasChanged()
 {
-    ASSERT(isTextField());
-    ASSERT(renderer());
-
-    bool wasChanged = wasChangedSinceLastFormControlChangeEvent();
-    setChangedSinceLastFormControlChangeEvent(true);
-
-    // We don't need to call sanitizeUserInputValue() function here because
-    // HTMLInputElement::handleBeforeTextInsertedEvent() has already called
-    // sanitizeUserInputValue().
-    // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextInsertedEvent.
-    setValueFromRenderer(sanitizeValue(convertFromVisibleValue(innerTextValue())));
-    updatePlaceholderVisibility(false);
-    // Recalc for :invalid and hasUnacceptableValue() change.
-    setNeedsStyleRecalc();
-
     m_inputType->subtreeHasChanged();
-
-    if (!wasChanged && focused()) {
-        if (Frame* frame = document()->frame())
-            frame->editor()->textFieldDidBeginEditing(this);
-    }
-
-    if (focused()) {
-        if (Frame* frame = document()->frame())
-            frame->editor()->textDidChangeInTextField(this);
-    }
     // When typing in an input field, childrenChanged is not called, so we need to force the directionality check.
-    if (isTextField())
-        calculateAndAdjustDirectionality();
+    calculateAndAdjustDirectionality();
 }
 
 const AtomicString& HTMLInputElement::formControlType() const
@@ -1333,11 +1306,6 @@ String HTMLInputElement::visibleValue() const
     return m_inputType->visibleValue();
 }
 
-String HTMLInputElement::convertFromVisibleValue(const String& visibleValue) const
-{
-    return m_inputType->convertFromVisibleValue(visibleValue);
-}
-
 String HTMLInputElement::sanitizeValue(const String& proposedValue) const
 {
     if (proposedValue.isNull())
index 042f73a..c47078b 100755 (executable)
@@ -155,7 +155,6 @@ public:
 
     // The value which is drawn by a renderer.
     String visibleValue() const;
-    String convertFromVisibleValue(const String&) const;
 
     const String& suggestedValue() const;
     void setSuggestedValue(const String&);
index e09188c..32251ac 100644 (file)
@@ -671,11 +671,6 @@ String InputType::visibleValue() const
     return element()->value();
 }
 
-String InputType::convertFromVisibleValue(const String& visibleValue) const
-{
-    return visibleValue;
-}
-
 String InputType::sanitizeValue(const String& proposedValue) const
 {
     return proposedValue;
@@ -892,6 +887,7 @@ void InputType::readonlyAttributeChanged()
 
 void InputType::subtreeHasChanged()
 {
+    ASSERT_NOT_REACHED();
 }
 
 #if ENABLE(TOUCH_EVENTS)
index f45df29..749909d 100644 (file)
@@ -180,7 +180,6 @@ public:
     virtual bool canSetStringValue() const;
     virtual String localizeValue(const String&) const;
     virtual String visibleValue() const;
-    virtual String convertFromVisibleValue(const String&) 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;
index 958878c..23ce5e4 100644 (file)
@@ -170,7 +170,7 @@ bool SearchInputType::searchEventsShouldBeDispatched() const
     return element()->hasAttribute(incrementalAttr);
 }
 
-void SearchInputType::subtreeHasChanged()
+void SearchInputType::didSetValueByUserEdit(ValueChangeState state)
 {
     if (m_cancelButton.get())
         toRenderSearchField(element()->renderer())->updateCancelButtonVisibility();
@@ -178,6 +178,8 @@ void SearchInputType::subtreeHasChanged()
     // If the incremental attribute is set, then dispatch the search event
     if (searchEventsShouldBeDispatched())
         startSearchEventTimer();
+
+    TextFieldInputType::didSetValueByUserEdit(state);
 }
 
 } // namespace WebCore
index ece35a2..8c5a6d2 100644 (file)
@@ -58,7 +58,7 @@ private:
     virtual HTMLElement* resultsButtonElement() const OVERRIDE;
     virtual HTMLElement* cancelButtonElement() const OVERRIDE;
     virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
-    virtual void subtreeHasChanged();
+    virtual void didSetValueByUserEdit(ValueChangeState) OVERRIDE;
 
     void searchEventTimerFired(Timer<SearchInputType>*);
     bool searchEventsShouldBeDispatched() const;
index aca7632..4a1cc47 100644 (file)
@@ -445,6 +445,41 @@ bool TextFieldInputType::appendFormData(FormDataList& list, bool multipart) cons
     return true;
 }
 
+String TextFieldInputType::convertFromVisibleValue(const String& visibleValue) const
+{
+    return visibleValue;
+}
+
+void TextFieldInputType::subtreeHasChanged()
+{
+    ASSERT(element()->renderer());
+
+    bool wasChanged = element()->wasChangedSinceLastFormControlChangeEvent();
+    element()->setChangedSinceLastFormControlChangeEvent(true);
+
+    // We don't need to call sanitizeUserInputValue() function here because
+    // HTMLInputElement::handleBeforeTextInsertedEvent() has already called
+    // sanitizeUserInputValue().
+    // sanitizeValue() is needed because IME input doesn't dispatch BeforeTextInsertedEvent.
+    element()->setValueFromRenderer(sanitizeValue(convertFromVisibleValue(element()->innerTextValue())));
+    element()->updatePlaceholderVisibility(false);
+    // Recalc for :invalid and hasUnacceptableValue() change.
+    element()->setNeedsStyleRecalc();
+
+    didSetValueByUserEdit(wasChanged ? ValueChangeStateChanged : ValueChangeStateNone);
+}
+
+void TextFieldInputType::didSetValueByUserEdit(ValueChangeState state)
+{
+    if (!element()->focused())
+        return;
+    if (Frame* frame = element()->document()->frame()) {
+        if (state == ValueChangeStateNone)
+            frame->editor()->textFieldDidBeginEditing(element());
+        frame->editor()->textDidChangeInTextField(element());
+    }
+}
+
 void TextFieldInputType::spinButtonStepDown()
 {
     stepUpFromRenderer(-1);
index be6c666..b6d9dec 100644 (file)
@@ -68,6 +68,13 @@ protected:
     virtual void handleBlurEvent() OVERRIDE;
     virtual void updateInnerTextValue() OVERRIDE;
 
+    virtual String convertFromVisibleValue(const String&) const;
+    enum ValueChangeState {
+        ValueChangeStateNone,
+        ValueChangeStateChanged
+    };
+    virtual void didSetValueByUserEdit(ValueChangeState);
+
 private:
     virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;
     virtual bool isMouseFocusable() const OVERRIDE;
@@ -85,6 +92,7 @@ private:
     virtual void updatePlaceholderText() OVERRIDE;
     virtual bool appendFormData(FormDataList&, bool multipart) const OVERRIDE;
     virtual void attach() OVERRIDE;
+    virtual void subtreeHasChanged() OVERRIDE;
 
     // SpinButtonElement::StepActionHandler functions.
     virtual void spinButtonStepDown() OVERRIDE;