Commit becacd8e authored by darin@apple.com's avatar darin@apple.com

2010-09-08 Darin Adler <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * src/ContextMenuClientImpl.cpp:
        (WebKit::selectMisspelledWord):
        (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems):
        * src/WebFrameImpl.cpp:
        (WebKit::WebFrameImpl::find):
        (WebKit::WebFrameImpl::stopFinding):
        (WebKit::WebFrameImpl::scopeStringMatches):
        * src/WebViewImpl.cpp:
        (WebKit::WebViewImpl::caretOrSelectionBounds):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * Api/qwebpage.cpp:
        (QWebPage::selectedText):
        (QWebPage::setContentEditable):
        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
        (DumpRenderTreeSupportQt::firstRectForCharacterRange):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * webkit/webkitwebview.cpp:
        (webkit_web_view_set_highlight_text_matches):
        (webkit_web_view_get_selected_text):
        (webkit_web_view_set_editable):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * WebCoreSupport/WebContextMenuClient.cpp:
        (WebContextMenuClient::searchWithGoogle):
        * WebFrame.cpp:
        (WebFrame::selectedString):
        * WebView.cpp:
        (WebView::selectedText):
        (WebView::prepareCandidateWindow):
        (WebView::onIMERequestCharPosition):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * WebFrame.cpp:
        (wxWebFrame::FindString):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * WebView/WebFrame.mm:
        (-[WebFrame _selectedString]):
        (-[WebFrame _firstRectForDOMRange:]):
        (-[WebFrame _markDOMRange]):
        (-[WebFrame _setTypingStyle:withUndoAction:]):
        * WebView/WebHTMLRepresentation.mm:
        (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
        * WebView/WebHTMLView.mm:
        (-[WebHTMLView _selectionStartFontAttributesAsRTF]):
        (-[WebHTMLView toggleBaseWritingDirection:]):
        (-[WebHTMLView searchFor:direction:caseSensitive:wrap:startInSelection:]):
        (-[WebHTMLView countMatchesForText:caseSensitive:limit:markMatches:]):
        (-[WebHTMLView setMarkedTextMatchesAreHighlighted:]):
        (-[WebHTMLView markedTextMatchesAreHighlighted]):
        * WebView/WebView.mm:
        (-[WebView setEditable:]):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        * ewk/ewk_frame.cpp:
        (ewk_frame_editable_set):
        (ewk_frame_selection_get):
        (ewk_frame_text_search):
        (ewk_frame_text_matches_mark):
        (ewk_frame_text_matches_highlight_set):
        (ewk_frame_text_matches_highlight_get):
        * ewk/ewk_view.cpp:
        (ewk_view_selection_get):
        Changed call sites to use editor().
2010-09-08  Darin Adler  <darin@apple.com>

        Reviewed by Adam Barth.

        Move functions from Frame to Editor as planned
        https://bugs.webkit.org/show_bug.cgi?id=45218

        Just executing the plan that has long been described in Frame.h
        to move a bunch of functions to Editor.

        * WebCore.exp.in: Updated.

        * editing/Editor.cpp:
        (WebCore::Editor::fontForSelection):
        (WebCore::Editor::textDirectionForSelection):
        (WebCore::Editor::applyStyle):
        (WebCore::Editor::selectionStartHasStyle):
        (WebCore::Editor::selectionHasStyle):
        (WebCore::Editor::selectionStartCSSPropertyValue):
        (WebCore::Editor::Editor):
        (WebCore::Editor::cut):
        (WebCore::Editor::copy):
        (WebCore::Editor::ignoreSpelling):
        (WebCore::Editor::learnSpelling):
        (WebCore::Editor::isSelectionMisspelled):
        (WebCore::Editor::guessesForMisspelledSelection):
        (WebCore::Editor::selectedText):
        (WebCore::Editor::firstRectForRange):
        (WebCore::Editor::shouldChangeSelection):
        (WebCore::Editor::computeAndSetTypingStyle):
        (WebCore::Editor::selectionComputedStyle):
        (WebCore::Editor::textFieldDidBeginEditing):
        (WebCore::Editor::textFieldDidEndEditing):
        (WebCore::Editor::textDidChangeInTextField):
        (WebCore::Editor::doTextFieldCommandFromEvent):
        (WebCore::Editor::textWillBeDeletedInTextField):
        (WebCore::Editor::textDidChangeInTextArea):
        (WebCore::Editor::applyEditingStyleToBodyElement):
        (WebCore::Editor::applyEditingStyleToElement):
        (WebCore::Editor::styleForSelectionStart):
        (WebCore::Editor::findString):
        (WebCore::Editor::countMatchesForText):
        (WebCore::Editor::setMarkedTextMatchesAreHighlighted):
        (WebCore::Editor::respondToChangedSelection):
        * editing/Editor.h:
        * editing/mac/EditorMac.mm:
        (WebCore::Editor::fontAttributesForSelectionStart):
        (WebCore::Editor::baseWritingDirectionForSelectionStart):
        Moved functions here.

        * page/Frame.cpp:
        (WebCore::Frame::Frame):
        (WebCore::Frame::shouldChangeSelection):
        * page/Frame.h:
        * page/mac/FrameMac.mm:
        Moved functions out of here.

        * dom/InputElement.cpp:
        (WebCore::InputElement::dispatchBlurEvent):
        (WebCore::InputElement::aboutToUnload):
        * editing/DeleteSelectionCommand.cpp:
        (WebCore::DeleteSelectionCommand::doApply):
        * editing/EditorCommand.cpp:
        (WebCore::executeToggleStyleInList):
        (WebCore::executeDeleteToMark):
        (WebCore::executeFindString):
        (WebCore::executeSelectToMark):
        (WebCore::executeSetMark):
        (WebCore::executeSwapWithMark):
        (WebCore::enabledVisibleSelectionAndMark):
        * editing/SelectionController.cpp:
        (WebCore::SelectionController::setSelection):
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::defaultEventHandler):
        * page/ContextMenuController.cpp:
        (WebCore::ContextMenuController::contextMenuItemSelected):
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::find):
        * page/DragController.cpp:
        (WebCore::DragController::startDrag):
        * page/EventHandler.cpp:
        (WebCore::EventHandler::sendContextMenuEventForKey):
        * page/Page.cpp:
        (WebCore::Page::findString):
        (WebCore::Page::markAllMatchesForText):
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paintTextMatchMarker):
        * rendering/RenderTextControlMultiLine.cpp:
        (WebCore::RenderTextControlMultiLine::subtreeHasChanged):
        * rendering/RenderTextControlSingleLine.cpp:
        (WebCore::RenderTextControlSingleLine::subtreeHasChanged):
        Changed call sites to use editor().


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67122 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a32ee4f3
2010-09-08 Darin Adler <darin@apple.com>
Reviewed by Adam Barth.
Move functions from Frame to Editor as planned
https://bugs.webkit.org/show_bug.cgi?id=45218
Just executing the plan that has long been described in Frame.h
to move a bunch of functions to Editor.
* WebCore.exp.in: Updated.
* editing/Editor.cpp:
(WebCore::Editor::fontForSelection):
(WebCore::Editor::textDirectionForSelection):
(WebCore::Editor::applyStyle):
(WebCore::Editor::selectionStartHasStyle):
(WebCore::Editor::selectionHasStyle):
(WebCore::Editor::selectionStartCSSPropertyValue):
(WebCore::Editor::Editor):
(WebCore::Editor::cut):
(WebCore::Editor::copy):
(WebCore::Editor::ignoreSpelling):
(WebCore::Editor::learnSpelling):
(WebCore::Editor::isSelectionMisspelled):
(WebCore::Editor::guessesForMisspelledSelection):
(WebCore::Editor::selectedText):
(WebCore::Editor::firstRectForRange):
(WebCore::Editor::shouldChangeSelection):
(WebCore::Editor::computeAndSetTypingStyle):
(WebCore::Editor::selectionComputedStyle):
(WebCore::Editor::textFieldDidBeginEditing):
(WebCore::Editor::textFieldDidEndEditing):
(WebCore::Editor::textDidChangeInTextField):
(WebCore::Editor::doTextFieldCommandFromEvent):
(WebCore::Editor::textWillBeDeletedInTextField):
(WebCore::Editor::textDidChangeInTextArea):
(WebCore::Editor::applyEditingStyleToBodyElement):
(WebCore::Editor::applyEditingStyleToElement):
(WebCore::Editor::styleForSelectionStart):
(WebCore::Editor::findString):
(WebCore::Editor::countMatchesForText):
(WebCore::Editor::setMarkedTextMatchesAreHighlighted):
(WebCore::Editor::respondToChangedSelection):
* editing/Editor.h:
* editing/mac/EditorMac.mm:
(WebCore::Editor::fontAttributesForSelectionStart):
(WebCore::Editor::baseWritingDirectionForSelectionStart):
Moved functions here.
* page/Frame.cpp:
(WebCore::Frame::Frame):
(WebCore::Frame::shouldChangeSelection):
* page/Frame.h:
* page/mac/FrameMac.mm:
Moved functions out of here.
* dom/InputElement.cpp:
(WebCore::InputElement::dispatchBlurEvent):
(WebCore::InputElement::aboutToUnload):
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::doApply):
* editing/EditorCommand.cpp:
(WebCore::executeToggleStyleInList):
(WebCore::executeDeleteToMark):
(WebCore::executeFindString):
(WebCore::executeSelectToMark):
(WebCore::executeSetMark):
(WebCore::executeSwapWithMark):
(WebCore::enabledVisibleSelectionAndMark):
* editing/SelectionController.cpp:
(WebCore::SelectionController::setSelection):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler):
* page/ContextMenuController.cpp:
(WebCore::ContextMenuController::contextMenuItemSelected):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::find):
* page/DragController.cpp:
(WebCore::DragController::startDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEventForKey):
* page/Page.cpp:
(WebCore::Page::findString):
(WebCore::Page::markAllMatchesForText):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintTextMatchMarker):
* rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::subtreeHasChanged):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::subtreeHasChanged):
Changed call sites to use editor().
2010-09-09 Chris Rogers <crogers@google.com>
Reviewed by Kenneth Russell.
......@@ -579,16 +579,12 @@ __ZN7WebCore5Cache11setDisabledEb
__ZN7WebCore5Cache13getStatisticsEv
__ZN7WebCore5Cache13setCapacitiesEjjj
__ZN7WebCore5Frame10createViewERKNS_7IntSizeERKNS_5ColorEbS3_bNS_13ScrollbarModeEbS7_b
__ZN7WebCore5Frame10findStringERKN3WTF6StringEbbbb
__ZN7WebCore5Frame14frameForWidgetEPKNS_6WidgetE
__ZN7WebCore5Frame15revealSelectionERKNS_15ScrollAlignmentEb
__ZN7WebCore5Frame19countMatchesForTextERKN3WTF6StringEbjb
__ZN7WebCore5Frame20setSelectionFromNoneEv
__ZN7WebCore5Frame23visiblePositionForPointERKNS_8IntPointE
__ZN7WebCore5Frame24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
__ZN7WebCore5Frame25matchLabelsAgainstElementEP7NSArrayPNS_7ElementE
__ZN7WebCore5Frame28searchForLabelsBeforeElementEP7NSArrayPNS_7ElementEPmPb
__ZN7WebCore5Frame34setMarkedTextMatchesAreHighlightedEb
__ZN7WebCore5Frame6createEPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
__ZN7WebCore5Frame7setViewEN3WTF10PassRefPtrINS_9FrameViewEEE
__ZN7WebCore5Frame9nodeImageEPNS_4NodeE
......@@ -605,6 +601,7 @@ __ZN7WebCore6Cursor8fromTypeENS0_4TypeE
__ZN7WebCore6CursorD1Ev
__ZN7WebCore6CursoraSERKS0_
__ZN7WebCore6Editor10applyStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
__ZN7WebCore6Editor10findStringERKN3WTF6StringEbbbb
__ZN7WebCore6Editor10insertTextERKN3WTF6StringEPNS_5EventE
__ZN7WebCore6Editor13canDHTMLPasteEv
__ZN7WebCore6Editor13performDeleteEv
......@@ -616,12 +613,14 @@ __ZN7WebCore6Editor16pasteAsPlainTextEv
__ZN7WebCore6Editor17insertOrderedListEv
__ZN7WebCore6Editor18confirmCompositionERKN3WTF6StringE
__ZN7WebCore6Editor18confirmCompositionEv
__ZN7WebCore6Editor19countMatchesForTextERKN3WTF6StringEbjb
__ZN7WebCore6Editor19deleteWithDirectionENS_19SelectionController10EDirectionENS_15TextGranularityEbb
__ZN7WebCore6Editor19insertUnorderedListEv
__ZN7WebCore6Editor21applyStyleToSelectionEPNS_19CSSStyleDeclarationENS_10EditActionE
__ZN7WebCore6Editor21isSelectionMisspelledEv
__ZN7WebCore6Editor23setBaseWritingDirectionENS_16WritingDirectionE
__ZN7WebCore6Editor24advanceToNextMisspellingEb
__ZN7WebCore6Editor24computeAndSetTypingStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
__ZN7WebCore6Editor24handleRejectedCorrectionEv
__ZN7WebCore6Editor24isSelectionUngrammaticalEv
__ZN7WebCore6Editor26decreaseSelectionListLevelEv
......@@ -633,6 +632,7 @@ __ZN7WebCore6Editor30deleteSelectionWithSmartDeleteEb
__ZN7WebCore6Editor30pasteAsPlainTextBypassingDHTMLEv
__ZN7WebCore6Editor32guessesForUngrammaticalSelectionEv
__ZN7WebCore6Editor33increaseSelectionListLevelOrderedEv
__ZN7WebCore6Editor34setMarkedTextMatchesAreHighlightedEb
__ZN7WebCore6Editor35increaseSelectionListLevelUnorderedEv
__ZN7WebCore6Editor35setIgnoreCompositionSelectionChangeEb
__ZN7WebCore6Editor3cutEv
......@@ -672,14 +672,14 @@ __ZN7WebCore8Document16isPageBoxVisibleEi
__ZN7WebCore8Document17getFocusableNodesERN3WTF6VectorINS1_6RefPtrINS_4NodeEEELm0EEE
__ZN7WebCore8Document18createWrapperCacheEPNS_15DOMWrapperWorldE
__ZN7WebCore8Document19accessSVGExtensionsEv
__ZN7WebCore8Document20styleSelectorChangedENS_23StyleSelectorUpdateFlagE
__ZN7WebCore8Document22createDocumentFragmentEv
__ZN7WebCore8Document24addMediaCanStartListenerEPNS_21MediaCanStartListenerE
__ZN7WebCore8Document24setShouldCreateRenderersEb
__ZN7WebCore8Document25scheduleForcedStyleRecalcEv
__ZN7WebCore8Document26pageSizeAndMarginsInPixelsEiRNS_7IntSizeERiS3_S3_S3_
__ZN7WebCore8Document27removeMediaCanStartListenerEPNS_21MediaCanStartListenerE
__ZN7WebCore8Document36updateLayoutIgnorePendingStylesheetsEv
__ZN7WebCore8Document25scheduleForcedStyleRecalcEv
__ZN7WebCore8Document20styleSelectorChangedENS_23StyleSelectorUpdateFlagE
__ZN7WebCore8Document4headEv
__ZN7WebCore8FormData6createEPKvm
__ZN7WebCore8FormDataD1Ev
......@@ -737,9 +737,9 @@ __ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
__ZN7WebCore8Settings32setAcceleratedCompositingEnabledEb
__ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
__ZN7WebCore8Settings33setDownloadableBinaryFontsEnabledEb
__ZN7WebCore8Settings35setEnforceCSSMIMETypeInNoQuirksModeEb
__ZN7WebCore8Settings34setLocalFileContentSniffingEnabledEb
__ZN7WebCore8Settings35setAllowUniversalAccessFromFileURLsEb
__ZN7WebCore8Settings35setEnforceCSSMIMETypeInNoQuirksModeEb
__ZN7WebCore8Settings35setExperimentalNotificationsEnabledEb
__ZN7WebCore8Settings35setTreatsAnyTextCSSLinkAsStylesheetEb
__ZN7WebCore8Settings36setOfflineWebApplicationCacheEnabledEb
......@@ -774,10 +774,10 @@ __ZN7WebCore9FrameView20enterCompositingModeEv
__ZN7WebCore9FrameView21flushDeferredRepaintsEv
__ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE
__ZN7WebCore9FrameView23updateCanHaveScrollbarsEv
__ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv
__ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE
__ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb
__ZN7WebCore9FrameView29syncCompositingStateRecursiveEv
__ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv
__ZN7WebCore9FrameView38scrollPositionChangedViaPlatformWidgetEv
__ZN7WebCore9FrameView6createEPNS_5FrameE
__ZN7WebCore9FrameView6createEPNS_5FrameERKNS_7IntSizeE
......@@ -889,9 +889,9 @@ __ZNK7WebCore12EventHandler20currentKeyboardEventEv
__ZNK7WebCore12IconDatabase12databasePathEv
__ZNK7WebCore12IconDatabase24shouldStopThreadActivityEv
__ZNK7WebCore12IconDatabase9isEnabledEv
__ZNK7WebCore12RenderObject7childAtEj
__ZNK7WebCore12RenderObject14enclosingLayerEv
__ZNK7WebCore12RenderObject15localToAbsoluteENS_10FloatPointEbb
__ZNK7WebCore12RenderObject7childAtEj
__ZNK7WebCore12RenderWidget14windowClipRectEv
__ZNK7WebCore12SharedBuffer4dataEv
__ZNK7WebCore12SharedBuffer4sizeEv
......@@ -989,19 +989,14 @@ __ZNK7WebCore4Page15backForwardListEv
__ZNK7WebCore4Page34inLowQualityImageInterpolationModeEv
__ZNK7WebCore4Page9groupNameEv
__ZNK7WebCore5Frame11currentFormEv
__ZNK7WebCore5Frame12selectedTextEv
__ZNK7WebCore5Frame13ownerRendererEv
__ZNK7WebCore5Frame14selectionImageEb
__ZNK7WebCore5Frame15contentRendererEv
__ZNK7WebCore5Frame15layerTreeAsTextEv
__ZNK7WebCore5Frame15selectionBoundsEb
__ZNK7WebCore5Frame17firstRectForRangeEPNS_5RangeE
__ZNK7WebCore5Frame18documentTypeStringEv
__ZNK7WebCore5Frame18selectionTextRectsERN3WTF6VectorINS_9FloatRectELm0EEENS0_30SelectionRectRespectTransformsEb
__ZNK7WebCore5Frame20selectionGranularityEv
__ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
__ZNK7WebCore5Frame31fontAttributesForSelectionStartEv
__ZNK7WebCore5Frame37baseWritingDirectionForSelectionStartEv
__ZNK7WebCore5Frame8settingsEv
__ZNK7WebCore5Frame9domWindowEv
__ZNK7WebCore5Range11startOffsetERi
......@@ -1013,13 +1008,18 @@ __ZNK7WebCore5Range9endOffsetERi
__ZNK7WebCore5Range9firstNodeEv
__ZNK7WebCore6Chrome12createWindowEPNS_5FrameERKNS_16FrameLoadRequestERKNS_14WindowFeaturesE
__ZNK7WebCore6Cursor14platformCursorEv
__ZNK7WebCore6Editor12selectedTextEv
__ZNK7WebCore6Editor13canEditRichlyEv
__ZNK7WebCore6Editor16compositionRangeEv
__ZNK7WebCore6Editor16fontForSelectionERb
__ZNK7WebCore6Editor17firstRectForRangeEPNS_5RangeE
__ZNK7WebCore6Editor17selectionHasStyleEPNS_19CSSStyleDeclarationE
__ZNK7WebCore6Editor17shouldDeleteRangeEPNS_5RangeE
__ZNK7WebCore6Editor22selectionStartHasStyleEPNS_19CSSStyleDeclarationE
__ZNK7WebCore6Editor23getCompositionSelectionERjS1_
__ZNK7WebCore6Editor30applyEditingStyleToBodyElementEv
__ZNK7WebCore6Editor31fontAttributesForSelectionStartEv
__ZNK7WebCore6Editor37baseWritingDirectionForSelectionStartEv
__ZNK7WebCore6Editor6canCutEv
__ZNK7WebCore6Editor7Command11isSupportedEv
__ZNK7WebCore6Editor7Command15isTextInsertionEv
......
......@@ -84,7 +84,7 @@ void InputElement::dispatchBlurEvent(InputElement* inputElement, Element* elemen
if (inputElement->isPasswordField())
document->setUseSecureKeyboardEntryWhenActive(false);
frame->textFieldDidEndEditing(element);
frame->editor()->textFieldDidEndEditing(element);
}
void InputElement::updateFocusAppearance(InputElementData& data, InputElement* inputElement, Element* element, bool restorePreviousSelection)
......@@ -123,7 +123,7 @@ void InputElement::aboutToUnload(InputElement* inputElement, Element* element)
if (!frame)
return;
frame->textFieldDidEndEditing(element);
frame->editor()->textFieldDidEndEditing(element);
}
void InputElement::setValueFromRenderer(InputElementData& data, InputElement* inputElement, Element* element, const String& value)
......
......@@ -746,7 +746,7 @@ void DeleteSelectionCommand::doApply()
if (ancestorNode && ancestorNode->hasTagName(inputTag)
&& static_cast<HTMLInputElement*>(ancestorNode)->isTextField()
&& ancestorNode->focused())
document()->frame()->textWillBeDeletedInTextField(static_cast<Element*>(ancestorNode));
document()->frame()->editor()->textWillBeDeletedInTextField(static_cast<Element*>(ancestorNode));
}
// save this to later make the selection with
......
This diff is collapsed.
......@@ -34,6 +34,11 @@
#include "EditorInsertAction.h"
#include "SelectionController.h"
#if PLATFORM(MAC) && !defined(__OBJC__)
class NSDictionary;
typedef int NSWritingDirection;
#endif
namespace WebCore {
class CSSStyleDeclaration;
......@@ -319,12 +324,47 @@ public:
void markMisspellingsAndBadGrammar(const VisibleSelection&);
Node* findEventTargetFrom(const VisibleSelection& selection) const;
String selectedText() const;
bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection);
const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
void setMark(const VisibleSelection&);
void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified);
void applyEditingStyleToBodyElement() const;
void applyEditingStyleToElement(Element*) const;
IntRect firstRectForRange(Range*) const;
void respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping);
bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const;
RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const;
unsigned countMatchesForText(const String&, bool caseFlag, unsigned limit, bool markMatches);
bool markedTextMatchesAreHighlighted() const;
void setMarkedTextMatchesAreHighlighted(bool);
PassRefPtr<CSSComputedStyleDeclaration> selectionComputedStyle(Node*& nodeToRemove) const;
void textFieldDidBeginEditing(Element*);
void textFieldDidEndEditing(Element*);
void textDidChangeInTextField(Element*);
bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
void textWillBeDeletedInTextField(Element* input);
void textDidChangeInTextArea(Element*);
#if PLATFORM(MAC)
NSDictionary* fontAttributesForSelectionStart() const;
NSWritingDirection baseWritingDirectionForSelectionStart() const;
#endif
private:
Frame* m_frame;
OwnPtr<DeleteButtonController> m_deleteButtonController;
RefPtr<EditCommand> m_lastEditCommand;
RefPtr<Node> m_removedAnchor;
RefPtr<Text> m_compositionNode;
unsigned m_compositionStart;
unsigned m_compositionEnd;
......@@ -336,6 +376,8 @@ private:
RefPtr<Range> m_rangeToBeReplacedByCorrection;
String m_stringToBeReplacedByCorrection;
Timer<Editor> m_correctionPanelTimer;
VisibleSelection m_mark;
bool m_areMarkedTextMatchesHighlighted;
bool canDeleteRange(Range*) const;
bool canSmartReplaceWithPasteboard(Pasteboard*);
......@@ -364,6 +406,22 @@ inline void Editor::setStartNewKillRingSequence(bool flag)
m_shouldStartNewKillRingSequence = flag;
}
inline const VisibleSelection& Editor::mark() const
{
return m_mark;
}
inline void Editor::setMark(const VisibleSelection& selection)
{
m_mark = selection;
}
inline bool Editor::markedTextMatchesAreHighlighted() const
{
return m_areMarkedTextMatchesHighlighted;
}
} // namespace WebCore
#endif // Editor_h
......@@ -132,7 +132,7 @@ static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E
{
ExceptionCode ec = 0;
Node* nodeToRemove = 0;
RefPtr<CSSComputedStyleDeclaration> selectionStyle = frame->selectionComputedStyle(nodeToRemove);
RefPtr<CSSComputedStyleDeclaration> selectionStyle = frame->editor()->selectionComputedStyle(nodeToRemove);
if (!selectionStyle)
return false;
......@@ -378,7 +378,7 @@ static bool executeDeleteToEndOfParagraph(Frame* frame, Event*, EditorCommandSou
static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
RefPtr<Range> mark = frame->mark().toNormalizedRange();
RefPtr<Range> mark = frame->editor()->mark().toNormalizedRange();
if (mark) {
SelectionController* selection = frame->selection();
bool selected = selection->setSelectedRange(unionDOMRanges(mark.get(), frame->editor()->selectedRange().get()).get(), DOWNSTREAM, true);
......@@ -387,7 +387,7 @@ static bool executeDeleteToMark(Frame* frame, Event*, EditorCommandSource, const
return false;
}
frame->editor()->performDelete();
frame->setMark(frame->selection()->selection());
frame->editor()->setMark(frame->selection()->selection());
return true;
}
......@@ -405,7 +405,7 @@ static bool executeDeleteWordForward(Frame* frame, Event*, EditorCommandSource,
static bool executeFindString(Frame* frame, Event*, EditorCommandSource, const String& value)
{
return frame->findString(value, true, false, true, false);
return frame->editor()->findString(value, true, false, true, false);
}
static bool executeFontName(Frame* frame, Event*, EditorCommandSource source, const String& value)
......@@ -954,7 +954,7 @@ static bool executeSelectSentence(Frame* frame, Event*, EditorCommandSource, con
static bool executeSelectToMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
RefPtr<Range> mark = frame->mark().toNormalizedRange();
RefPtr<Range> mark = frame->editor()->mark().toNormalizedRange();
RefPtr<Range> selection = frame->editor()->selectedRange();
if (!mark || !selection) {
systemBeep();
......@@ -971,7 +971,7 @@ static bool executeSelectWord(Frame* frame, Event*, EditorCommandSource, const S
static bool executeSetMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
frame->setMark(frame->selection()->selection());
frame->editor()->setMark(frame->selection()->selection());
return true;
}
......@@ -1002,14 +1002,14 @@ static bool executeSuperscript(Frame* frame, Event*, EditorCommandSource source,
static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
const VisibleSelection& mark = frame->mark();
const VisibleSelection& mark = frame->editor()->mark();
const VisibleSelection& selection = frame->selection()->selection();
if (mark.isNone() || selection.isNone()) {
systemBeep();
return false;
}
frame->selection()->setSelection(mark);
frame->setMark(selection);
frame->editor()->setMark(selection);
return true;
}
......@@ -1153,7 +1153,7 @@ static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCom
{
const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
return ((selection.isCaret() && selection.isContentEditable()) || selection.isRange())
&& frame->mark().isCaretOrRange();
&& frame->editor()->mark().isCaretOrRange();
}
static bool enableCaretInEditableText(Frame* frame, Event* event, EditorCommandSource)
......
......@@ -163,7 +163,7 @@ void SelectionController::setSelection(const VisibleSelection& s, bool closeTypi
m_xPosForVerticalArrowNavigation = NoXPosForVerticalArrowNavigation;
selectFrameElementInParentIfFullySelected();
m_frame->notifyRendererOfSelectionChange(userTriggered);
m_frame->respondToChangedSelection(oldSelection, closeTyping);
m_frame->editor()->respondToChangedSelection(oldSelection, closeTyping);
if (userTriggered) {
ScrollAlignment alignment;
......
......@@ -26,10 +26,12 @@
#import "config.h"
#import "Editor.h"
#import "ColorMac.h"
#import "ClipboardMac.h"
#import "CachedResourceLoader.h"
#import "Frame.h"
#import "FrameView.h"
#import "RenderBlock.h"
namespace WebCore {
......@@ -69,4 +71,103 @@ void Editor::paste()
loader->setAllowStaleResources(false);
}
NSDictionary* Editor::fontAttributesForSelectionStart() const
{
Node* nodeToRemove;
RenderStyle* style = styleForSelectionStart(nodeToRemove);
if (!style)
return nil;
NSMutableDictionary* result = [NSMutableDictionary dictionary];
if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0)
[result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
if (style->font().primaryFont()->getNSFont())
[result setObject:style->font().primaryFont()->getNSFont() forKey:NSFontAttributeName];
if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
[result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
const ShadowData* shadow = style->textShadow();
if (shadow) {
NSShadow* s = [[NSShadow alloc] init];
[s setShadowOffset:NSMakeSize(shadow->x(), shadow->y())];
[s setShadowBlurRadius:shadow->blur()];
[s setShadowColor:nsColor(shadow->color())];
[result setObject:s forKey:NSShadowAttributeName];
}
int decoration = style->textDecorationsInEffect();
if (decoration & LINE_THROUGH)
[result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
int superscriptInt = 0;
switch (style->verticalAlign()) {
case BASELINE:
case BOTTOM:
case BASELINE_MIDDLE:
case LENGTH:
case MIDDLE:
case TEXT_BOTTOM:
case TEXT_TOP:
case TOP:
break;
case SUB:
superscriptInt = -1;
break;
case SUPER:
superscriptInt = 1;
break;
}
if (superscriptInt)
[result setObject:[NSNumber numberWithInt:superscriptInt] forKey:NSSuperscriptAttributeName];
if (decoration & UNDERLINE)
[result setObject:[NSNumber numberWithInt:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
if (nodeToRemove) {
ExceptionCode ec = 0;
nodeToRemove->remove(ec);
ASSERT(ec == 0);
}
return result;
}
NSWritingDirection Editor::baseWritingDirectionForSelectionStart() const
{
NSWritingDirection result = NSWritingDirectionLeftToRight;
Position pos = m_frame->selection()->selection().visibleStart().deepEquivalent();
Node* node = pos.node();
if (!node)
return result;
RenderObject* renderer = node->renderer();
if (!renderer)
return result;
if (!renderer->isBlockFlow()) {
renderer = renderer->containingBlock();
if (!renderer)
return result;
}
RenderStyle* style = renderer->style();
if (!style)
return result;
switch (style->direction()) {
case LTR:
result = NSWritingDirectionLeftToRight;
break;
case RTL:
result = NSWritingDirectionRightToLeft;
break;
}
return result;
}
} // namespace WebCore
......@@ -2262,7 +2262,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
&& evt->isKeyboardEvent()
&& focused()
&& document()->frame()
&& document()->frame()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) {
&& document()->frame()->editor()->doTextFieldCommandFromEvent(this, static_cast<KeyboardEvent*>(evt))) {
evt->setDefaultHandled();
return;
}
......
......@@ -226,7 +226,7 @@ void ContextMenuController::contextMenuItemSelected(ContextMenuItem* item)
break;
#endif
case ContextMenuItemTagSpellingGuess:
ASSERT(frame->selectedText().length());
ASSERT(frame->editor()->selectedText().length());
if (frame->editor()->shouldInsertText(item->title(), frame->selection()->toNormalizedRange().get(), EditorInsertActionPasted)) {
Document* document = frame->document();
RefPtr<ReplaceSelectionCommand> command = ReplaceSelectionCommand::create(document, createFragmentFromMarkup(document, item->title(), ""), true, false, true);
......
......@@ -1012,7 +1012,7 @@ bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, b
return false;
// FIXME (13016): Support wholeWord, searchInFrames and showDialog
return m_frame->findString(string, !backwards, caseSensitive, wrap, false);
return m_frame->editor()->findString(string, !backwards, caseSensitive, wrap, false);
}
bool DOMWindow::offscreenBuffering() const
......
......@@ -741,7 +741,7 @@ bool DragController::startDrag(Frame* src, Clipboard* clipboard, DragOperation s
} else if (isSelected && (m_dragSourceAction & DragSourceActionSelection)) {
if (!clipboard->hasData()) {
if (isNodeInTextFormControl(src->selection()->start().node()))
clipboard->writePlainText(src->selectedText());
clipboard->writePlainText(src->editor()->selectedText());
else {
RefPtr<Range> selectionRange = src->selection()->toNormalizedRange();
ASSERT(selectionRange);
......
......@@ -2059,7 +2059,7 @@ bool EventHandler::sendContextMenuEventForKey()
if (start.node() && (selectionController->rootEditableElement() || selectionController->isRange())) {
RefPtr<Range> selection = selectionController->toNormalizedRange();
IntRect firstRect = m_frame->firstRectForRange(selection.get());
IntRect firstRect = m_frame->editor()->firstRectForRange(selection.get());
int x = rightAligned ? firstRect.right() : firstRect.x();
location = IntPoint(x, firstRect.bottom());
......
This diff is collapsed.
......@@ -37,7 +37,6 @@
#include "FrameTree.h"
#include "ScriptController.h"
#include "ScrollBehavior.h"
#include "SelectionController.h"
#include "UserScriptTypes.h"
#include "ZoomMode.h"
......@@ -52,10 +51,8 @@
#if PLATFORM(MAC)
#ifndef __OBJC__
class NSArray;
class NSDictionary;
class NSMutableDictionary;
class NSString;
typedef int NSWritingDirection;
#endif
#endif
......@@ -176,49 +173,17 @@ namespace WebCore {
}
#if ENABLE(TILED_BACKING_STORE)
// FIXME: This should be in FrameView, not Frame.
TiledBackingStore* tiledBackingStore() const { return m_tiledBackingStore.get(); }
void setTiledBackingStoreEnabled(bool);
#endif
private:
void lifeSupportTimerFired(Timer<Frame>*);
// === to be moved into Editor
public:
String selectedText() const;
bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection);
const VisibleSelection& mark() const; // Mark, to be used as emacs uses it.
void setMark(const VisibleSelection&);
void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified);
void applyEditingStyleToBodyElement() const;
void applyEditingStyleToElement(Element*) const;
IntRect firstRectForRange(Range*) const;
void respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping);
bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const;
RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const;
unsigned countMatchesForText(const String&, bool caseFlag, unsigned limit, bool markMatches);
bool markedTextMatchesAreHighlighted() const;
void setMarkedTextMatchesAreHighlighted(bool flag);
PassRefPtr<CSSComputedStyleDeclaration> selectionComputedStyle(Node*& nodeToRemove) const;
void textFieldDidBeginEditing(Element*);
void textFieldDidEndEditing(Element*);
void textDidChangeInTextField</