Move all code related to cachedSelection to HTMLTextFormControlElement
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2011 21:37:26 +0000 (21:37 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jul 2011 21:37:26 +0000 (21:37 +0000)
commit21fa5518d243895c4e32b77b50c13d233bbe7839
tree4e5e26277afe601875ad10433fa60f2d35d00909
parent84ffd71402ca5049c49680dba1edd66b0d61685c
Move all code related to cachedSelection to HTMLTextFormControlElement
https://bugs.webkit.org/show_bug.cgi?id=64118

Reviewed by Alexey Proskuryakov.

Moved m_cachedSelectionStart and m_cachedSelectionEnd from HTMLInputElement
and HTMLTextAreaElement to HTMLTextFormControlElement

Also removed cached selection related functions from RenderTextControl,
RenderTextControlSingleLine, and RenderTextControlMultiLine because they were
merely providing wrapper functions to enable polymorphism between
input and textarea elements and their WML equivalents.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::notifyRendererOfSelectionChange): Calls HTMLTextFormControlElement's
selectionChanged instead of RenderTextControl's.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement): Initialize
m_cachedSelectionStart and m_cachedSelectionEnd.
(WebCore::HTMLTextFormControlElement::selectionStart):
(WebCore::HTMLTextFormControlElement::selectionEnd):
(WebCore::HTMLTextFormControlElement::selection):
(WebCore::HTMLTextFormControlElement::restoreCachedSelection): Added.
(WebCore::HTMLTextFormControlElement::selectionChanged): Extracted from
RenderTextControl::selectionChanged.
* html/HTMLFormControlElement.h:
(WebCore::HTMLTextFormControlElement::cacheSelection): Extracted from HTMLInputElement
and HTMLTextAreaElement.
(WebCore::HTMLTextFormControlElement::hasCachedSelectionStart): Added.
(WebCore::HTMLTextFormControlElement::hasCachedSelectionEnd): Added.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::updateFocusAppearance):
* html/HTMLInputElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::HTMLTextAreaElement):
(WebCore::HTMLTextAreaElement::updateFocusAppearance):
* html/HTMLTextAreaElement.h:
(WebCore::HTMLTextAreaElement::isEmptyValue):
* rendering/RenderTextControl.cpp:
(WebCore::setSelectionRange):
* rendering/RenderTextControl.h:
* rendering/RenderTextControlMultiLine.cpp:
* rendering/RenderTextControlMultiLine.h:
* rendering/RenderTextControlSingleLine.cpp:
* rendering/RenderTextControlSingleLine.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90591 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTextControl.h
Source/WebCore/rendering/RenderTextControlMultiLine.cpp
Source/WebCore/rendering/RenderTextControlMultiLine.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.h