18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/* 28e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without 58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions 68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met: 78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1. Redistributions of source code must retain the above copyright 88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer. 98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2. Redistributions in binary form must reproduce the above copyright 108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * notice, this list of conditions and the following disclaimer in the 118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * documentation and/or other materials provided with the distribution. 128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */ 258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#ifndef Editor_h 278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#define Editor_h 288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "ClipboardAccessPolicy.h" 308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "Color.h" 31cad810f21b803229eb11403f9209855525a25d57Steve Block#include "DocumentMarker.h" 328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "EditAction.h" 33545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch#include "EditingBehavior.h" 348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "EditorDeleteAction.h" 358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#include "EditorInsertAction.h" 36f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "FindOptions.h" 3781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch#include "SelectionController.h" 382bde8e466a4451c7319e3a072d118917957d6554Steve Block#include "TextChecking.h" 39cad810f21b803229eb11403f9209855525a25d57Steve Block#include "Timer.h" 40cad810f21b803229eb11403f9209855525a25d57Steve Block#include "VisibleSelection.h" 41cad810f21b803229eb11403f9209855525a25d57Steve Block#include "WritingDirection.h" 428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 435abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#if PLATFORM(MAC) && !defined(__OBJC__) 445abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickclass NSDictionary; 455abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merricktypedef int NSWritingDirection; 465abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#endif 475abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectnamespace WebCore { 498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 50cad810f21b803229eb11403f9209855525a25d57Steve Blockclass CSSMutableStyleDeclaration; 518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass CSSStyleDeclaration; 528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass Clipboard; 532daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass SpellingCorrectionController; 548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass DeleteButtonController; 558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass EditCommand; 568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass EditorClient; 578e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass EditorInternalCommand; 580617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsenclass Frame; 598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass HTMLElement; 608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass HitTestResult; 615af96e2c7b73ebc627c6894727826a7576d31758Leon Clarkeclass KillRing; 628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass Pasteboard; 638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass SimpleFontData; 64f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochclass SpellChecker; 658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass Text; 6681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochclass TextCheckerClient; 67dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass TextEvent; 688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectstruct CompositionUnderline { 708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project CompositionUnderline() 718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project : startOffset(0), endOffset(0), thick(false) { } 728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project CompositionUnderline(unsigned s, unsigned e, const Color& c, bool t) 738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project : startOffset(s), endOffset(e), color(c), thick(t) { } 748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project unsigned startOffset; 758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project unsigned endOffset; 768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Color color; 778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool thick; 788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; 798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectenum EditorCommandSource { CommandFromMenuOrKeyBinding, CommandFromDOM, CommandFromDOMWithUserInterface }; 818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectclass Editor { 838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectpublic: 848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Editor(Frame*); 858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project ~Editor(); 868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project EditorClient* client() const; 8881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch TextCheckerClient* textChecker() const; 8981bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch 908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Frame* frame() const { return m_frame; } 918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project DeleteButtonController* deleteButtonController() const { return m_deleteButtonController.get(); } 928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project EditCommand* lastEditCommand() { return m_lastEditCommand.get(); } 938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void handleKeyboardEvent(KeyboardEvent*); 958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void handleInputMethodKeydown(KeyboardEvent*); 96dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch bool handleTextEvent(TextEvent*); 978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canEdit() const; 998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canEditRichly() const; 1008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canDHTMLCut(); 1028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canDHTMLCopy(); 1038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canDHTMLPaste(); 1048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool tryDHTMLCopy(); 1058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool tryDHTMLCut(); 1068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool tryDHTMLPaste(); 1078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canCut() const; 1098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canCopy() const; 1108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canPaste() const; 1118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canDelete() const; 1128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canSmartCopyOrDelete(); 1138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void cut(); 1158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void copy(); 1168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void paste(); 1178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void pasteAsPlainText(); 1188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void performDelete(); 1198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void copyURL(const KURL&, const String&); 1218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void copyImage(const HitTestResult&); 1228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void indent(); 1248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void outdent(); 1258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void transpose(); 1268e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1278e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldInsertFragment(PassRefPtr<DocumentFragment>, PassRefPtr<Range>, EditorInsertAction); 1288e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldInsertText(const String&, Range*, EditorInsertAction) const; 1298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldShowDeleteInterface(HTMLElement*) const; 1308e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldDeleteRange(Range*) const; 1318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldApplyStyle(CSSStyleDeclaration*, Range*); 1328e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1338f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void respondToChangedSelection(const VisibleSelection& oldSelection); 1348f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void respondToChangedContents(const VisibleSelection& endingSelection); 1358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 13681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch bool selectionStartHasStyle(int propertyID, const String& value) const; 13781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch TriState selectionHasStyle(int propertyID, const String& value) const; 1385ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen String selectionStartCSSPropertyValue(int propertyID); 1398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const SimpleFontData* fontForSelection(bool&) const; 140635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project WritingDirection textDirectionForSelection(bool&) const; 1418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project TriState selectionUnorderedListState() const; 1438e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project TriState selectionOrderedListState() const; 1448e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Node> insertOrderedList(); 1458e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Node> insertUnorderedList(); 1468e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canIncreaseSelectionListLevel(); 1478e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canDecreaseSelectionListLevel(); 1488e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Node> increaseSelectionListLevel(); 1498e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Node> increaseSelectionListLevelOrdered(); 1508e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Node> increaseSelectionListLevelUnordered(); 1518e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void decreaseSelectionListLevel(); 1528e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1538e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void removeFormattingAndStyle(); 1548e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1558e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void clearLastEditCommand(); 1568e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 157cad810f21b803229eb11403f9209855525a25d57Steve Block bool deleteWithDirection(SelectionDirection, TextGranularity, bool killRing, bool isTypingAction); 1588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void deleteSelectionWithSmartDelete(bool smartDelete); 1598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool dispatchCPPEvent(const AtomicString&, ClipboardAccessPolicy); 1608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Node* removedAnchor() const { return m_removedAnchor.get(); } 1628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setRemovedAnchor(PassRefPtr<Node> n) { m_removedAnchor = n; } 1638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void applyStyle(CSSStyleDeclaration*, EditAction = EditActionUnspecified); 1658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void applyParagraphStyle(CSSStyleDeclaration*, EditAction = EditActionUnspecified); 1668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void applyStyleToSelection(CSSStyleDeclaration*, EditAction); 1678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void applyParagraphStyleToSelection(CSSStyleDeclaration*, EditAction); 1688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void appliedEditing(PassRefPtr<EditCommand>); 1708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void unappliedEditing(PassRefPtr<EditCommand>); 1718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void reappliedEditing(PassRefPtr<EditCommand>); 17281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void unappliedSpellCorrection(const VisibleSelection& selectionOfCorrected, const String& corrected, const String& correction); 1738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1748f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } 1758f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } 1768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project class Command { 1788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project public: 1798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Command(); 180cad810f21b803229eb11403f9209855525a25d57Steve Block Command(const EditorInternalCommand*, EditorCommandSource, PassRefPtr<Frame>); 1818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1828e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool execute(const String& parameter = String(), Event* triggeringEvent = 0) const; 1838e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool execute(Event* triggeringEvent) const; 1848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1858e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isSupported() const; 1868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isEnabled(Event* triggeringEvent = 0) const; 1878e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1888e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project TriState state(Event* triggeringEvent = 0) const; 1898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project String value(Event* triggeringEvent = 0) const; 1908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isTextInsertion() const; 1928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 1938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project private: 1948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const EditorInternalCommand* m_command; 1958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project EditorCommandSource m_source; 196cad810f21b803229eb11403f9209855525a25d57Steve Block RefPtr<Frame> m_frame; 1978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project }; 198cad810f21b803229eb11403f9209855525a25d57Steve Block Command command(const String& commandName); // Command source is CommandFromMenuOrKeyBinding. 1998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Command command(const String& commandName, EditorCommandSource); 200cad810f21b803229eb11403f9209855525a25d57Steve Block static bool commandIsSupportedFromMenuOrKeyBinding(const String& commandName); // Works without a frame. 2018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool insertText(const String&, Event* triggeringEvent); 2032fc2651226baac27029e38c9d6ef883fa32084dbSteve Block bool insertTextForConfirmedComposition(const String& text); 2042fc2651226baac27029e38c9d6ef883fa32084dbSteve Block bool insertTextWithoutSendingTextEvent(const String&, bool selectInsertedText, TextEvent* triggeringEvent); 2058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool insertLineBreak(); 2068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool insertParagraphSeparator(); 2078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isContinuousSpellCheckingEnabled(); 2098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void toggleContinuousSpellChecking(); 2108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isGrammarCheckingEnabled(); 2118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void toggleGrammarChecking(); 2128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void ignoreSpelling(); 2138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void learnSpelling(); 2148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project int spellCheckerDocumentTag(); 2158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isSelectionUngrammatical(); 2168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool isSelectionMisspelled(); 2178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Vector<String> guessesForMisspelledSelection(); 2188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Vector<String> guessesForUngrammaticalSelection(); 2198f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian Vector<String> guessesForMisspelledOrUngrammaticalSelection(bool& misspelled, bool& ungrammatical); 220e14391e94c850b8bd03680c23b38978db68687a8John Reck bool isSpellCheckingEnabledInFocusedNode() const; 22128040489d744e0c5d475a88663056c9040ed5320Teng-Hui Zhu bool isSpellCheckingEnabledFor(Node*) const; 2222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void markMisspellingsAfterTypingToWord(const VisiblePosition &wordStart, const VisibleSelection& selectionAfterTyping, bool doReplacement); 2235f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void markMisspellings(const VisibleSelection&, RefPtr<Range>& firstMisspellingRange); 2248f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void markBadGrammar(const VisibleSelection&); 2258f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian void markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelection, bool markGrammar, const VisibleSelection& grammarSelection); 2262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch enum TextCheckingOptionFlags { 2282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch MarkSpelling = 1 << 0, 2292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch MarkGrammar = 1 << 1, 2302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch PerformReplacement = 1 << 2, 2312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch ShowCorrectionPanel = 1 << 3, 2322daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch CheckForCorrection = 1 << 4, 2332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch }; 2342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch typedef unsigned TextCheckingOptions; 2352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 2362bde8e466a4451c7319e3a072d118917957d6554Steve Block#if USE(AUTOMATIC_TEXT_REPLACEMENT) 2375f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void uppercaseWord(); 2385f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void lowercaseWord(); 2395f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void capitalizeWord(); 2405f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void showSubstitutionsPanel(); 2415f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian bool substitutionsPanelIsShowing(); 2425f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void toggleSmartInsertDelete(); 2435f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian bool isAutomaticQuoteSubstitutionEnabled(); 2445f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void toggleAutomaticQuoteSubstitution(); 2455f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian bool isAutomaticLinkDetectionEnabled(); 2465f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void toggleAutomaticLinkDetection(); 2475f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian bool isAutomaticDashSubstitutionEnabled(); 2485f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void toggleAutomaticDashSubstitution(); 2495f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian bool isAutomaticTextReplacementEnabled(); 2505f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void toggleAutomaticTextReplacement(); 2515f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian bool isAutomaticSpellingCorrectionEnabled(); 2525f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void toggleAutomaticSpellingCorrection(); 2532bde8e466a4451c7319e3a072d118917957d6554Steve Block#endif 2542bde8e466a4451c7319e3a072d118917957d6554Steve Block 2555ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen void markAllMisspellingsAndBadGrammarInRanges(TextCheckingOptions, Range* spellingRange, Range* grammarRange); 2565f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian void changeBackToReplacedString(const String& replacedString); 2572bde8e466a4451c7319e3a072d118917957d6554Steve Block 2588e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void advanceToNextMisspelling(bool startBeforeSelection = false); 2598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void showSpellingGuessPanel(); 2608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool spellingPanelIsShowing(); 2618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2628e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldBeginEditing(Range*); 2638e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool shouldEndEditing(Range*); 2648e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2658e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void clearUndoRedoOperations(); 2668e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canUndo(); 2678e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void undo(); 2688e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canRedo(); 2698e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void redo(); 2708e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2718e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void didBeginEditing(); 2728e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void didEndEditing(); 2738e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void didWriteSelectionToPasteboard(); 2748e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2758e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void showFontPanel(); 2768e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void showStylesPanel(); 2778e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void showColorPanel(); 2788e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void toggleBold(); 2798e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void toggleUnderline(); 2808e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setBaseWritingDirection(WritingDirection); 2818e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 282635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are 283635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project // mutually exclusive, meaning that enabling one will disable the other. 2848e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool smartInsertDeleteEnabled(); 285635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool isSelectTrailingWhitespaceEnabled(); 2868e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 287635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project bool hasBidiSelection() const; 288635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project 2898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // international text input composition 2908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool hasComposition() const { return m_compositionNode; } 2918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setComposition(const String&, const Vector<CompositionUnderline>&, unsigned selectionStart, unsigned selectionEnd); 2928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void confirmComposition(); 2938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void confirmComposition(const String&); // if no existing composition, replaces selection 2948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void confirmCompositionWithoutDisturbingSelection(); 2958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Range> compositionRange() const; 2968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool getCompositionSelection(unsigned& selectionStart, unsigned& selectionEnd) const; 2978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 2988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // getting international text input composition state (for use by InlineTextBox) 2998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Text* compositionNode() const { return m_compositionNode.get(); } 3008e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project unsigned compositionStart() const { return m_compositionStart; } 3018e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project unsigned compositionEnd() const { return m_compositionEnd; } 3028e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool compositionUsesCustomUnderlines() const { return !m_customCompositionUnderlines.isEmpty(); } 3038e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project const Vector<CompositionUnderline>& customCompositionUnderlines() const { return m_customCompositionUnderlines; } 3048e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3058e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool ignoreCompositionSelectionChange() const { return m_ignoreCompositionSelectionChange; } 3068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setStartNewKillRingSequence(bool); 3088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3098e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint); 3108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void clear(); 3128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3138f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian VisibleSelection selectionForCommand(Event*); 3148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3155af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke KillRing* killRing() const { return m_killRing.get(); } 316f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch SpellChecker* spellChecker() const { return m_spellChecker.get(); } 3178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 318545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch EditingBehavior behavior() const; 319545e470e52f0ac6a3a072bf559c796b42c6066b6Ben Murdoch 3208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project PassRefPtr<Range> selectedRange(); 3218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 3228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project // We should make these functions private when their callers in Frame are moved over here to Editor 3238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool insideVisibleArea(const IntPoint&) const; 3248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool insideVisibleArea(Range*) const; 3255ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen 326635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project void addToKillRing(Range*, bool prepend); 327dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 3282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void startCorrectionPanelTimer(); 329f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch // If user confirmed a correction in the correction panel, correction has non-zero length, otherwise it means that user has dismissed the panel. 330f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch void handleCorrectionPanelResult(const String& correction); 3312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void dismissCorrectionPanelAsIgnored(); 3325ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen 333dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch void pasteAsFragment(PassRefPtr<DocumentFragment>, bool smartReplace, bool matchStyle); 334dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch void pasteAsPlainText(const String&, bool smartReplace); 335dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch 336e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block // This is only called on the mac where paste is implemented primarily at the WebKit level. 337e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block void pasteAsPlainTextBypassingDHTML(); 3385abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3395abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void clearMisspellingsAndBadGrammar(const VisibleSelection&); 3405abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void markMisspellingsAndBadGrammar(const VisibleSelection&); 341e8b154fd68f9b33be40a3590e58347f353835f5cSteve Block 342f486d19d62f1bc33246748b14b14a9dfa617b57fIain Merrick Node* findEventTargetFrom(const VisibleSelection& selection) const; 3435abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3445abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick String selectedText() const; 345f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch bool findString(const String&, FindOptions); 346f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch // FIXME: Switch callers over to the FindOptions version and retire this one. 3475abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection); 3485abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3495abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick const VisibleSelection& mark() const; // Mark, to be used as emacs uses it. 3505abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void setMark(const VisibleSelection&); 3515abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3525abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified); 3535abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void applyEditingStyleToBodyElement() const; 3545abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void applyEditingStyleToElement(Element*) const; 3555abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3565abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick IntRect firstRectForRange(Range*) const; 3575abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 35881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void respondToChangedSelection(const VisibleSelection& oldSelection, SelectionController::SetSelectionOptions); 3595abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const; 3605abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3615abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const; 3625abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 363f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch unsigned countMatchesForText(const String&, FindOptions, unsigned limit, bool markMatches); 364f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch unsigned countMatchesForText(const String&, Range*, FindOptions, unsigned limit, bool markMatches); 3655abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick bool markedTextMatchesAreHighlighted() const; 3665abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void setMarkedTextMatchesAreHighlighted(bool); 3675abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 36881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch PassRefPtr<EditingStyle> selectionStartStyle() const; 3695abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3705abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void textFieldDidBeginEditing(Element*); 3715abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void textFieldDidEndEditing(Element*); 3725abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void textDidChangeInTextField(Element*); 3735abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*); 3745abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void textWillBeDeletedInTextField(Element* input); 3755abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick void textDidChangeInTextArea(Element*); 3765abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3775abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#if PLATFORM(MAC) 3785abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick NSDictionary* fontAttributesForSelectionStart() const; 3795abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick NSWritingDirection baseWritingDirectionForSelectionStart() const; 380f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch bool canCopyExcludingStandaloneImages(); 381f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch void takeFindStringFromSelection(); 38281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch void writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes); 3832bde8e466a4451c7319e3a072d118917957d6554Steve Block void readSelectionFromPasteboard(const String& pasteboardName); 3845abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick#endif 3855abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 3862bde8e466a4451c7319e3a072d118917957d6554Steve Block bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int length) const; 3872daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSelection); 38868513a70bcd92384395513322f1b801e7bf9c729Steve Block 3898e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectprivate: 3908e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Frame* m_frame; 3918e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project OwnPtr<DeleteButtonController> m_deleteButtonController; 3928e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project RefPtr<EditCommand> m_lastEditCommand; 3938e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project RefPtr<Node> m_removedAnchor; 3948e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project RefPtr<Text> m_compositionNode; 3958e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project unsigned m_compositionStart; 3968e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project unsigned m_compositionEnd; 3978e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project Vector<CompositionUnderline> m_customCompositionUnderlines; 3988e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool m_ignoreCompositionSelectionChange; 3998e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool m_shouldStartNewKillRingSequence; 4008f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian bool m_shouldStyleWithCSS; 4015af96e2c7b73ebc627c6894727826a7576d31758Leon Clarke OwnPtr<KillRing> m_killRing; 402f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch OwnPtr<SpellChecker> m_spellChecker; 4032daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch OwnPtr<SpellingCorrectionController> m_spellingCorrector; 4045abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick VisibleSelection m_mark; 4055abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick bool m_areMarkedTextMatchesHighlighted; 4068e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4078e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canDeleteRange(Range*) const; 4088e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project bool canSmartReplaceWithPasteboard(Pasteboard*); 4090617145a89917ae7735fe1c9538688ab9a577df5Kristian Monsen PassRefPtr<Clipboard> newGeneralClipboard(ClipboardAccessPolicy, Frame*); 4108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void pasteAsPlainTextWithPasteboard(Pasteboard*); 4118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void pasteWithPasteboard(Pasteboard*, bool allowPlainText); 4128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectReplacement, bool smartReplace, bool matchStyle); 4138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void replaceSelectionWithText(const String&, bool selectReplacement, bool smartReplace); 4148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void writeSelectionToPasteboard(Pasteboard*); 4158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void revealSelectionAfterEditingOperation(); 416e14391e94c850b8bd03680c23b38978db68687a8John Reck void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpelling, RefPtr<Range>& firstMisspellingRange); 4172daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch TextCheckingTypeMask textCheckingTypeMaskFor(TextCheckingOptions); 4188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void selectComposition(); 4208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void confirmComposition(const String&, bool preserveSelection); 4218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project void setIgnoreCompositionSelectionChange(bool ignore); 4228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 423f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch PassRefPtr<Range> firstVisibleRange(const String&, FindOptions); 424f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch PassRefPtr<Range> lastVisibleRange(const String&, FindOptions); 425f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch PassRefPtr<Range> nextVisibleRange(Range*, const String&, FindOptions); 4265ddde30071f639962dd557c453f2ad01f8f0fd00Kristian Monsen 42706ea8e899e48f1f2f396b70e63fae369f2f23232Kristian Monsen void changeSelectionAfterCommand(const VisibleSelection& newSelection, bool closeTyping, bool clearTypingStyle); 4282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 429dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch Node* findEventTargetFromSelection() const; 430bec39347bb3bb5bf1187ccaf471d26247f28b585Kristian Monsen void stopCorrectionPanelTimer(); 4312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch 432f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch void applyCorrectionPanelInfo(const Vector<DocumentMarker::MarkerType>& markerTypesToAdd); 43381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch // Return true if correction was applied, false otherwise. 43481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch bool applyAutocorrectionBeforeTypingIfAppropriate(); 43581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch FloatRect windowRectForRange(const Range*) const; 4368e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}; 4378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Projectinline void Editor::setStartNewKillRingSequence(bool flag) 4398e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{ 4408e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project m_shouldStartNewKillRingSequence = flag; 4418e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} 4428e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4435abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickinline const VisibleSelection& Editor::mark() const 4445abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{ 4455abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick return m_mark; 4465abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick} 4475abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 4485abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickinline void Editor::setMark(const VisibleSelection& selection) 4495abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{ 4505abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick m_mark = selection; 4515abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick} 4525abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 4535abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickinline bool Editor::markedTextMatchesAreHighlighted() const 4545abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick{ 4555abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick return m_areMarkedTextMatchesHighlighted; 4565abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick} 4575abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 4585abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick 4598e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project} // namespace WebCore 4608e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project 4618e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project#endif // Editor_h 462