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

Side by Side Diff: Source/core/page/DragController.cpp

Issue 26237004: Remove unused editing related member functions from WebViewClient (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-10-09T17:59:14 Created 7 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 | « Source/core/loader/EmptyClients.h ('k') | Source/core/page/EditorClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Google Inc. 3 * Copyright (C) 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 488
489 // For range to be null a WebKit client must have done something bad while 489 // For range to be null a WebKit client must have done something bad while
490 // manually controlling drag behaviour 490 // manually controlling drag behaviour
491 if (!range) 491 if (!range)
492 return false; 492 return false;
493 ResourceFetcher* fetcher = range->ownerDocument().fetcher(); 493 ResourceFetcher* fetcher = range->ownerDocument().fetcher();
494 ResourceCacheValidationSuppressor validationSuppressor(fetcher); 494 ResourceCacheValidationSuppressor validationSuppressor(fetcher);
495 if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRich lyEditable()) { 495 if (dragIsMove(innerFrame->selection(), dragData) || dragCaret.isContentRich lyEditable()) {
496 bool chosePlainText = false; 496 bool chosePlainText = false;
497 RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragDat a, innerFrame.get(), range, true, chosePlainText); 497 RefPtr<DocumentFragment> fragment = documentFragmentFromDragData(dragDat a, innerFrame.get(), range, true, chosePlainText);
498 if (!fragment || !innerFrame->editor().shouldInsertFragment(fragment, ra nge, EditorInsertActionDropped)) { 498 if (!fragment)
499 return false; 499 return false;
500 }
501 500
502 if (dragIsMove(innerFrame->selection(), dragData)) { 501 if (dragIsMove(innerFrame->selection(), dragData)) {
503 // NSTextView behavior is to always smart delete on moving a selecti on, 502 // NSTextView behavior is to always smart delete on moving a selecti on,
504 // but only to smart insert if the selection granularity is word gra nularity. 503 // but only to smart insert if the selection granularity is word gra nularity.
505 bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled(); 504 bool smartDelete = innerFrame->editor().smartInsertDeleteEnabled();
506 bool smartInsert = smartDelete && innerFrame->selection().granularit y() == WordGranularity && dragData->canSmartReplace(); 505 bool smartInsert = smartDelete && innerFrame->selection().granularit y() == WordGranularity && dragData->canSmartReplace();
507 MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert , smartDelete)->apply(); 506 MoveSelectionCommand::create(fragment, dragCaret.base(), smartInsert , smartDelete)->apply();
508 } else { 507 } else {
509 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, poin t)) { 508 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, poin t)) {
510 ReplaceSelectionCommand::CommandOptions options = ReplaceSelecti onCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting; 509 ReplaceSelectionCommand::CommandOptions options = ReplaceSelecti onCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
511 if (dragData->canSmartReplace()) 510 if (dragData->canSmartReplace())
512 options |= ReplaceSelectionCommand::SmartReplace; 511 options |= ReplaceSelectionCommand::SmartReplace;
513 if (chosePlainText) 512 if (chosePlainText)
514 options |= ReplaceSelectionCommand::MatchStyle; 513 options |= ReplaceSelectionCommand::MatchStyle;
515 ASSERT(m_documentUnderMouse); 514 ASSERT(m_documentUnderMouse);
516 ReplaceSelectionCommand::create(*m_documentUnderMouse.get(), fra gment, options)->apply(); 515 ReplaceSelectionCommand::create(*m_documentUnderMouse.get(), fra gment, options)->apply();
517 } 516 }
518 } 517 }
519 } else { 518 } else {
520 String text = dragData->asPlainText(innerFrame.get()); 519 String text = dragData->asPlainText(innerFrame.get());
521 if (text.isEmpty() || !innerFrame->editor().shouldInsertText(text, range .get(), EditorInsertActionDropped)) { 520 if (text.isEmpty())
522 return false; 521 return false;
523 }
524 522
525 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) { 523 if (setSelectionToDragCaret(innerFrame.get(), dragCaret, range, point)) {
526 ASSERT(m_documentUnderMouse); 524 ASSERT(m_documentUnderMouse);
527 ReplaceSelectionCommand::create(*m_documentUnderMouse.get(), createF ragmentFromText(range.get(), text), ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting) ->apply(); 525 ReplaceSelectionCommand::create(*m_documentUnderMouse.get(), createF ragmentFromText(range.get(), text), ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::MatchStyle | ReplaceSelectionCommand::PreventNesting) ->apply();
528 } 526 }
529 } 527 }
530 528
531 if (rootEditableElement) { 529 if (rootEditableElement) {
532 if (Frame* frame = rootEditableElement->document().frame()) 530 if (Frame* frame = rootEditableElement->document().frame())
533 frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEdit ableElement.get()); 531 frame->eventHandler()->updateDragStateAfterEditDragIfNeeded(rootEdit ableElement.get());
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 return false; 926 return false;
929 #endif 927 #endif
930 } 928 }
931 929
932 void DragController::cleanupAfterSystemDrag() 930 void DragController::cleanupAfterSystemDrag()
933 { 931 {
934 } 932 }
935 933
936 } // namespace WebCore 934 } // namespace WebCore
937 935
OLDNEW
« no previous file with comments | « Source/core/loader/EmptyClients.h ('k') | Source/core/page/EditorClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698