Inner text element should not use -webkit-user-modify
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Feb 2014 04:09:28 +0000 (04:09 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Feb 2014 04:09:28 +0000 (04:09 +0000)
commit1eb139436e11d4559599ac4b8f34e3316ed0bc94
tree37d2fa293e9f15a603aa268980c7bc3acfa875f1
parentd643dd85c3fd83cf35933230ffde22f83934a105
Inner text element should not use -webkit-user-modify
https://bugs.webkit.org/show_bug.cgi?id=129035

Reviewed by Andreas Kling.

Source/WebCore:

To eliminate the internal use of -webkit-user-modify, use contenteditable attribute in the inner text elements
instead of manually inspecting disabled-ness and readonly-ness in RenderTextControl.

Unfortunately, we still have to manually set UserModify value in RenderTextControl::adjustInnerTextStyle since
RenderTextControl::styleDidChange creates RenderStyle for its inner text from scratch via createInnerTextStyle.

* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::disabledStateChanged): Don't use childrenOfType iterator which asserts that DOM
isn't mutated during the traversal since we now set contenteditable attribute inside disabledStateChanged via
updateFromControlElementsAncestorDisabledStateUnder.

* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::parseAttribute): Extracted readOnlyAttributeChanged out of this function so
that HTMLTextFormControl could override it to call updateInnerTextElementEditability.
(WebCore::HTMLFormControlElement::readOnlyAttributeChanged): Ditto.
* html/HTMLFormControlElement.h:

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::didAddUserAgentShadowRoot): Call updateInnerTextElementEditability after creating
shadow DOM for the current input type.
(WebCore::HTMLInputElement::updateType): Ditto.
(WebCore::HTMLInputElement::parseAttribute): Ditto.

* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot): Call updateInnerTextElementEditability.

* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::disabledStateChanged): Added to update contenteditable attribute since
the editability of the inner text element depends on disabled-ness of the element.
(WebCore::HTMLTextFormControlElement::readOnlyAttributeChanged): Ditto for the readonly-ness of the element.
(WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability): Added.
* html/HTMLTextFormControlElement.h:

* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::adjustInnerTextStyle): Use the inner text element's presentationAttributeStyle() to
compute the appropriate EUserModify value instead of hard-coding it here.
* rendering/RenderTextControl.h:

LayoutTests:

Rebaselined tests as the user agent shadow DOM of input and textarea elements now have contenteditable attribute.

* editing/input/paste-text-ending-with-interchange-newline-expected.txt:
* editing/inserting/5607069-2-expected.txt:
* editing/inserting/5607069-3-expected.txt:
* editing/pasteboard/copy-image-with-alt-text-expected.txt:
* editing/pasteboard/copy-null-characters-expected.txt:
* editing/pasteboard/nested-blocks-with-text-area-expected.txt:
* editing/pasteboard/nested-blocks-with-text-field-expected.txt:
* editing/selection/dump-as-markup-expected.txt:
* editing/selection/dump-as-markup-form-text-expected.txt:
* fast/forms/suggested-value-after-setvalue-expected.txt:
* fast/forms/suggested-value-expected.txt:
* fast/parser/object-with-textarea-fallback-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@164526 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/input/paste-text-ending-with-interchange-newline-expected.txt
LayoutTests/editing/inserting/5607069-2-expected.txt
LayoutTests/editing/inserting/5607069-3-expected.txt
LayoutTests/editing/pasteboard/copy-image-with-alt-text-expected.txt
LayoutTests/editing/pasteboard/copy-null-characters-expected.txt
LayoutTests/editing/pasteboard/nested-blocks-with-text-area-expected.txt
LayoutTests/editing/pasteboard/nested-blocks-with-text-field-expected.txt
LayoutTests/editing/selection/dump-as-markup-expected.txt
LayoutTests/editing/selection/dump-as-markup-form-text-expected.txt
LayoutTests/fast/forms/suggested-value-after-setvalue-expected.txt
LayoutTests/fast/forms/suggested-value-expected.txt
LayoutTests/fast/parser/object-with-textarea-fallback-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.cpp
Source/WebCore/html/HTMLTextFormControlElement.h
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h