[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
darin at apple.com
darin at apple.com
Wed Dec 22 13:15:15 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit becacd8e6563c242f28b1fe536ff5c44b4442422
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 9 23:08:54 2010 +0000
2010-09-08 Darin Adler <darin at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6837b60..86a573a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,96 @@
+2010-09-08 Darin Adler <darin at 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 at google.com>
Reviewed by Kenneth Russell.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index fa56ca2..a2d5a39 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -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
diff --git a/WebCore/dom/InputElement.cpp b/WebCore/dom/InputElement.cpp
index 2a53b77..f0284d8 100644
--- a/WebCore/dom/InputElement.cpp
+++ b/WebCore/dom/InputElement.cpp
@@ -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)
diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp
index e57895c..70f0e88 100644
--- a/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/WebCore/editing/DeleteSelectionCommand.cpp
@@ -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
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index 1e6ff97..c515bfc 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -43,6 +43,7 @@
#include "DeleteSelectionCommand.h"
#include "CachedResourceLoader.h"
#include "DocumentFragment.h"
+#include "EditingText.h"
#include "EditorClient.h"
#include "EventHandler.h"
#include "EventNames.h"
@@ -58,6 +59,7 @@
#include "KeyboardEvent.h"
#include "KillRing.h"
#include "ModifySelectionListLevel.h"
+#include "NodeList.h"
#include "Page.h"
#include "Pasteboard.h"
#include "RemoveFormatCommand.h"
@@ -470,7 +472,7 @@ const SimpleFontData* Editor::fontForSelection(bool& hasMultipleFonts) const
if (!m_frame->selection()->isRange()) {
Node* nodeToRemove;
- RenderStyle* style = m_frame->styleForSelectionStart(nodeToRemove); // sets nodeToRemove
+ RenderStyle* style = styleForSelectionStart(nodeToRemove); // sets nodeToRemove
const SimpleFontData* result = 0;
if (style)
@@ -521,9 +523,9 @@ WritingDirection Editor::textDirectionForSelection(bool& hasNestedOrMultipleEmbe
if (m_frame->selection()->isNone())
return NaturalWritingDirection;
- Position pos = m_frame->selection()->selection().start().downstream();
+ Position position = m_frame->selection()->selection().start().downstream();
- Node* node = pos.node();
+ Node* node = position.node();
if (!node)
return NaturalWritingDirection;
@@ -531,7 +533,7 @@ WritingDirection Editor::textDirectionForSelection(bool& hasNestedOrMultipleEmbe
if (m_frame->selection()->isRange()) {
end = m_frame->selection()->selection().end().upstream();
- Node* pastLast = Range::create(m_frame->document(), rangeCompliantEquivalent(pos), rangeCompliantEquivalent(end))->pastLastNode();
+ Node* pastLast = Range::create(m_frame->document(), rangeCompliantEquivalent(position), rangeCompliantEquivalent(end))->pastLastNode();
for (Node* n = node; n && n != pastLast; n = n->traverseNextNode()) {
if (!n->isStyledElement())
continue;
@@ -549,7 +551,7 @@ WritingDirection Editor::textDirectionForSelection(bool& hasNestedOrMultipleEmbe
}
if (m_frame->selection()->isCaret()) {
- if (CSSMutableStyleDeclaration *typingStyle = m_frame->typingStyle()) {
+ if (CSSMutableStyleDeclaration* typingStyle = m_frame->typingStyle()) {
RefPtr<CSSValue> unicodeBidi = typingStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi);
if (unicodeBidi) {
ASSERT(unicodeBidi->isPrimitiveValue());
@@ -796,7 +798,7 @@ void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
// do nothing
break;
case VisibleSelection::CaretSelection:
- m_frame->computeAndSetTypingStyle(style, editingAction);
+ computeAndSetTypingStyle(style, editingAction);
break;
case VisibleSelection::RangeSelection:
if (style)
@@ -873,7 +875,7 @@ static TriState triStateOfStyleInComputedStyle(CSSStyleDeclaration* desiredStyle
bool Editor::selectionStartHasStyle(CSSStyleDeclaration* style) const
{
Node* nodeToRemove;
- RefPtr<CSSComputedStyleDeclaration> selectionStyle = m_frame->selectionComputedStyle(nodeToRemove);
+ RefPtr<CSSComputedStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove);
if (!selectionStyle)
return false;
TriState state = triStateOfStyleInComputedStyle(style, selectionStyle.get());
@@ -891,7 +893,7 @@ TriState Editor::selectionHasStyle(CSSStyleDeclaration* style) const
if (!m_frame->selection()->isRange()) {
Node* nodeToRemove;
- RefPtr<CSSComputedStyleDeclaration> selectionStyle = m_frame->selectionComputedStyle(nodeToRemove);
+ RefPtr<CSSComputedStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove);
if (!selectionStyle)
return FalseTriState;
state = triStateOfStyleInComputedStyle(style, selectionStyle.get());
@@ -939,7 +941,7 @@ static bool hasTransparentBackgroundColor(CSSStyleDeclaration* style)
String Editor::selectionStartCSSPropertyValue(int propertyID)
{
Node* nodeToRemove;
- RefPtr<CSSComputedStyleDeclaration> selectionStyle = m_frame->selectionComputedStyle(nodeToRemove);
+ RefPtr<CSSComputedStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove);
if (!selectionStyle)
return String();
@@ -1063,6 +1065,7 @@ Editor::Editor(Frame* frame)
, m_shouldStyleWithCSS(false)
, m_killRing(adoptPtr(new KillRing))
, m_correctionPanelTimer(this, &Editor::correctionPanelTimerFired)
+ , m_areMarkedTextMatchesHighlighted(false)
{
}
@@ -1160,7 +1163,7 @@ void Editor::cut()
RefPtr<Range> selection = selectedRange();
if (shouldDeleteRange(selection.get())) {
if (isNodeInTextFormControl(m_frame->selection()->start().node()))
- Pasteboard::generalPasteboard()->writePlainText(m_frame->selectedText());
+ Pasteboard::generalPasteboard()->writePlainText(selectedText());
else
Pasteboard::generalPasteboard()->writeSelection(selection.get(), canSmartCopyOrDelete(), m_frame);
didWriteSelectionToPasteboard();
@@ -1178,7 +1181,7 @@ void Editor::copy()
}
if (isNodeInTextFormControl(m_frame->selection()->start().node()))
- Pasteboard::generalPasteboard()->writePlainText(m_frame->selectedText());
+ Pasteboard::generalPasteboard()->writePlainText(selectedText());
else {
Document* document = m_frame->document();
if (HTMLImageElement* imageElement = imageElementFromImageDocument(document))
@@ -1634,7 +1637,7 @@ void Editor::ignoreSpelling()
if (selectedRange)
frame()->document()->markers()->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
- String text = frame()->selectedText();
+ String text = selectedText();
ASSERT(text.length());
client()->ignoreWordInSpellDocument(text);
}
@@ -1647,7 +1650,7 @@ void Editor::learnSpelling()
// FIXME: We don't call this on the Mac, and it should remove misspelling markers around the
// learned word, see <rdar://problem/5396072>.
- String text = frame()->selectedText();
+ String text = selectedText();
ASSERT(text.length());
client()->learnWord(text);
}
@@ -2149,7 +2152,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
bool Editor::isSelectionMisspelled()
{
- String selectedString = frame()->selectedText();
+ String selectedString = selectedText();
int length = selectedString.length();
if (!length)
return false;
@@ -2245,7 +2248,7 @@ Vector<String> Editor::guessesForUngrammaticalSelection()
Vector<String> Editor::guessesForMisspelledSelection()
{
- String selectedString = frame()->selectedText();
+ String selectedString = selectedText();
ASSERT(selectedString.length());
Vector<String> guesses;
@@ -3136,4 +3139,456 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, b
client()->respondToChangedSelection();
}
+String Editor::selectedText() const
+{
+ return plainText(m_frame->selection()->toNormalizedRange().get());
+}
+
+IntRect Editor::firstRectForRange(Range* range) const
+{
+ int extraWidthToEndOfLine = 0;
+ ASSERT(range->startContainer());
+ ASSERT(range->endContainer());
+
+ InlineBox* startInlineBox;
+ int startCaretOffset;
+ Position startPosition = VisiblePosition(range->startPosition()).deepEquivalent();
+ if (startPosition.isNull())
+ return IntRect();
+ startPosition.getInlineBoxAndOffset(DOWNSTREAM, startInlineBox, startCaretOffset);
+
+ RenderObject* startRenderer = startPosition.node()->renderer();
+ ASSERT(startRenderer);
+ IntRect startCaretRect = startRenderer->localCaretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine);
+ if (startCaretRect != IntRect())
+ startCaretRect = startRenderer->localToAbsoluteQuad(FloatRect(startCaretRect)).enclosingBoundingBox();
+
+ InlineBox* endInlineBox;
+ int endCaretOffset;
+ Position endPosition = VisiblePosition(range->endPosition()).deepEquivalent();
+ if (endPosition.isNull())
+ return IntRect();
+ endPosition.getInlineBoxAndOffset(UPSTREAM, endInlineBox, endCaretOffset);
+
+ RenderObject* endRenderer = endPosition.node()->renderer();
+ ASSERT(endRenderer);
+ IntRect endCaretRect = endRenderer->localCaretRect(endInlineBox, endCaretOffset);
+ if (endCaretRect != IntRect())
+ endCaretRect = endRenderer->localToAbsoluteQuad(FloatRect(endCaretRect)).enclosingBoundingBox();
+
+ if (startCaretRect.y() == endCaretRect.y()) {
+ // start and end are on the same line
+ return IntRect(min(startCaretRect.x(), endCaretRect.x()),
+ startCaretRect.y(),
+ abs(endCaretRect.x() - startCaretRect.x()),
+ max(startCaretRect.height(), endCaretRect.height()));
+ }
+
+ // start and end aren't on the same line, so go from start to the end of its line
+ return IntRect(startCaretRect.x(),
+ startCaretRect.y(),
+ startCaretRect.width() + extraWidthToEndOfLine,
+ startCaretRect.height());
+}
+
+bool Editor::shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity affinity, bool stillSelecting) const
+{
+ return client()->shouldChangeSelectedRange(oldSelection.toNormalizedRange().get(), newSelection.toNormalizedRange().get(), affinity, stillSelecting);
+}
+
+void Editor::computeAndSetTypingStyle(CSSStyleDeclaration *style, EditAction editingAction)
+{
+ if (!style || !style->length()) {
+ m_frame->clearTypingStyle();
+ return;
+ }
+
+ // Calculate the current typing style.
+ RefPtr<CSSMutableStyleDeclaration> mutableStyle = style->makeMutable();
+ if (m_frame->typingStyle()) {
+ m_frame->typingStyle()->merge(mutableStyle.get());
+ mutableStyle = m_frame->typingStyle();
+ }
+
+ RefPtr<CSSValue> unicodeBidi;
+ RefPtr<CSSValue> direction;
+ if (editingAction == EditActionSetWritingDirection) {
+ unicodeBidi = mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi);
+ direction = mutableStyle->getPropertyCSSValue(CSSPropertyDirection);
+ }
+
+ Node* node = m_frame->selection()->selection().visibleStart().deepEquivalent().node();
+ computedStyle(node)->diff(mutableStyle.get());
+
+ if (editingAction == EditActionSetWritingDirection && unicodeBidi) {
+ ASSERT(unicodeBidi->isPrimitiveValue());
+ mutableStyle->setProperty(CSSPropertyUnicodeBidi, static_cast<CSSPrimitiveValue*>(unicodeBidi.get())->getIdent());
+ if (direction) {
+ ASSERT(direction->isPrimitiveValue());
+ mutableStyle->setProperty(CSSPropertyDirection, static_cast<CSSPrimitiveValue*>(direction.get())->getIdent());
+ }
+ }
+
+ // Handle block styles, substracting these from the typing style.
+ RefPtr<CSSMutableStyleDeclaration> blockStyle = mutableStyle->copyBlockProperties();
+ blockStyle->diff(mutableStyle.get());
+ if (blockStyle->length() > 0)
+ applyCommand(ApplyStyleCommand::create(m_frame->document(), blockStyle.get(), editingAction));
+
+ // Set the remaining style as the typing style.
+ m_frame->setTypingStyle(mutableStyle.get());
+}
+
+PassRefPtr<CSSComputedStyleDeclaration> Editor::selectionComputedStyle(Node*& nodeToRemove) const
+{
+ nodeToRemove = 0;
+
+ if (m_frame->selection()->isNone())
+ return 0;
+
+ RefPtr<Range> range(m_frame->selection()->toNormalizedRange());
+ Position position = range->editingStartPosition();
+
+ // If the pos is at the end of a text node, then this node is not fully selected.
+ // Move it to the next deep equivalent position to avoid removing the style from this node.
+ // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead.
+ // We only do this for range because caret at Position("hello", 5) in <b>hello</b>world should give you font-weight: bold.
+ Node* positionNode = position.containerNode();
+ if (m_frame->selection()->isRange() && positionNode && positionNode->isTextNode() && position.computeOffsetInContainerNode() == positionNode->maxCharacterOffset())
+ position = nextVisuallyDistinctCandidate(position);
+
+ Element* element = position.element();
+ if (!element)
+ return 0;
+
+ RefPtr<Element> styleElement = element;
+ ExceptionCode ec = 0;
+
+ if (m_frame->typingStyle()) {
+ styleElement = m_frame->document()->createElement(spanTag, false);
+
+ styleElement->setAttribute(styleAttr, m_frame->typingStyle()->cssText().impl(), ec);
+ ASSERT(!ec);
+
+ styleElement->appendChild(m_frame->document()->createEditingTextNode(""), ec);
+ ASSERT(!ec);
+
+ if (element->renderer() && element->renderer()->canHaveChildren())
+ element->appendChild(styleElement, ec);
+ else {
+ Node* parent = element->parent();
+ Node* next = element->nextSibling();
+
+ if (next)
+ parent->insertBefore(styleElement, next, ec);
+ else
+ parent->appendChild(styleElement, ec);
+ }
+ ASSERT(!ec);
+
+ nodeToRemove = styleElement.get();
+ }
+
+ return computedStyle(styleElement.release());
+}
+
+void Editor::textFieldDidBeginEditing(Element* e)
+{
+ if (client())
+ client()->textFieldDidBeginEditing(e);
+}
+
+void Editor::textFieldDidEndEditing(Element* e)
+{
+ if (client())
+ client()->textFieldDidEndEditing(e);
+}
+
+void Editor::textDidChangeInTextField(Element* e)
+{
+ if (client())
+ client()->textDidChangeInTextField(e);
+}
+
+bool Editor::doTextFieldCommandFromEvent(Element* e, KeyboardEvent* ke)
+{
+ if (client())
+ return client()->doTextFieldCommandFromEvent(e, ke);
+
+ return false;
+}
+
+void Editor::textWillBeDeletedInTextField(Element* input)
+{
+ if (client())
+ client()->textWillBeDeletedInTextField(input);
+}
+
+void Editor::textDidChangeInTextArea(Element* e)
+{
+ if (client())
+ client()->textDidChangeInTextArea(e);
+}
+
+void Editor::applyEditingStyleToBodyElement() const
+{
+ RefPtr<NodeList> list = m_frame->document()->getElementsByTagName("body");
+ unsigned len = list->length();
+ for (unsigned i = 0; i < len; i++)
+ applyEditingStyleToElement(static_cast<Element*>(list->item(i)));
+}
+
+void Editor::applyEditingStyleToElement(Element* element) const
+{
+ if (!element)
+ return;
+
+ CSSStyleDeclaration* style = element->style();
+ ASSERT(style);
+
+ ExceptionCode ec = 0;
+ style->setProperty(CSSPropertyWordWrap, "break-word", false, ec);
+ ASSERT(!ec);
+ style->setProperty(CSSPropertyWebkitNbspMode, "space", false, ec);
+ ASSERT(!ec);
+ style->setProperty(CSSPropertyWebkitLineBreak, "after-white-space", false, ec);
+ ASSERT(!ec);
+}
+
+RenderStyle* Editor::styleForSelectionStart(Node *&nodeToRemove) const
+{
+ nodeToRemove = 0;
+
+ if (m_frame->selection()->isNone())
+ return 0;
+
+ Position position = m_frame->selection()->selection().visibleStart().deepEquivalent();
+ if (!position.isCandidate())
+ return 0;
+ if (!position.node())
+ return 0;
+
+ if (!m_frame->typingStyle())
+ return position.node()->renderer()->style();
+
+ RefPtr<Element> styleElement = m_frame->document()->createElement(spanTag, false);
+
+ ExceptionCode ec = 0;
+ String styleText = m_frame->typingStyle()->cssText() + " display: inline";
+ styleElement->setAttribute(styleAttr, styleText.impl(), ec);
+ ASSERT(!ec);
+
+ styleElement->appendChild(m_frame->document()->createEditingTextNode(""), ec);
+ ASSERT(!ec);
+
+ position.node()->parentNode()->appendChild(styleElement, ec);
+ ASSERT(!ec);
+
+ nodeToRemove = styleElement.get();
+ return styleElement->renderer() ? styleElement->renderer()->style() : 0;
+}
+
+// Searches from the beginning of the document if nothing is selected.
+bool Editor::findString(const String& target, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection)
+{
+ if (target.isEmpty())
+ return false;
+
+ if (m_frame->excludeFromTextSearch())
+ return false;
+
+ // Start from an edge of the selection, if there's a selection that's not in shadow content. Which edge
+ // is used depends on whether we're searching forward or backward, and whether startInSelection is set.
+ RefPtr<Range> searchRange(rangeOfContents(m_frame->document()));
+ VisibleSelection selection = m_frame->selection()->selection();
+
+ if (forward)
+ setStart(searchRange.get(), startInSelection ? selection.visibleStart() : selection.visibleEnd());
+ else
+ setEnd(searchRange.get(), startInSelection ? selection.visibleEnd() : selection.visibleStart());
+
+ RefPtr<Node> shadowTreeRoot = selection.shadowTreeRootNode();
+ if (shadowTreeRoot) {
+ ExceptionCode ec = 0;
+ if (forward)
+ searchRange->setEnd(shadowTreeRoot.get(), shadowTreeRoot->childNodeCount(), ec);
+ else
+ searchRange->setStart(shadowTreeRoot.get(), 0, ec);
+ }
+
+ RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, forward, caseFlag));
+ // If we started in the selection and the found range exactly matches the existing selection, find again.
+ // Build a selection with the found range to remove collapsed whitespace.
+ // Compare ranges instead of selection objects to ignore the way that the current selection was made.
+ if (startInSelection && areRangesEqual(VisibleSelection(resultRange.get()).toNormalizedRange().get(), selection.toNormalizedRange().get())) {
+ searchRange = rangeOfContents(m_frame->document());
+ if (forward)
+ setStart(searchRange.get(), selection.visibleEnd());
+ else
+ setEnd(searchRange.get(), selection.visibleStart());
+
+ if (shadowTreeRoot) {
+ ExceptionCode ec = 0;
+ if (forward)
+ searchRange->setEnd(shadowTreeRoot.get(), shadowTreeRoot->childNodeCount(), ec);
+ else
+ searchRange->setStart(shadowTreeRoot.get(), 0, ec);
+ }
+
+ resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
+ }
+
+ ExceptionCode exception = 0;
+
+ // If nothing was found in the shadow tree, search in main content following the shadow tree.
+ if (resultRange->collapsed(exception) && shadowTreeRoot) {
+ searchRange = rangeOfContents(m_frame->document());
+ if (forward)
+ searchRange->setStartAfter(shadowTreeRoot->shadowParentNode(), exception);
+ else
+ searchRange->setEndBefore(shadowTreeRoot->shadowParentNode(), exception);
+
+ resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
+ }
+
+ if (!insideVisibleArea(resultRange.get())) {
+ resultRange = nextVisibleRange(resultRange.get(), target, forward, caseFlag, wrapFlag);
+ if (!resultRange)
+ return false;
+ }
+
+ // If we didn't find anything and we're wrapping, search again in the entire document (this will
+ // redundantly re-search the area already searched in some cases).
+ if (resultRange->collapsed(exception) && wrapFlag) {
+ searchRange = rangeOfContents(m_frame->document());
+ resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
+ // We used to return false here if we ended up with the same range that we started with
+ // (e.g., the selection was already the only instance of this text). But we decided that
+ // this should be a success case instead, so we'll just fall through in that case.
+ }
+
+ if (resultRange->collapsed(exception))
+ return false;
+
+ m_frame->selection()->setSelection(VisibleSelection(resultRange.get(), DOWNSTREAM));
+ m_frame->revealSelection();
+ return true;
+}
+
+unsigned Editor::countMatchesForText(const String& target, bool caseFlag, unsigned limit, bool markMatches)
+{
+ if (target.isEmpty())
+ return 0;
+
+ RefPtr<Range> searchRange(rangeOfContents(m_frame->document()));
+
+ ExceptionCode exception = 0;
+ unsigned matchCount = 0;
+ do {
+ RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, caseFlag));
+ if (resultRange->collapsed(exception)) {
+ if (!resultRange->startContainer()->isInShadowTree())
+ break;
+
+ searchRange = rangeOfContents(m_frame->document());
+ searchRange->setStartAfter(resultRange->startContainer()->shadowAncestorNode(), exception);
+ continue;
+ }
+
+ // Only treat the result as a match if it is visible
+ if (insideVisibleArea(resultRange.get())) {
+ ++matchCount;
+ if (markMatches)
+ m_frame->document()->markers()->addMarker(resultRange.get(), DocumentMarker::TextMatch);
+ }
+
+ // Stop looking if we hit the specified limit. A limit of 0 means no limit.
+ if (limit > 0 && matchCount >= limit)
+ break;
+
+ // Set the new start for the search range to be the end of the previous
+ // result range. There is no need to use a VisiblePosition here,
+ // since findPlainText will use a TextIterator to go over the visible
+ // text nodes.
+ searchRange->setStart(resultRange->endContainer(exception), resultRange->endOffset(exception), exception);
+
+ Node* shadowTreeRoot = searchRange->shadowTreeRootNode();
+ if (searchRange->collapsed(exception) && shadowTreeRoot)
+ searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), exception);
+ } while (true);
+
+ if (markMatches) {
+ // Do a "fake" paint in order to execute the code that computes the rendered rect for each text match.
+ if (m_frame->view() && m_frame->contentRenderer()) {
+ m_frame->document()->updateLayout(); // Ensure layout is up to date.
+ IntRect visibleRect = m_frame->view()->visibleContentRect();
+ if (!visibleRect.isEmpty()) {
+ GraphicsContext context((PlatformGraphicsContext*)0);
+ context.setPaintingDisabled(true);
+ m_frame->view()->paintContents(&context, visibleRect);
+ }
+ }
+ }
+
+ return matchCount;
+}
+
+void Editor::setMarkedTextMatchesAreHighlighted(bool flag)
+{
+ if (flag == m_areMarkedTextMatchesHighlighted)
+ return;
+
+ m_areMarkedTextMatchesHighlighted = flag;
+ m_frame->document()->markers()->repaintMarkers(DocumentMarker::TextMatch);
+}
+
+void Editor::respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping)
+{
+ bool isContinuousSpellCheckingEnabled = this->isContinuousSpellCheckingEnabled();
+ bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled && isGrammarCheckingEnabled();
+ if (isContinuousSpellCheckingEnabled) {
+ VisibleSelection newAdjacentWords;
+ VisibleSelection newSelectedSentence;
+ bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+ if (m_frame->selection()->selection().isContentEditable() || caretBrowsing) {
+ VisiblePosition newStart(m_frame->selection()->selection().visibleStart());
+ newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
+ if (isContinuousGrammarCheckingEnabled)
+ newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart));
+ }
+
+ // When typing we check spelling elsewhere, so don't redo it here.
+ // If this is a change in selection resulting from a delete operation,
+ // oldSelection may no longer be in the document.
+ if (closeTyping && oldSelection.isContentEditable() && oldSelection.start().node() && oldSelection.start().node()->inDocument()) {
+ VisiblePosition oldStart(oldSelection.visibleStart());
+ VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
+ if (oldAdjacentWords != newAdjacentWords) {
+ if (isContinuousGrammarCheckingEnabled) {
+ VisibleSelection oldSelectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart));
+ markMisspellingsAndBadGrammar(oldAdjacentWords, oldSelectedSentence != newSelectedSentence, oldSelectedSentence);
+ } else
+ markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
+ }
+ }
+
+ // This only erases markers that are in the first unit (word or sentence) of the selection.
+ // Perhaps peculiar, but it matches AppKit.
+ if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) {
+ m_frame->document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
+ m_frame->document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Replacement);
+ }
+ if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
+ m_frame->document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
+ }
+
+ // When continuous spell checking is off, existing markers disappear after the selection changes.
+ if (!isContinuousSpellCheckingEnabled)
+ m_frame->document()->markers()->removeMarkers(DocumentMarker::Spelling);
+ if (!isContinuousGrammarCheckingEnabled)
+ m_frame->document()->markers()->removeMarkers(DocumentMarker::Grammar);
+
+ respondToChangedSelection(oldSelection);
+}
+
} // namespace WebCore
diff --git a/WebCore/editing/Editor.h b/WebCore/editing/Editor.h
index 79552b4..2c06cea 100644
--- a/WebCore/editing/Editor.h
+++ b/WebCore/editing/Editor.h
@@ -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
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index 9ed1f6b..4f53ae9 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -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)
diff --git a/WebCore/editing/SelectionController.cpp b/WebCore/editing/SelectionController.cpp
index 97dde55..99b2224 100644
--- a/WebCore/editing/SelectionController.cpp
+++ b/WebCore/editing/SelectionController.cpp
@@ -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;
diff --git a/WebCore/editing/mac/EditorMac.mm b/WebCore/editing/mac/EditorMac.mm
index 143db37..ac658c8 100644
--- a/WebCore/editing/mac/EditorMac.mm
+++ b/WebCore/editing/mac/EditorMac.mm
@@ -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
diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp
index b339b45..4ae68cc 100644
--- a/WebCore/html/HTMLInputElement.cpp
+++ b/WebCore/html/HTMLInputElement.cpp
@@ -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;
}
diff --git a/WebCore/page/ContextMenuController.cpp b/WebCore/page/ContextMenuController.cpp
index d384b02..4ce17bd 100644
--- a/WebCore/page/ContextMenuController.cpp
+++ b/WebCore/page/ContextMenuController.cpp
@@ -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);
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index bf26ce4..15f3ed1 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -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
diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp
index 2b41142..c623bf6 100644
--- a/WebCore/page/DragController.cpp
+++ b/WebCore/page/DragController.cpp
@@ -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);
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 950e857..bc57b4c 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -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());
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 661f2d0..8c546ce 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -144,7 +144,6 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader
#if ENABLE(ORIENTATION_EVENTS)
, m_orientation(0)
#endif
- , m_highlightTextMatches(false)
, m_inViewSourceMode(false)
, m_isDisconnected(false)
, m_excludeFromTextSearch(false)
@@ -287,58 +286,6 @@ Settings* Frame::settings() const
return m_page ? m_page->settings() : 0;
}
-String Frame::selectedText() const
-{
- return plainText(selection()->toNormalizedRange().get());
-}
-
-IntRect Frame::firstRectForRange(Range* range) const
-{
- int extraWidthToEndOfLine = 0;
- ASSERT(range->startContainer());
- ASSERT(range->endContainer());
-
- InlineBox* startInlineBox;
- int startCaretOffset;
- Position startPosition = VisiblePosition(range->startPosition()).deepEquivalent();
- if (startPosition.isNull())
- return IntRect();
- startPosition.getInlineBoxAndOffset(DOWNSTREAM, startInlineBox, startCaretOffset);
-
- RenderObject* startRenderer = startPosition.node()->renderer();
- ASSERT(startRenderer);
- IntRect startCaretRect = startRenderer->localCaretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine);
- if (startCaretRect != IntRect())
- startCaretRect = startRenderer->localToAbsoluteQuad(FloatRect(startCaretRect)).enclosingBoundingBox();
-
- InlineBox* endInlineBox;
- int endCaretOffset;
- Position endPosition = VisiblePosition(range->endPosition()).deepEquivalent();
- if (endPosition.isNull())
- return IntRect();
- endPosition.getInlineBoxAndOffset(UPSTREAM, endInlineBox, endCaretOffset);
-
- RenderObject* endRenderer = endPosition.node()->renderer();
- ASSERT(endRenderer);
- IntRect endCaretRect = endRenderer->localCaretRect(endInlineBox, endCaretOffset);
- if (endCaretRect != IntRect())
- endCaretRect = endRenderer->localToAbsoluteQuad(FloatRect(endCaretRect)).enclosingBoundingBox();
-
- if (startCaretRect.y() == endCaretRect.y()) {
- // start and end are on the same line
- return IntRect(min(startCaretRect.x(), endCaretRect.x()),
- startCaretRect.y(),
- abs(endCaretRect.x() - startCaretRect.x()),
- max(startCaretRect.height(), endCaretRect.height()));
- }
-
- // start and end aren't on the same line, so go from start to the end of its line
- return IntRect(startCaretRect.x(),
- startCaretRect.y(),
- startCaretRect.width() + extraWidthToEndOfLine,
- startCaretRect.height());
-}
-
TextGranularity Frame::selectionGranularity() const
{
return m_selectionController.granularity();
@@ -664,17 +611,6 @@ void Frame::injectUserScriptsForWorld(DOMWrapperWorld* world, const UserScriptVe
}
}
-bool Frame::shouldChangeSelection(const VisibleSelection& newSelection) const
-{
- return shouldChangeSelection(selection()->selection(), newSelection, newSelection.affinity(), false);
-}
-
-bool Frame::shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity affinity, bool stillSelecting) const
-{
- return editor()->client()->shouldChangeSelectedRange(oldSelection.toNormalizedRange().get(), newSelection.toNormalizedRange().get(),
- affinity, stillSelecting);
-}
-
bool Frame::shouldDeleteSelection(const VisibleSelection& selection) const
{
return editor()->client()->shouldDeleteRange(selection.toNormalizedRange().get());
@@ -692,165 +628,6 @@ void Frame::setTypingStyle(CSSMutableStyleDeclaration *style)
m_typingStyle = style;
}
-void Frame::computeAndSetTypingStyle(CSSStyleDeclaration *style, EditAction editingAction)
-{
- if (!style || !style->length()) {
- clearTypingStyle();
- return;
- }
-
- // Calculate the current typing style.
- RefPtr<CSSMutableStyleDeclaration> mutableStyle = style->makeMutable();
- if (typingStyle()) {
- typingStyle()->merge(mutableStyle.get());
- mutableStyle = typingStyle();
- }
-
- RefPtr<CSSValue> unicodeBidi;
- RefPtr<CSSValue> direction;
- if (editingAction == EditActionSetWritingDirection) {
- unicodeBidi = mutableStyle->getPropertyCSSValue(CSSPropertyUnicodeBidi);
- direction = mutableStyle->getPropertyCSSValue(CSSPropertyDirection);
- }
-
- Node* node = selection()->selection().visibleStart().deepEquivalent().node();
- computedStyle(node)->diff(mutableStyle.get());
-
- if (editingAction == EditActionSetWritingDirection && unicodeBidi) {
- ASSERT(unicodeBidi->isPrimitiveValue());
- mutableStyle->setProperty(CSSPropertyUnicodeBidi, static_cast<CSSPrimitiveValue*>(unicodeBidi.get())->getIdent());
- if (direction) {
- ASSERT(direction->isPrimitiveValue());
- mutableStyle->setProperty(CSSPropertyDirection, static_cast<CSSPrimitiveValue*>(direction.get())->getIdent());
- }
- }
-
- // Handle block styles, substracting these from the typing style.
- RefPtr<CSSMutableStyleDeclaration> blockStyle = mutableStyle->copyBlockProperties();
- blockStyle->diff(mutableStyle.get());
- if (blockStyle->length() > 0)
- applyCommand(ApplyStyleCommand::create(document(), blockStyle.get(), editingAction));
-
- // Set the remaining style as the typing style.
- m_typingStyle = mutableStyle.release();
-}
-
-PassRefPtr<CSSComputedStyleDeclaration> Frame::selectionComputedStyle(Node*& nodeToRemove) const
-{
- nodeToRemove = 0;
-
- if (selection()->isNone())
- return 0;
-
- RefPtr<Range> range(selection()->toNormalizedRange());
- Position pos = range->editingStartPosition();
-
- // If the pos is at the end of a text node, then this node is not fully selected.
- // Move it to the next deep equivalent position to avoid removing the style from this node.
- // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we want Position("world", 0) instead.
- // We only do this for range because caret at Position("hello", 5) in <b>hello</b>world should give you font-weight: bold.
- Node* posNode = pos.containerNode();
- if (selection()->isRange() && posNode && posNode->isTextNode() && pos.computeOffsetInContainerNode() == posNode->maxCharacterOffset())
- pos = nextVisuallyDistinctCandidate(pos);
-
- Element *elem = pos.element();
- if (!elem)
- return 0;
-
- RefPtr<Element> styleElement = elem;
- ExceptionCode ec = 0;
-
- if (m_typingStyle) {
- styleElement = document()->createElement(spanTag, false);
-
- styleElement->setAttribute(styleAttr, m_typingStyle->cssText().impl(), ec);
- ASSERT(!ec);
-
- styleElement->appendChild(document()->createEditingTextNode(""), ec);
- ASSERT(!ec);
-
- if (elem->renderer() && elem->renderer()->canHaveChildren()) {
- elem->appendChild(styleElement, ec);
- } else {
- Node *parent = elem->parent();
- Node *next = elem->nextSibling();
-
- if (next)
- parent->insertBefore(styleElement, next, ec);
- else
- parent->appendChild(styleElement, ec);
- }
- ASSERT(!ec);
-
- nodeToRemove = styleElement.get();
- }
-
- return computedStyle(styleElement.release());
-}
-
-void Frame::textFieldDidBeginEditing(Element* e)
-{
- if (editor()->client())
- editor()->client()->textFieldDidBeginEditing(e);
-}
-
-void Frame::textFieldDidEndEditing(Element* e)
-{
- if (editor()->client())
- editor()->client()->textFieldDidEndEditing(e);
-}
-
-void Frame::textDidChangeInTextField(Element* e)
-{
- if (editor()->client())
- editor()->client()->textDidChangeInTextField(e);
-}
-
-bool Frame::doTextFieldCommandFromEvent(Element* e, KeyboardEvent* ke)
-{
- if (editor()->client())
- return editor()->client()->doTextFieldCommandFromEvent(e, ke);
-
- return false;
-}
-
-void Frame::textWillBeDeletedInTextField(Element* input)
-{
- if (editor()->client())
- editor()->client()->textWillBeDeletedInTextField(input);
-}
-
-void Frame::textDidChangeInTextArea(Element* e)
-{
- if (editor()->client())
- editor()->client()->textDidChangeInTextArea(e);
-}
-
-void Frame::applyEditingStyleToBodyElement() const
-{
- RefPtr<NodeList> list = m_doc->getElementsByTagName("body");
- unsigned len = list->length();
- for (unsigned i = 0; i < len; i++)
- applyEditingStyleToElement(static_cast<Element*>(list->item(i)));
-}
-
-void Frame::applyEditingStyleToElement(Element* element) const
-{
- if (!element)
- return;
-
- CSSStyleDeclaration* style = element->style();
- ASSERT(style);
-
- ExceptionCode ec = 0;
- style->setProperty(CSSPropertyWordWrap, "break-word", false, ec);
- ASSERT(!ec);
- style->setProperty(CSSPropertyWebkitNbspMode, "space", false, ec);
- ASSERT(!ec);
- style->setProperty(CSSPropertyWebkitLineBreak, "after-white-space", false, ec);
- ASSERT(!ec);
-}
-
#ifndef NDEBUG
static HashSet<Frame*>& keepAliveSet()
{
@@ -1076,40 +853,6 @@ void Frame::clearTimers()
clearTimers(m_view.get(), document());
}
-RenderStyle *Frame::styleForSelectionStart(Node *&nodeToRemove) const
-{
- nodeToRemove = 0;
-
- if (selection()->isNone())
- return 0;
-
- Position pos = selection()->selection().visibleStart().deepEquivalent();
- if (!pos.isCandidate())
- return 0;
- Node *node = pos.node();
- if (!node)
- return 0;
-
- if (!m_typingStyle)
- return node->renderer()->style();
-
- RefPtr<Element> styleElement = document()->createElement(spanTag, false);
-
- ExceptionCode ec = 0;
- String styleText = m_typingStyle->cssText() + " display: inline";
- styleElement->setAttribute(styleAttr, styleText.impl(), ec);
- ASSERT(!ec);
-
- styleElement->appendChild(document()->createEditingTextNode(""), ec);
- ASSERT(!ec);
-
- node->parentNode()->appendChild(styleElement, ec);
- ASSERT(!ec);
-
- nodeToRemove = styleElement.get();
- return styleElement->renderer() ? styleElement->renderer()->style() : 0;
-}
-
void Frame::setSelectionFromNone()
{
// Put a caret inside the body if the entire frame is editable (either the
@@ -1126,160 +869,6 @@ void Frame::setSelectionFromNone()
selection()->setSelection(VisibleSelection(Position(node, 0), DOWNSTREAM));
}
-// Searches from the beginning of the document if nothing is selected.
-bool Frame::findString(const String& target, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection)
-{
- if (target.isEmpty())
- return false;
-
- if (excludeFromTextSearch())
- return false;
-
- // Start from an edge of the selection, if there's a selection that's not in shadow content. Which edge
- // is used depends on whether we're searching forward or backward, and whether startInSelection is set.
- RefPtr<Range> searchRange(rangeOfContents(document()));
- VisibleSelection selection = this->selection()->selection();
-
- if (forward)
- setStart(searchRange.get(), startInSelection ? selection.visibleStart() : selection.visibleEnd());
- else
- setEnd(searchRange.get(), startInSelection ? selection.visibleEnd() : selection.visibleStart());
-
- Node* shadowTreeRoot = selection.shadowTreeRootNode();
- if (shadowTreeRoot) {
- ExceptionCode ec = 0;
- if (forward)
- searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), ec);
- else
- searchRange->setStart(shadowTreeRoot, 0, ec);
- }
-
- RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, forward, caseFlag));
- // If we started in the selection and the found range exactly matches the existing selection, find again.
- // Build a selection with the found range to remove collapsed whitespace.
- // Compare ranges instead of selection objects to ignore the way that the current selection was made.
- if (startInSelection && areRangesEqual(VisibleSelection(resultRange.get()).toNormalizedRange().get(), selection.toNormalizedRange().get())) {
- searchRange = rangeOfContents(document());
- if (forward)
- setStart(searchRange.get(), selection.visibleEnd());
- else
- setEnd(searchRange.get(), selection.visibleStart());
-
- if (shadowTreeRoot) {
- ExceptionCode ec = 0;
- if (forward)
- searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), ec);
- else
- searchRange->setStart(shadowTreeRoot, 0, ec);
- }
-
- resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
- }
-
- ExceptionCode exception = 0;
-
- // If nothing was found in the shadow tree, search in main content following the shadow tree.
- if (resultRange->collapsed(exception) && shadowTreeRoot) {
- searchRange = rangeOfContents(document());
- if (forward)
- searchRange->setStartAfter(shadowTreeRoot->shadowParentNode(), exception);
- else
- searchRange->setEndBefore(shadowTreeRoot->shadowParentNode(), exception);
-
- resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
- }
-
- if (!editor()->insideVisibleArea(resultRange.get())) {
- resultRange = editor()->nextVisibleRange(resultRange.get(), target, forward, caseFlag, wrapFlag);
- if (!resultRange)
- return false;
- }
-
- // If we didn't find anything and we're wrapping, search again in the entire document (this will
- // redundantly re-search the area already searched in some cases).
- if (resultRange->collapsed(exception) && wrapFlag) {
- searchRange = rangeOfContents(document());
- resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
- // We used to return false here if we ended up with the same range that we started with
- // (e.g., the selection was already the only instance of this text). But we decided that
- // this should be a success case instead, so we'll just fall through in that case.
- }
-
- if (resultRange->collapsed(exception))
- return false;
-
- this->selection()->setSelection(VisibleSelection(resultRange.get(), DOWNSTREAM));
- revealSelection();
- return true;
-}
-
-unsigned Frame::countMatchesForText(const String& target, bool caseFlag, unsigned limit, bool markMatches)
-{
- if (target.isEmpty())
- return 0;
-
- RefPtr<Range> searchRange(rangeOfContents(document()));
-
- ExceptionCode exception = 0;
- unsigned matchCount = 0;
- do {
- RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, true, caseFlag));
- if (resultRange->collapsed(exception)) {
- if (!resultRange->startContainer()->isInShadowTree())
- break;
-
- searchRange = rangeOfContents(document());
- searchRange->setStartAfter(resultRange->startContainer()->shadowAncestorNode(), exception);
- continue;
- }
-
- // Only treat the result as a match if it is visible
- if (editor()->insideVisibleArea(resultRange.get())) {
- ++matchCount;
- if (markMatches)
- document()->markers()->addMarker(resultRange.get(), DocumentMarker::TextMatch);
- }
-
- // Stop looking if we hit the specified limit. A limit of 0 means no limit.
- if (limit > 0 && matchCount >= limit)
- break;
-
- // Set the new start for the search range to be the end of the previous
- // result range. There is no need to use a VisiblePosition here,
- // since findPlainText will use a TextIterator to go over the visible
- // text nodes.
- searchRange->setStart(resultRange->endContainer(exception), resultRange->endOffset(exception), exception);
-
- Node* shadowTreeRoot = searchRange->shadowTreeRootNode();
- if (searchRange->collapsed(exception) && shadowTreeRoot)
- searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), exception);
- } while (true);
-
- if (markMatches) {
- // Do a "fake" paint in order to execute the code that computes the rendered rect for each text match.
- if (m_view && contentRenderer()) {
- document()->updateLayout(); // Ensure layout is up to date.
- IntRect visibleRect = m_view->visibleContentRect();
- if (!visibleRect.isEmpty()) {
- GraphicsContext context((PlatformGraphicsContext*)0);
- context.setPaintingDisabled(true);
- m_view->paintContents(&context, visibleRect);
- }
- }
- }
-
- return matchCount;
-}
-
-void Frame::setMarkedTextMatchesAreHighlighted(bool flag)
-{
- if (flag == m_highlightTextMatches)
- return;
-
- m_highlightTextMatches = flag;
- document()->markers()->repaintMarkers(DocumentMarker::TextMatch);
-}
-
void Frame::setDOMWindow(DOMWindow* domWindow)
{
if (m_domWindow) {
@@ -1390,53 +979,9 @@ String Frame::documentTypeString() const
return String();
}
-void Frame::respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping)
+bool Frame::shouldChangeSelection(const VisibleSelection& newSelection) const
{
- bool isContinuousSpellCheckingEnabled = editor()->isContinuousSpellCheckingEnabled();
- bool isContinuousGrammarCheckingEnabled = isContinuousSpellCheckingEnabled && editor()->isGrammarCheckingEnabled();
- if (isContinuousSpellCheckingEnabled) {
- VisibleSelection newAdjacentWords;
- VisibleSelection newSelectedSentence;
- bool caretBrowsing = settings() && settings()->caretBrowsingEnabled();
- if (selection()->selection().isContentEditable() || caretBrowsing) {
- VisiblePosition newStart(selection()->selection().visibleStart());
- newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
- if (isContinuousGrammarCheckingEnabled)
- newSelectedSentence = VisibleSelection(startOfSentence(newStart), endOfSentence(newStart));
- }
-
- // When typing we check spelling elsewhere, so don't redo it here.
- // If this is a change in selection resulting from a delete operation,
- // oldSelection may no longer be in the document.
- if (closeTyping && oldSelection.isContentEditable() && oldSelection.start().node() && oldSelection.start().node()->inDocument()) {
- VisiblePosition oldStart(oldSelection.visibleStart());
- VisibleSelection oldAdjacentWords = VisibleSelection(startOfWord(oldStart, LeftWordIfOnBoundary), endOfWord(oldStart, RightWordIfOnBoundary));
- if (oldAdjacentWords != newAdjacentWords) {
- if (isContinuousGrammarCheckingEnabled) {
- VisibleSelection oldSelectedSentence = VisibleSelection(startOfSentence(oldStart), endOfSentence(oldStart));
- editor()->markMisspellingsAndBadGrammar(oldAdjacentWords, oldSelectedSentence != newSelectedSentence, oldSelectedSentence);
- } else
- editor()->markMisspellingsAndBadGrammar(oldAdjacentWords, false, oldAdjacentWords);
- }
- }
-
- // This only erases markers that are in the first unit (word or sentence) of the selection.
- // Perhaps peculiar, but it matches AppKit.
- if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) {
- document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling);
- document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Replacement);
- }
- if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange())
- document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar);
- }
-
- // When continuous spell checking is off, existing markers disappear after the selection changes.
- if (!isContinuousSpellCheckingEnabled)
- document()->markers()->removeMarkers(DocumentMarker::Spelling);
- if (!isContinuousGrammarCheckingEnabled)
- document()->markers()->removeMarkers(DocumentMarker::Grammar);
-
- editor()->respondToChangedSelection(oldSelection);
+ return editor()->shouldChangeSelection(selection()->selection(), newSelection, newSelection.affinity(), false);
}
VisiblePosition Frame::visiblePositionForPoint(const IntPoint& framePoint)
diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h
index eb3cdba..1e6b9b6 100644
--- a/WebCore/page/Frame.h
+++ b/WebCore/page/Frame.h
@@ -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(Element*);
- bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
- void textWillBeDeletedInTextField(Element* input);
- void textDidChangeInTextArea(Element*);
-
DragImageRef nodeImage(Node*);
DragImageRef dragImageForSelection();
+ private:
+ void lifeSupportTimerFired(Timer<Frame>*);
+
// === to be moved into SelectionController
public:
@@ -256,6 +221,7 @@ namespace WebCore {
Document* documentAtPoint(const IntPoint& windowPoint);
#if ENABLE(TILED_BACKING_STORE)
+ // FIXME: This should be in FrameView, not Frame.
private:
// TiledBackingStoreClient interface
@@ -281,16 +247,8 @@ namespace WebCore {
NSImage* selectionImage(bool forceBlackText = false) const;
NSImage* snapshotDragImage(Node*, NSRect* imageRect, NSRect* elementRect) const;
-
- private:
NSImage* imageFromRect(NSRect) const;
- // === to be moved into Editor
-
- public:
- NSDictionary* fontAttributesForSelectionStart() const;
- NSWritingDirection baseWritingDirectionForSelectionStart() const;
-
#endif
private:
@@ -308,7 +266,6 @@ namespace WebCore {
ScriptController m_script;
- mutable VisibleSelection m_mark;
mutable Editor m_editor;
mutable SelectionController m_selectionController;
mutable EventHandler m_eventHandler;
@@ -322,7 +279,6 @@ namespace WebCore {
int m_orientation;
#endif
- bool m_highlightTextMatches;
bool m_inViewSourceMode;
bool m_isDisconnected;
bool m_excludeFromTextSearch;
@@ -377,21 +333,6 @@ namespace WebCore {
return &m_animationController;
}
- inline const VisibleSelection& Frame::mark() const
- {
- return m_mark;
- }
-
- inline void Frame::setMark(const VisibleSelection& s)
- {
- ASSERT(!s.base().node() || s.base().node()->document() == document());
- ASSERT(!s.extent().node() || s.extent().node()->document() == document());
- ASSERT(!s.start().node() || s.start().node()->document() == document());
- ASSERT(!s.end().node() || s.end().node()->document() == document());
-
- m_mark = s;
- }
-
inline CSSMutableStyleDeclaration* Frame::typingStyle() const
{
return m_typingStyle.get();
@@ -437,11 +378,6 @@ namespace WebCore {
m_inViewSourceMode = mode;
}
- inline bool Frame::markedTextMatchesAreHighlighted() const
- {
- return m_highlightTextMatches;
- }
-
inline FrameTree* Frame::tree() const
{
return &m_treeNode;
diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp
index c407cd1..92955cc 100644
--- a/WebCore/page/Page.cpp
+++ b/WebCore/page/Page.cpp
@@ -496,7 +496,7 @@ bool Page::findString(const String& target, TextCaseSensitivity caseSensitivity,
Frame* frame = focusController()->focusedOrMainFrame();
Frame* startFrame = frame;
do {
- if (frame->findString(target, direction == FindDirectionForward, caseSensitivity == TextCaseSensitive, false, true)) {
+ if (frame->editor()->findString(target, direction == FindDirectionForward, caseSensitivity == TextCaseSensitive, false, true)) {
if (frame != startFrame)
startFrame->selection()->clear();
focusController()->setFocusedFrame(frame);
@@ -508,7 +508,7 @@ bool Page::findString(const String& target, TextCaseSensitivity caseSensitivity,
// Search contents of startFrame, on the other side of the selection that we did earlier.
// We cheat a bit and just research with wrap on
if (shouldWrap && !startFrame->selection()->isNone()) {
- bool found = startFrame->findString(target, direction == FindDirectionForward, caseSensitivity == TextCaseSensitive, true, true);
+ bool found = startFrame->editor()->findString(target, direction == FindDirectionForward, caseSensitivity == TextCaseSensitive, true, true);
focusController()->setFocusedFrame(frame);
return found;
}
@@ -525,8 +525,8 @@ unsigned int Page::markAllMatchesForText(const String& target, TextCaseSensitivi
Frame* frame = mainFrame();
do {
- frame->setMarkedTextMatchesAreHighlighted(shouldHighlight);
- matches += frame->countMatchesForText(target, caseSensitivity == TextCaseSensitive, (limit == 0) ? 0 : (limit - matches), true);
+ frame->editor()->setMarkedTextMatchesAreHighlighted(shouldHighlight);
+ matches += frame->editor()->countMatchesForText(target, caseSensitivity == TextCaseSensitive, limit ? (limit - matches) : 0, true);
frame = incrementFrame(frame, true, false);
} while (frame);
diff --git a/WebCore/page/mac/FrameMac.mm b/WebCore/page/mac/FrameMac.mm
index 0365784..510cb96 100644
--- a/WebCore/page/mac/FrameMac.mm
+++ b/WebCore/page/mac/FrameMac.mm
@@ -32,8 +32,6 @@
#import "ColorMac.h"
#import "Cursor.h"
#import "DOMInternal.h"
-#import "DocumentLoader.h"
-#import "EditorClient.h"
#import "Event.h"
#import "FrameLoaderClient.h"
#import "FrameView.h"
@@ -54,7 +52,6 @@
#import "SimpleFontData.h"
#import "WebCoreViewFactory.h"
#import "visible_units.h"
-
#import <Carbon/Carbon.h>
#import <wtf/StdLibExtras.h>
@@ -398,105 +395,6 @@ DragImageRef Frame::nodeImage(Node* node)
return result;
}
-NSDictionary* Frame::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 Frame::baseWritingDirectionForSelectionStart() const
-{
- NSWritingDirection result = NSWritingDirectionLeftToRight;
-
- Position pos = 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;
-}
-
#if ENABLE(DASHBOARD_SUPPORT)
NSMutableDictionary* Frame::dashboardRegionsDictionary()
{
diff --git a/WebCore/platform/chromium/ClipboardChromium.cpp b/WebCore/platform/chromium/ClipboardChromium.cpp
index 23508a6..aff1466 100644
--- a/WebCore/platform/chromium/ClipboardChromium.cpp
+++ b/WebCore/platform/chromium/ClipboardChromium.cpp
@@ -533,7 +533,7 @@ void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame)
m_dataObject->textHtml = createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs);
m_dataObject->htmlBaseUrl = frame->document()->url();
- String str = frame->selectedText();
+ String str = frame->editor()->selectedText();
#if OS(WINDOWS)
replaceNewlinesWithWindowsStyleNewlines(str);
#endif
diff --git a/WebCore/platform/chromium/PasteboardChromium.cpp b/WebCore/platform/chromium/PasteboardChromium.cpp
index 58373b1..ba69b00 100644
--- a/WebCore/platform/chromium/PasteboardChromium.cpp
+++ b/WebCore/platform/chromium/PasteboardChromium.cpp
@@ -84,7 +84,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs);
ExceptionCode ec = 0;
KURL url = selectedRange->startContainer(ec)->document()->url();
- String plainText = frame->selectedText();
+ String plainText = frame->editor()->selectedText();
#if OS(WINDOWS)
replaceNewlinesWithWindowsStyleNewlines(plainText);
#endif
diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp
index b2c32a4..3fe5ba1 100644
--- a/WebCore/platform/gtk/ClipboardGtk.cpp
+++ b/WebCore/platform/gtk/ClipboardGtk.cpp
@@ -348,7 +348,7 @@ void ClipboardGtk::writeRange(Range* range, Frame* frame)
{
ASSERT(range);
- m_dataObject->setText(frame->selectedText());
+ m_dataObject->setText(frame->editor()->selectedText());
m_dataObject->setMarkup(createMarkup(range, 0, AnnotateForInterchange, false, AbsoluteURLs));
if (m_clipboard)
diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp
index ddb9768..76b7bb0 100644
--- a/WebCore/platform/gtk/PasteboardGtk.cpp
+++ b/WebCore/platform/gtk/PasteboardGtk.cpp
@@ -67,7 +67,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
{
GtkClipboard* clipboard = m_helper->getClipboard(frame);
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
- dataObject->setText(frame->selectedText());
+ dataObject->setText(frame->editor()->selectedText());
dataObject->setMarkup(createMarkup(selectedRange, 0, AnnotateForInterchange, false, AbsoluteURLs));
m_helper->writeClipboardContents(clipboard);
}
diff --git a/WebCore/platform/qt/ClipboardQt.cpp b/WebCore/platform/qt/ClipboardQt.cpp
index f677d28..6cbde0c 100644
--- a/WebCore/platform/qt/ClipboardQt.cpp
+++ b/WebCore/platform/qt/ClipboardQt.cpp
@@ -315,7 +315,7 @@ void ClipboardQt::writeRange(Range* range, Frame* frame)
if (!m_writableData)
m_writableData = new QMimeData;
- QString text = frame->selectedText();
+ QString text = frame->editor()->selectedText();
text.replace(QChar(0xa0), QLatin1Char(' '));
m_writableData->setText(text);
m_writableData->setHtml(createMarkup(range, 0, AnnotateForInterchange, false, AbsoluteURLs));
diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp
index fc53124..ac54fdb 100644
--- a/WebCore/platform/qt/PasteboardQt.cpp
+++ b/WebCore/platform/qt/PasteboardQt.cpp
@@ -61,7 +61,7 @@ Pasteboard* Pasteboard::generalPasteboard()
void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
{
QMimeData* md = new QMimeData;
- QString text = frame->selectedText();
+ QString text = frame->editor()->selectedText();
text.replace(QChar(0xa0), QLatin1Char(' '));
md->setText(text);
diff --git a/WebCore/platform/win/ClipboardWin.cpp b/WebCore/platform/win/ClipboardWin.cpp
index 2915f9d..6d9930c 100644
--- a/WebCore/platform/win/ClipboardWin.cpp
+++ b/WebCore/platform/win/ClipboardWin.cpp
@@ -776,7 +776,7 @@ void ClipboardWin::writeRange(Range* selectedRange, Frame* frame)
if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
::GlobalFree(medium.hGlobal);
- String str = frame->selectedText();
+ String str = frame->editor()->selectedText();
replaceNewlinesWithWindowsStyleNewlines(str);
replaceNBSPWithSpace(str);
medium.hGlobal = createGlobalData(str);
diff --git a/WebCore/platform/win/PasteboardWin.cpp b/WebCore/platform/win/PasteboardWin.cpp
index c065f04..4b20adb 100644
--- a/WebCore/platform/win/PasteboardWin.cpp
+++ b/WebCore/platform/win/PasteboardWin.cpp
@@ -131,7 +131,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
}
// Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
- String str = frame->selectedText();
+ String str = frame->editor()->selectedText();
replaceNewlinesWithWindowsStyleNewlines(str);
replaceNBSPWithSpace(str);
if (::OpenClipboard(m_owner)) {
diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp
index c74fe1e..eb5947c 100644
--- a/WebCore/rendering/InlineTextBox.cpp
+++ b/WebCore/rendering/InlineTextBox.cpp
@@ -866,7 +866,7 @@ void InlineTextBox::paintTextMatchMarker(GraphicsContext* pt, int tx, int ty, co
renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker, markerRect);
// Optionally highlight the text
- if (renderer()->frame()->markedTextMatchesAreHighlighted()) {
+ if (renderer()->frame()->editor()->markedTextMatchesAreHighlighted()) {
Color color = marker.activeMatch ?
renderer()->theme()->platformActiveTextSearchHighlightColor() :
renderer()->theme()->platformInactiveTextSearchHighlightColor();
diff --git a/WebCore/rendering/RenderTextControlMultiLine.cpp b/WebCore/rendering/RenderTextControlMultiLine.cpp
index f89cb3f..bf7abb0 100644
--- a/WebCore/rendering/RenderTextControlMultiLine.cpp
+++ b/WebCore/rendering/RenderTextControlMultiLine.cpp
@@ -55,7 +55,7 @@ void RenderTextControlMultiLine::subtreeHasChanged()
node()->dispatchEvent(Event::create(eventNames().inputEvent, true, false));
if (Frame* frame = this->frame())
- frame->textDidChangeInTextArea(textArea);
+ frame->editor()->textDidChangeInTextArea(textArea);
}
bool RenderTextControlMultiLine::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction)
diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp
index 70d98bf..b22a799 100644
--- a/WebCore/rendering/RenderTextControlSingleLine.cpp
+++ b/WebCore/rendering/RenderTextControlSingleLine.cpp
@@ -181,12 +181,12 @@ void RenderTextControlSingleLine::subtreeHasChanged()
if (!wasChanged && node()->focused()) {
if (Frame* frame = this->frame())
- frame->textFieldDidBeginEditing(static_cast<Element*>(node()));
+ frame->editor()->textFieldDidBeginEditing(static_cast<Element*>(node()));
}
if (node()->focused()) {
if (Frame* frame = document()->frame())
- frame->textDidChangeInTextField(static_cast<Element*>(node()));
+ frame->editor()->textDidChangeInTextField(static_cast<Element*>(node()));
}
}
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 3ac5fd4..e9f6354 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-08 Darin Adler <darin at 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-09 Kenneth Russell <kbr at google.com>
Reviewed by James Robinson.
diff --git a/WebKit/chromium/src/ContextMenuClientImpl.cpp b/WebKit/chromium/src/ContextMenuClientImpl.cpp
index 1dc2ee7..ef611e1 100644
--- a/WebKit/chromium/src/ContextMenuClientImpl.cpp
+++ b/WebKit/chromium/src/ContextMenuClientImpl.cpp
@@ -98,7 +98,7 @@ static bool isASingleWord(const String& text)
static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* selectedFrame)
{
// First select from selectedText to check for multiple word selection.
- String misspelledWord = selectedFrame->selectedText().stripWhiteSpace();
+ String misspelledWord = selectedFrame->editor()->selectedText().stripWhiteSpace();
// If some texts were already selected, we don't change the selection.
if (!misspelledWord.isEmpty()) {
@@ -119,7 +119,7 @@ static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* select
return misspelledWord; // It is empty.
WebFrameImpl::selectWordAroundPosition(selectedFrame, pos);
- misspelledWord = selectedFrame->selectedText().stripWhiteSpace();
+ misspelledWord = selectedFrame->editor()->selectedText().stripWhiteSpace();
#if OS(DARWIN)
// If misspelled word is still empty, then that portion should not be
@@ -233,7 +233,7 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems(
data.frameURL = urlFromFrame(selectedFrame);
if (r.isSelected())
- data.selectedText = selectedFrame->selectedText().stripWhiteSpace();
+ data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace();
if (r.isContentEditable()) {
data.isEditable = true;
diff --git a/WebKit/chromium/src/WebFrameImpl.cpp b/WebKit/chromium/src/WebFrameImpl.cpp
index eb0db7e..a2d6a46 100644
--- a/WebKit/chromium/src/WebFrameImpl.cpp
+++ b/WebKit/chromium/src/WebFrameImpl.cpp
@@ -1356,7 +1356,7 @@ bool WebFrameImpl::find(int identifier,
}
ASSERT(frame() && frame()->view());
- bool found = frame()->findString(
+ bool found = frame()->editor()->findString(
searchText, options.forward, options.matchCase, wrapWithinFrame,
startInSelection);
if (found) {
@@ -1439,7 +1439,7 @@ void WebFrameImpl::stopFinding(bool clearSelection)
// Remove all markers for matches found and turn off the highlighting.
frame()->document()->markers()->removeMarkers(DocumentMarker::TextMatch);
- frame()->setMarkedTextMatchesAreHighlighted(false);
+ frame()->editor()->setMarkedTextMatchesAreHighlighted(false);
// Let the frame know that we don't want tickmarks or highlighting anymore.
invalidateArea(InvalidateAll);
@@ -1460,7 +1460,7 @@ void WebFrameImpl::scopeStringMatches(int identifier,
// Scoping is just about to begin.
m_scopingComplete = false;
// Clear highlighting for this frame.
- if (frame()->markedTextMatchesAreHighlighted())
+ if (frame()->editor()->markedTextMatchesAreHighlighted())
frame()->page()->unmarkAllTextMatches();
// Clear the counters from last operation.
m_lastMatchCount = 0;
@@ -1585,7 +1585,7 @@ void WebFrameImpl::scopeStringMatches(int identifier,
m_lastSearchString = searchText;
if (matchCount > 0) {
- frame()->setMarkedTextMatchesAreHighlighted(true);
+ frame()->editor()->setMarkedTextMatchesAreHighlighted(true);
m_lastMatchCount += matchCount;
diff --git a/WebKit/chromium/src/WebViewImpl.cpp b/WebKit/chromium/src/WebViewImpl.cpp
index f63c908..137bf06 100644
--- a/WebKit/chromium/src/WebViewImpl.cpp
+++ b/WebKit/chromium/src/WebViewImpl.cpp
@@ -1278,7 +1278,7 @@ WebRect WebViewImpl::caretOrSelectionBounds()
if (!node || !node->renderer())
return rect;
RefPtr<Range> range = controller->toNormalizedRange();
- rect = view->contentsToWindow(focused->firstRectForRange(range.get()));
+ rect = view->contentsToWindow(focused->editor()->firstRectForRange(range.get()));
}
return rect;
}
diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog
index c7787b3..e805d2c 100644
--- a/WebKit/efl/ChangeLog
+++ b/WebKit/efl/ChangeLog
@@ -1,3 +1,21 @@
+2010-09-08 Darin Adler <darin at 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-09 Gyuyoung Kim <gyuyoung.kim at samsung.com>
Unreviewed build fix.
diff --git a/WebKit/efl/ewk/ewk_frame.cpp b/WebKit/efl/ewk/ewk_frame.cpp
index a7ce1ff..8945ee7 100644
--- a/WebKit/efl/ewk/ewk_frame.cpp
+++ b/WebKit/efl/ewk/ewk_frame.cpp
@@ -636,7 +636,7 @@ Eina_Bool ewk_frame_editable_set(Evas_Object* o, Eina_Bool editable)
if (sd->editable == editable)
return EINA_TRUE;
if (editable)
- sd->frame->applyEditingStyleToBodyElement();
+ sd->frame->editor()->applyEditingStyleToBodyElement();
return EINA_TRUE;
}
@@ -651,7 +651,7 @@ char* ewk_frame_selection_get(const Evas_Object* o)
{
EWK_FRAME_SD_GET_OR_RETURN(o, sd, 0);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, 0);
- WTF::CString s = sd->frame->selectedText().utf8();
+ WTF::CString s = sd->frame->editor()->selectedText().utf8();
if (s.isNull())
return 0;
return strdup(s.data());
@@ -751,7 +751,7 @@ Eina_Bool ewk_frame_text_search(const Evas_Object* o, const char* string, Eina_B
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(string, EINA_FALSE);
- return sd->frame->findString(WTF::String::fromUTF8(string), forward, case_sensitive, wrap, true);
+ return sd->frame->editor()->findString(WTF::String::fromUTF8(string), forward, case_sensitive, wrap, true);
}
/**
@@ -771,8 +771,8 @@ unsigned int ewk_frame_text_matches_mark(Evas_Object* o, const char* string, Ein
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(string, 0);
- sd->frame->setMarkedTextMatchesAreHighlighted(highlight);
- return sd->frame->countMatchesForText(WTF::String::fromUTF8(string), case_sensitive, limit, true);
+ sd->frame->editor()->setMarkedTextMatchesAreHighlighted(highlight);
+ return sd->frame->editor()->countMatchesForText(WTF::String::fromUTF8(string), case_sensitive, limit, true);
}
/**
@@ -803,7 +803,7 @@ Eina_Bool ewk_frame_text_matches_highlight_set(Evas_Object* o, Eina_Bool highlig
{
EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE);
- sd->frame->setMarkedTextMatchesAreHighlighted(highlight);
+ sd->frame->editor()->setMarkedTextMatchesAreHighlighted(highlight);
return EINA_TRUE;
}
@@ -818,7 +818,7 @@ Eina_Bool ewk_frame_text_matches_highlight_get(const Evas_Object* o)
{
EWK_FRAME_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(sd->frame, EINA_FALSE);
- return sd->frame->markedTextMatchesAreHighlighted();
+ return sd->frame->editor()->markedTextMatchesAreHighlighted();
}
/**
diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp
index ea54167..254fdfd 100644
--- a/WebKit/efl/ewk/ewk_view.cpp
+++ b/WebKit/efl/ewk/ewk_view.cpp
@@ -1445,7 +1445,7 @@ char* ewk_view_selection_get(const Evas_Object* o)
{
EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
- WTF::CString s = priv->page->focusController()->focusedOrMainFrame()->selectedText().utf8();
+ WTF::CString s = priv->page->focusController()->focusedOrMainFrame()->editor()->selectedText().utf8();
if (s.isNull())
return 0;
return strdup(s.data());
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index a8360f3..25fe4fd 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-08 Darin Adler <darin at 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-09 Philippe Normand <pnormand at igalia.com>
Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 98f8e4e..480983f 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -3693,7 +3693,7 @@ void webkit_web_view_set_highlight_text_matches(WebKitWebView* webView, gboolean
Frame *frame = core(webView)->mainFrame();
do {
- frame->setMarkedTextMatchesAreHighlighted(shouldHighlight);
+ frame->editor()->setMarkedTextMatchesAreHighlighted(shouldHighlight);
frame = frame->tree()->traverseNextWithWrap(false);
} while (frame);
}
@@ -3875,7 +3875,7 @@ gchar* webkit_web_view_get_selected_text(WebKitWebView* webView)
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
- return g_strdup(frame->selectedText().utf8().data());
+ return g_strdup(frame->editor()->selectedText().utf8().data());
}
/**
@@ -3947,7 +3947,7 @@ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag)
priv->editable = flag;
if (flag) {
- frame->applyEditingStyleToBodyElement();
+ frame->editor()->applyEditingStyleToBodyElement();
// TODO: If the WebKitWebView is made editable and the selection is empty, set it to something.
//if (!webkit_web_view_get_selected_dom_range(webView))
// mainFrame->setSelectionFromNone();
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 80a6b31..bfef372 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,28 @@
+2010-09-08 Darin Adler <darin at 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 MORITA Hajime <morrita at google.com>
Reviewed by Tony Chang.
diff --git a/WebKit/mac/WebView/WebFrame.mm b/WebKit/mac/WebView/WebFrame.mm
index 5b28833..8d564a3 100644
--- a/WebKit/mac/WebView/WebFrame.mm
+++ b/WebKit/mac/WebView/WebFrame.mm
@@ -529,7 +529,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
- (NSString *)_selectedString
{
- return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->selectedText());
+ return _private->coreFrame->displayStringModifiedByEncoding(_private->coreFrame->editor()->selectedText());
}
- (NSString *)_stringForRange:(DOMRange *)range
@@ -662,7 +662,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
- (NSRect)_firstRectForDOMRange:(DOMRange *)range
{
- return _private->coreFrame->firstRectForRange(core(range));
+ return _private->coreFrame->editor()->firstRectForRange(core(range));
}
- (void)_scrollDOMRangeToVisible:(DOMRange *)range
@@ -788,7 +788,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
- (DOMRange *)_markDOMRange
{
- return kit(_private->coreFrame->mark().toNormalizedRange().get());
+ return kit(_private->coreFrame->editor()->mark().toNormalizedRange().get());
}
// Given proposedRange, returns an extended range that includes adjacent whitespace that should
@@ -904,7 +904,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
{
if (!_private->coreFrame)
return;
- _private->coreFrame->computeAndSetTypingStyle(core(style), undoAction);
+ _private->coreFrame->editor()->computeAndSetTypingStyle(core(style), undoAction);
}
- (void)_dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation
diff --git a/WebKit/mac/WebView/WebHTMLRepresentation.mm b/WebKit/mac/WebView/WebHTMLRepresentation.mm
index 7843c9a..188747d 100644
--- a/WebKit/mac/WebView/WebHTMLRepresentation.mm
+++ b/WebKit/mac/WebView/WebHTMLRepresentation.mm
@@ -212,7 +212,7 @@ static NSArray *concatenateArrays(NSArray *first, NSArray *second)
WebView *webView = [frame webView];
if ([webView isEditable])
- core(frame)->applyEditingStyleToBodyElement();
+ core(frame)->editor()->applyEditingStyleToBodyElement();
}
}
diff --git a/WebKit/mac/WebView/WebHTMLView.mm b/WebKit/mac/WebView/WebHTMLView.mm
index 34745a1..bd71eff 100644
--- a/WebKit/mac/WebView/WebHTMLView.mm
+++ b/WebKit/mac/WebView/WebHTMLView.mm
@@ -4204,7 +4204,7 @@ static BOOL isInPasswordField(Frame* coreFrame)
{
Frame* coreFrame = core([self _frame]);
NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"x"
- attributes:coreFrame ? coreFrame->fontAttributesForSelectionStart() : nil];
+ attributes:coreFrame ? coreFrame->editor()->fontAttributesForSelectionStart() : nil];
NSData *data = [string RTFFromRange:NSMakeRange(0, [string length]) documentAttributes:nil];
[string release];
return data;
@@ -4831,7 +4831,7 @@ NSStrokeColorAttributeName /* NSColor, default nil: same as foreground co
return;
WritingDirection direction = RightToLeftWritingDirection;
- switch (coreFrame->baseWritingDirectionForSelectionStart()) {
+ switch (coreFrame->editor()->baseWritingDirectionForSelectionStart()) {
case NSWritingDirectionLeftToRight:
break;
case NSWritingDirectionRightToLeft:
@@ -6167,7 +6167,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
if (![string length])
return NO;
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->findString(string, forward, caseFlag, wrapFlag, startInSelection);
+ return coreFrame && coreFrame->editor()->findString(string, forward, caseFlag, wrapFlag, startInSelection);
}
@end
@@ -6197,7 +6197,7 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
Frame* coreFrame = core([self _frame]);
if (!coreFrame)
return 0;
- return coreFrame->countMatchesForText(string, caseFlag, limit, markMatches);
+ return coreFrame->editor()->countMatchesForText(string, caseFlag, limit, markMatches);
}
- (void)setMarkedTextMatchesAreHighlighted:(BOOL)newValue
@@ -6205,13 +6205,13 @@ static void extractUnderlines(NSAttributedString *string, Vector<CompositionUnde
Frame* coreFrame = core([self _frame]);
if (!coreFrame)
return;
- coreFrame->setMarkedTextMatchesAreHighlighted(newValue);
+ coreFrame->editor()->setMarkedTextMatchesAreHighlighted(newValue);
}
- (BOOL)markedTextMatchesAreHighlighted
{
Frame* coreFrame = core([self _frame]);
- return coreFrame && coreFrame->markedTextMatchesAreHighlighted();
+ return coreFrame && coreFrame->editor()->markedTextMatchesAreHighlighted();
}
- (void)unmarkAllTextMatches
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index 470855b..0125e1c 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -4766,7 +4766,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu
Frame* mainFrame = [self _mainCoreFrame];
if (mainFrame) {
if (flag) {
- mainFrame->applyEditingStyleToBodyElement();
+ mainFrame->editor()->applyEditingStyleToBodyElement();
// If the WebView is made editable and the selection is empty, set it to something.
if (![self selectedDOMRange])
mainFrame->setSelectionFromNone();
diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp
index ec415bb..8bf9208 100644
--- a/WebKit/qt/Api/qwebpage.cpp
+++ b/WebKit/qt/Api/qwebpage.cpp
@@ -2417,7 +2417,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &
QString QWebPage::selectedText() const
{
d->createMainFrame();
- return d->page->focusController()->focusedOrMainFrame()->selectedText();
+ return d->page->focusController()->focusedOrMainFrame()->editor()->selectedText();
}
#ifndef QT_NO_ACTION
@@ -2881,7 +2881,7 @@ void QWebPage::setContentEditable(bool editable)
if (d->mainFrame) {
WebCore::Frame* frame = d->mainFrame->d->frame;
if (editable) {
- frame->applyEditingStyleToBodyElement();
+ frame->editor()->applyEditingStyleToBodyElement();
// FIXME: mac port calls this if there is no selectedDOMRange
//frame->setSelectionFromNone();
}
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 6ad4c61..95e79a4 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-08 Darin Adler <darin at 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 Peter Kasting <pkasting at google.com>
Reviewed by David Hyatt.
diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
index 026866c..c1be131 100644
--- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
@@ -489,7 +489,7 @@ QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPage* page,
if (!range)
return QVariantList();
- QRect resultRect = frame->firstRectForRange(range.get());
+ QRect resultRect = frame->editor()->firstRectForRange(range.get());
rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height();
return rect;
}
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 91d0b7f..23c5df5 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-08 Darin Adler <darin at 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 Peter Kasting <pkasting at google.com>
Not reviewed, build fix.
diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
index 078b725..ca0374a 100644
--- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
+++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp
@@ -131,7 +131,7 @@ void WebContextMenuClient::downloadURL(const KURL& url)
void WebContextMenuClient::searchWithGoogle(const Frame* frame)
{
- String searchString = frame->selectedText();
+ String searchString = frame->editor()->selectedText();
searchString.stripWhiteSpace();
String encoded = encodeWithURLEscapeSequences(searchString);
encoded.replace("%20", "+");
diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp
index 6703cc7..014ea15 100644
--- a/WebKit/win/WebFrame.cpp
+++ b/WebKit/win/WebFrame.cpp
@@ -1045,7 +1045,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::selectedString(
if (!coreFrame)
return E_FAIL;
- String text = coreFrame->displayStringModifiedByEncoding(coreFrame->selectedText());
+ String text = coreFrame->displayStringModifiedByEncoding(coreFrame->editor()->selectedText());
*result = BString(text).release();
return S_OK;
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index fdcd1db..0a1e334 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -3547,7 +3547,7 @@ HRESULT STDMETHODCALLTYPE WebView::selectedText(
if (!focusedFrame)
return E_FAIL;
- String frameSelectedText = focusedFrame->selectedText();
+ String frameSelectedText = focusedFrame->editor()->selectedText();
*text = SysAllocStringLen(frameSelectedText.characters(), frameSelectedText.length());
if (!*text && frameSelectedText.length())
return E_OUTOFMEMORY;
@@ -5267,7 +5267,7 @@ void WebView::prepareCandidateWindow(Frame* targetFrame, HIMC hInputContext)
if (RefPtr<Range> range = targetFrame->selection()->selection().toNormalizedRange()) {
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
- caret = targetFrame->firstRectForRange(tempRange.get());
+ caret = targetFrame->editor()->firstRectForRange(tempRange.get());
}
caret = targetFrame->view()->contentsToWindow(caret);
CANDIDATEFORM form;
@@ -5538,7 +5538,7 @@ LRESULT WebView::onIMERequestCharPosition(Frame* targetFrame, IMECHARPOSITION* c
ExceptionCode ec = 0;
RefPtr<Range> tempRange = range->cloneRange(ec);
tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + charPos->dwCharPos, ec);
- caret = targetFrame->firstRectForRange(tempRange.get());
+ caret = targetFrame->editor()->firstRectForRange(tempRange.get());
}
caret = targetFrame->view()->contentsToWindow(caret);
charPos->pt.x = caret.x();
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 757981f..8edf46f 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-08 Darin Adler <darin at 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-08-31 Dave Hyatt <hyatt at apple.com>
Reviewed by Sam Weinig.
diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp
index fe45eea..3a556d5 100644
--- a/WebKit/wx/WebFrame.cpp
+++ b/WebKit/wx/WebFrame.cpp
@@ -273,7 +273,7 @@ wxString wxWebFrame::GetEditCommandValue(const wxString& command) const
bool wxWebFrame::FindString(const wxString& string, bool forward, bool caseSensitive, bool wrapSelection, bool startInSelection)
{
if (m_impl->frame)
- return m_impl->frame->findString(string, forward, caseSensitive, wrapSelection, startInSelection);
+ return m_impl->frame->editor()->findString(string, forward, caseSensitive, wrapSelection, startInSelection);
return false;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list