Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: webkit/glue/editor_client_impl.cc

Issue 7419: Move many files that were suffixed Win.cpp to Chromium.cpp, and place them in... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/chrome_client_impl.h ('k') | webkit/glue/resource_handle_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The Mac interface forwards most of these commands to the application layer, 5 // The Mac interface forwards most of these commands to the application layer,
6 // and I'm not really sure what to do about most of them. 6 // and I'm not really sure what to do about most of them.
7 7
8 #include "config.h" 8 #include "config.h"
9 #pragma warning(push, 0) 9 #pragma warning(push, 0)
10 #include "Document.h" 10 #include "Document.h"
11 #include "EditCommand.h" 11 #include "EditCommand.h"
12 #include "Editor.h" 12 #include "Editor.h"
13 #include "EventHandler.h" 13 #include "EventHandler.h"
14 #include "EventNames.h" 14 #include "EventNames.h"
15 #include "HTMLInputElement.h" 15 #include "HTMLInputElement.h"
16 #include "Frame.h" 16 #include "Frame.h"
17 #include "KeyboardEvent.h" 17 #include "KeyboardEvent.h"
18 #include "PlatformKeyboardEvent.h" 18 #include "PlatformKeyboardEvent.h"
19 #include "PlatformString.h" 19 #include "PlatformString.h"
20 #pragma warning(pop) 20 #pragma warning(pop)
21 21
22 #undef LOG 22 #undef LOG
23
24 #include "base/string_util.h" 23 #include "base/string_util.h"
25 #include "webkit/glue/editor_client_impl.h" 24 #include "webkit/glue/editor_client_impl.h"
26 #include "webkit/glue/glue_util.h" 25 #include "webkit/glue/glue_util.h"
27 #include "webkit/glue/webkit_glue.h" 26 #include "webkit/glue/webkit_glue.h"
28 #include "webkit/glue/webview.h" 27 #include "webkit/glue/webview.h"
29 #include "webkit/glue/webview_impl.h" 28 #include "webkit/glue/webview_impl.h"
30 29
31 // The notImplemented() from NotImplemented.h is now being dragged in via
32 // webview_impl.h. We want the one from LogWin.h instead.
33 #undef notImplemented
34 #include "LogWin.h"
35
36 // Arbitrary depth limit for the undo stack, to keep it from using 30 // Arbitrary depth limit for the undo stack, to keep it from using
37 // unbounded memory. This is the maximum number of distinct undoable 31 // unbounded memory. This is the maximum number of distinct undoable
38 // actions -- unbroken stretches of typed characters are coalesced 32 // actions -- unbroken stretches of typed characters are coalesced
39 // into a single action. 33 // into a single action.
40 static const size_t kMaximumUndoStackDepth = 1000; 34 static const size_t kMaximumUndoStackDepth = 1000;
41 35
42 namespace { 36 namespace {
43 37
44 // Record an editor command from the keyDownEntries[] below. We ignore the 38 // Record an editor command from the keyDownEntries[] below. We ignore the
45 // Move* and Insert* commands because they're not that interesting. 39 // Move* and Insert* commands because they're not that interesting.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 92
99 bool EditorClientImpl::isContinuousSpellCheckingEnabled() { 93 bool EditorClientImpl::isContinuousSpellCheckingEnabled() {
100 // Spell check everything if possible. 94 // Spell check everything if possible.
101 // FIXME(brettw) This should be modified to do reasonable defaults depending 95 // FIXME(brettw) This should be modified to do reasonable defaults depending
102 // on input type, and probably also allow the user to turn spellchecking on 96 // on input type, and probably also allow the user to turn spellchecking on
103 // for individual fields. 97 // for individual fields.
104 return true; 98 return true;
105 } 99 }
106 100
107 void EditorClientImpl::toggleContinuousSpellChecking() { 101 void EditorClientImpl::toggleContinuousSpellChecking() {
108 notImplemented(); 102 NOTIMPLEMENTED();
109 } 103 }
110 104
111 bool EditorClientImpl::isGrammarCheckingEnabled() { 105 bool EditorClientImpl::isGrammarCheckingEnabled() {
112 notImplemented();
113 return false; 106 return false;
114 } 107 }
115 108
116 void EditorClientImpl::toggleGrammarChecking() { 109 void EditorClientImpl::toggleGrammarChecking() {
117 notImplemented(); 110 NOTIMPLEMENTED();
118 } 111 }
119 112
120 int EditorClientImpl::spellCheckerDocumentTag() { 113 int EditorClientImpl::spellCheckerDocumentTag() {
121 notImplemented(); 114 NOTIMPLEMENTED();
122 return 0; 115 return 0;
123 } 116 }
124 117
125 bool EditorClientImpl::isEditable() { 118 bool EditorClientImpl::isEditable() {
126 notImplemented();
127 return false; 119 return false;
128 } 120 }
129 121
130 bool EditorClientImpl::shouldBeginEditing(WebCore::Range* range) { 122 bool EditorClientImpl::shouldBeginEditing(WebCore::Range* range) {
131 if (use_editor_delegate_) { 123 if (use_editor_delegate_) {
132 WebViewDelegate* d = web_view_->delegate(); 124 WebViewDelegate* d = web_view_->delegate();
133 if (d) 125 if (d)
134 return d->ShouldBeginEditing(web_view_, Describe(range)); 126 return d->ShouldBeginEditing(web_view_, Describe(range));
135 } 127 }
136 return true; 128 return true;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 WebViewDelegate* d = web_view_->delegate(); 211 WebViewDelegate* d = web_view_->delegate();
220 if (d) 212 if (d)
221 return d->ShouldApplyStyle(web_view_, Describe(style), Describe(range)); 213 return d->ShouldApplyStyle(web_view_, Describe(style), Describe(range));
222 } 214 }
223 return true; 215 return true;
224 } 216 }
225 217
226 bool EditorClientImpl::shouldMoveRangeAfterDelete( 218 bool EditorClientImpl::shouldMoveRangeAfterDelete(
227 WebCore::Range* /*range*/, 219 WebCore::Range* /*range*/,
228 WebCore::Range* /*rangeToBeReplaced*/) { 220 WebCore::Range* /*rangeToBeReplaced*/) {
229 notImplemented(); 221 NOTIMPLEMENTED();
230 return true; 222 return true;
231 } 223 }
232 224
233 void EditorClientImpl::didBeginEditing() { 225 void EditorClientImpl::didBeginEditing() {
234 if (use_editor_delegate_) { 226 if (use_editor_delegate_) {
235 WebViewDelegate* d = web_view_->delegate(); 227 WebViewDelegate* d = web_view_->delegate();
236 if (d) 228 if (d)
237 d->DidBeginEditing(); 229 d->DidBeginEditing();
238 } 230 }
239 } 231 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 267
276 void EditorClientImpl::didEndEditing() { 268 void EditorClientImpl::didEndEditing() {
277 if (use_editor_delegate_) { 269 if (use_editor_delegate_) {
278 WebViewDelegate* d = web_view_->delegate(); 270 WebViewDelegate* d = web_view_->delegate();
279 if (d) 271 if (d)
280 d->DidEndEditing(); 272 d->DidEndEditing();
281 } 273 }
282 } 274 }
283 275
284 void EditorClientImpl::didWriteSelectionToPasteboard() { 276 void EditorClientImpl::didWriteSelectionToPasteboard() {
285 notImplemented(); 277 NOTIMPLEMENTED();
286 } 278 }
287 279
288 void EditorClientImpl::didSetSelectionTypesForPasteboard() { 280 void EditorClientImpl::didSetSelectionTypesForPasteboard() {
289 notImplemented(); 281 NOTIMPLEMENTED();
290 } 282 }
291 283
292 void EditorClientImpl::registerCommandForUndo( 284 void EditorClientImpl::registerCommandForUndo(
293 PassRefPtr<WebCore::EditCommand> command) { 285 PassRefPtr<WebCore::EditCommand> command) {
294 if (undo_stack_.size() == kMaximumUndoStackDepth) 286 if (undo_stack_.size() == kMaximumUndoStackDepth)
295 undo_stack_.pop_front(); // drop oldest item off the far end 287 undo_stack_.pop_front(); // drop oldest item off the far end
296 if (!in_redo_) 288 if (!in_redo_)
297 redo_stack_.clear(); 289 redo_stack_.clear();
298 undo_stack_.push_back(command); 290 undo_stack_.push_back(command);
299 } 291 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // 547 //
556 // End of code block subject to Apple, Inc. copyright 548 // End of code block subject to Apple, Inc. copyright
557 // 549 //
558 550
559 void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) { 551 void EditorClientImpl::handleKeyboardEvent(WebCore::KeyboardEvent* evt) {
560 if (handleEditingKeyboardEvent(evt)) 552 if (handleEditingKeyboardEvent(evt))
561 evt->setDefaultHandled(); 553 evt->setDefaultHandled();
562 } 554 }
563 555
564 void EditorClientImpl::handleInputMethodKeydown(WebCore::KeyboardEvent* keyEvent ) { 556 void EditorClientImpl::handleInputMethodKeydown(WebCore::KeyboardEvent* keyEvent ) {
565 notImplemented(); 557 NOTIMPLEMENTED();
566 } 558 }
567 559
568 void EditorClientImpl::textFieldDidBeginEditing(WebCore::Element*) { 560 void EditorClientImpl::textFieldDidBeginEditing(WebCore::Element*) {
569 notImplemented(); 561 NOTIMPLEMENTED();
570 } 562 }
571 563
572 void EditorClientImpl::textFieldDidEndEditing(WebCore::Element*) { 564 void EditorClientImpl::textFieldDidEndEditing(WebCore::Element*) {
573 // Notification that focus was lost. 565 // Notification that focus was lost.
574 // Be careful with this, it's also sent when the page is being closed. 566 // Be careful with this, it's also sent when the page is being closed.
575 notImplemented(); 567 NOTIMPLEMENTED();
576 } 568 }
577 569
578 void EditorClientImpl::textDidChangeInTextField(WebCore::Element* element) { 570 void EditorClientImpl::textDidChangeInTextField(WebCore::Element* element) {
579 // Track the element so we can blur/focus it in respondToChangedContents 571 // Track the element so we can blur/focus it in respondToChangedContents
580 // so that the selected range is properly set. (See respondToChangedContents). 572 // so that the selected range is properly set. (See respondToChangedContents).
581 if (static_cast<WebCore::HTMLInputElement*>(element)->autofilled()) 573 if (static_cast<WebCore::HTMLInputElement*>(element)->autofilled())
582 pending_inline_autocompleted_element_ = element; 574 pending_inline_autocompleted_element_ = element;
583 } 575 }
584 576
585 bool EditorClientImpl::doTextFieldCommandFromEvent(WebCore::Element*, 577 bool EditorClientImpl::doTextFieldCommandFromEvent(WebCore::Element*,
586 WebCore::KeyboardEvent*) { 578 WebCore::KeyboardEvent*) {
587 // The Mac code appears to use this method as a hook to implement special 579 // The Mac code appears to use this method as a hook to implement special
588 // keyboard commands specific to Safari's auto-fill implementation. We 580 // keyboard commands specific to Safari's auto-fill implementation. We
589 // just return false to allow the default action. 581 // just return false to allow the default action.
590 return false; 582 return false;
591 } 583 }
592 584
593 void EditorClientImpl::textWillBeDeletedInTextField(WebCore::Element*) { 585 void EditorClientImpl::textWillBeDeletedInTextField(WebCore::Element*) {
594 notImplemented(); 586 NOTIMPLEMENTED();
595 } 587 }
596 588
597 void EditorClientImpl::textDidChangeInTextArea(WebCore::Element*) { 589 void EditorClientImpl::textDidChangeInTextArea(WebCore::Element*) {
598 notImplemented(); 590 NOTIMPLEMENTED();
599 } 591 }
600 592
601 #if defined(OS_MACOSX) 593 #if defined(OS_MACOSX)
602 // TODO(pinkerton): implement these when we get to copy/paste 594 // TODO(pinkerton): implement these when we get to copy/paste
603 NSData* EditorClientImpl::dataForArchivedSelection(WebCore::Frame*) { 595 NSData* EditorClientImpl::dataForArchivedSelection(WebCore::Frame*) {
604 notImplemented(); 596 NOTIMPLEMENTED();
605 } 597 }
606 598
607 NSString* EditorClientImpl::userVisibleString(NSURL*) { 599 NSString* EditorClientImpl::userVisibleString(NSURL*) {
608 notImplemented(); 600 NOTIMPLEMENTED();
609 } 601 }
610 602
611 #ifdef BUILDING_ON_TIGER 603 #ifdef BUILDING_ON_TIGER
612 NSArray* EditorClientImpl::pasteboardTypesForSelection(WebCore::Frame*) { 604 NSArray* EditorClientImpl::pasteboardTypesForSelection(WebCore::Frame*) {
613 notImplemented(); 605 NOTIMPLEMENTED();
614 } 606 }
615 #endif 607 #endif
616 #endif 608 #endif
617 609
618 void EditorClientImpl::ignoreWordInSpellDocument(const WebCore::String&) { 610 void EditorClientImpl::ignoreWordInSpellDocument(const WebCore::String&) {
619 notImplemented(); 611 NOTIMPLEMENTED();
620 } 612 }
621 613
622 void EditorClientImpl::learnWord(const WebCore::String&) { 614 void EditorClientImpl::learnWord(const WebCore::String&) {
623 notImplemented(); 615 NOTIMPLEMENTED();
624 } 616 }
625 617
626 void EditorClientImpl::checkSpellingOfString(const UChar* str, int length, 618 void EditorClientImpl::checkSpellingOfString(const UChar* str, int length,
627 int* misspellingLocation, 619 int* misspellingLocation,
628 int* misspellingLength) { 620 int* misspellingLength) {
629 // SpellCheckWord will write (0, 0) into the output vars, which is what our 621 // SpellCheckWord will write (0, 0) into the output vars, which is what our
630 // caller expects if the word is spelled correctly. 622 // caller expects if the word is spelled correctly.
631 int spell_location = -1; 623 int spell_location = -1;
632 int spell_length = 0; 624 int spell_length = 0;
633 WebViewDelegate* d = web_view_->delegate(); 625 WebViewDelegate* d = web_view_->delegate();
(...skipping 11 matching lines...) Expand all
645 if (misspellingLocation) 637 if (misspellingLocation)
646 *misspellingLocation = spell_location; 638 *misspellingLocation = spell_location;
647 if (misspellingLength) 639 if (misspellingLength)
648 *misspellingLength = spell_length; 640 *misspellingLength = spell_length;
649 } 641 }
650 642
651 void EditorClientImpl::checkGrammarOfString(const UChar*, int length, 643 void EditorClientImpl::checkGrammarOfString(const UChar*, int length,
652 WTF::Vector<WebCore::GrammarDetail>& , 644 WTF::Vector<WebCore::GrammarDetail>& ,
653 int* badGrammarLocation, 645 int* badGrammarLocation,
654 int* badGrammarLength) { 646 int* badGrammarLength) {
655 notImplemented(); 647 NOTIMPLEMENTED();
656 if (badGrammarLocation) 648 if (badGrammarLocation)
657 *badGrammarLocation = 0; 649 *badGrammarLocation = 0;
658 if (badGrammarLength) 650 if (badGrammarLength)
659 *badGrammarLength = 0; 651 *badGrammarLength = 0;
660 } 652 }
661 653
662 void EditorClientImpl::updateSpellingUIWithGrammarString(const WebCore::String&, 654 void EditorClientImpl::updateSpellingUIWithGrammarString(const WebCore::String&,
663 const WebCore::GrammarD etail& detail) { 655 const WebCore::GrammarD etail& detail) {
664 notImplemented(); 656 NOTIMPLEMENTED();
665 } 657 }
666 658
667 void EditorClientImpl::updateSpellingUIWithMisspelledWord(const WebCore::String& ) { 659 void EditorClientImpl::updateSpellingUIWithMisspelledWord(const WebCore::String& ) {
668 notImplemented(); 660 NOTIMPLEMENTED();
669 } 661 }
670 662
671 void EditorClientImpl::showSpellingUI(bool show) { 663 void EditorClientImpl::showSpellingUI(bool show) {
672 notImplemented(); 664 NOTIMPLEMENTED();
673 } 665 }
674 666
675 bool EditorClientImpl::spellingUIIsShowing() { 667 bool EditorClientImpl::spellingUIIsShowing() {
676 return false; 668 return false;
677 } 669 }
678 670
679 void EditorClientImpl::getGuessesForWord(const WebCore::String&, 671 void EditorClientImpl::getGuessesForWord(const WebCore::String&,
680 WTF::Vector<WebCore::String>& guesses) { 672 WTF::Vector<WebCore::String>& guesses) {
681 notImplemented(); 673 NOTIMPLEMENTED();
682 } 674 }
683 675
684 void EditorClientImpl::setInputMethodState(bool enabled) { 676 void EditorClientImpl::setInputMethodState(bool enabled) {
685 WebViewDelegate* d = web_view_->delegate(); 677 WebViewDelegate* d = web_view_->delegate();
686 if (d) { 678 if (d) {
687 d->SetInputMethodState(enabled); 679 d->SetInputMethodState(enabled);
688 } 680 }
689 } 681 }
690 682
691 683
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 return L"(UNKNOWN AFFINITY)"; 756 return L"(UNKNOWN AFFINITY)";
765 } 757 }
766 758
767 std::wstring EditorClientImpl::Describe(WebCore::CSSStyleDeclaration* style) { 759 std::wstring EditorClientImpl::Describe(WebCore::CSSStyleDeclaration* style) {
768 // TODO(pamg): Implement me. It's not clear what WebKit produces for this 760 // TODO(pamg): Implement me. It's not clear what WebKit produces for this
769 // (their [style description] method), and none of the layout tests provide 761 // (their [style description] method), and none of the layout tests provide
770 // an example. But because none of them use it, it's not yet important. 762 // an example. But because none of them use it, it's not yet important.
771 return std::wstring(); 763 return std::wstring();
772 } 764 }
773 765
OLDNEW
« no previous file with comments | « webkit/glue/chrome_client_impl.h ('k') | webkit/glue/resource_handle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698