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

Side by Side Diff: Source/core/editing/Editor.cpp

Issue 204673007: Move didChangeSelection to WebFrameClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/core/loader/EmptyClients.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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 bool Editor::shouldDeleteRange(Range* range) const 518 bool Editor::shouldDeleteRange(Range* range) const
519 { 519 {
520 if (!range || range->collapsed(IGNORE_EXCEPTION)) 520 if (!range || range->collapsed(IGNORE_EXCEPTION))
521 return false; 521 return false;
522 522
523 return canDeleteRange(range); 523 return canDeleteRange(range);
524 } 524 }
525 525
526 void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelec tion, FrameSelection::SetSelectionOptions options) 526 void Editor::notifyComponentsOnChangedSelection(const VisibleSelection& oldSelec tion, FrameSelection::SetSelectionOptions options)
527 { 527 {
528 client().respondToChangedSelection(m_frame.selection().selectionType()); 528 client().respondToChangedSelection(&m_frame, m_frame.selection().selectionTy pe());
529 setStartNewKillRingSequence(true); 529 setStartNewKillRingSequence(true);
530 } 530 }
531 531
532 void Editor::respondToChangedContents(const VisibleSelection& endingSelection) 532 void Editor::respondToChangedContents(const VisibleSelection& endingSelection)
533 { 533 {
534 if (AXObjectCache::accessibilityEnabled()) { 534 if (AXObjectCache::accessibilityEnabled()) {
535 Node* node = endingSelection.start().deprecatedNode(); 535 Node* node = endingSelection.start().deprecatedNode();
536 if (AXObjectCache* cache = m_frame.document()->existingAXObjectCache()) 536 if (AXObjectCache* cache = m_frame.document()->existingAXObjectCache())
537 cache->postNotification(node, AXObjectCache::AXValueChanged, false); 537 cache->postNotification(node, AXObjectCache::AXValueChanged, false);
538 } 538 }
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 m_frame.selection().setSelection(newSelection, options); 1038 m_frame.selection().setSelection(newSelection, options);
1039 1039
1040 // Some editing operations change the selection visually without affecting i ts position within the DOM. 1040 // Some editing operations change the selection visually without affecting i ts position within the DOM.
1041 // For example when you press return in the following (the caret is marked b y ^): 1041 // For example when you press return in the following (the caret is marked b y ^):
1042 // <div contentEditable="true"><div>^Hello</div></div> 1042 // <div contentEditable="true"><div>^Hello</div></div>
1043 // WebCore inserts <div><br></div> *before* the current block, which correct ly moves the paragraph down but which doesn't 1043 // WebCore inserts <div><br></div> *before* the current block, which correct ly moves the paragraph down but which doesn't
1044 // change the caret's DOM position (["hello", 0]). In these situations the a bove FrameSelection::setSelection call 1044 // change the caret's DOM position (["hello", 0]). In these situations the a bove FrameSelection::setSelection call
1045 // does not call EditorClient::respondToChangedSelection(), which, on the Ma c, sends selection change notifications and 1045 // does not call EditorClient::respondToChangedSelection(), which, on the Ma c, sends selection change notifications and
1046 // starts a new kill ring sequence, but we want to do these things (matches AppKit). 1046 // starts a new kill ring sequence, but we want to do these things (matches AppKit).
1047 if (selectionDidNotChangeDOMPosition) 1047 if (selectionDidNotChangeDOMPosition)
1048 client().respondToChangedSelection(m_frame.selection().selectionType()); 1048 client().respondToChangedSelection(&m_frame, m_frame.selection().selecti onType());
1049 } 1049 }
1050 1050
1051 IntRect Editor::firstRectForRange(Range* range) const 1051 IntRect Editor::firstRectForRange(Range* range) const
1052 { 1052 {
1053 LayoutUnit extraWidthToEndOfLine = 0; 1053 LayoutUnit extraWidthToEndOfLine = 0;
1054 ASSERT(range->startContainer()); 1054 ASSERT(range->startContainer());
1055 ASSERT(range->endContainer()); 1055 ASSERT(range->endContainer());
1056 1056
1057 IntRect startCaretRect = RenderedPosition(VisiblePosition(range->startPositi on()).deepEquivalent(), DOWNSTREAM).absoluteRect(&extraWidthToEndOfLine); 1057 IntRect startCaretRect = RenderedPosition(VisiblePosition(range->startPositi on()).deepEquivalent(), DOWNSTREAM).absoluteRect(&extraWidthToEndOfLine);
1058 if (startCaretRect == LayoutRect()) 1058 if (startCaretRect == LayoutRect())
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 return m_frame.spellChecker(); 1230 return m_frame.spellChecker();
1231 } 1231 }
1232 1232
1233 void Editor::toggleOverwriteModeEnabled() 1233 void Editor::toggleOverwriteModeEnabled()
1234 { 1234 {
1235 m_overwriteModeEnabled = !m_overwriteModeEnabled; 1235 m_overwriteModeEnabled = !m_overwriteModeEnabled;
1236 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); 1236 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled);
1237 } 1237 }
1238 1238
1239 } // namespace WebCore 1239 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/EmptyClients.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698