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

Side by Side Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 1377963004: Use FrameSelection::selectedText where possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 506
507 // This doesn't (and shouldn't) select text node characters. 507 // This doesn't (and shouldn't) select text node characters.
508 setBaseAndExtent(n, 0, n, n->countChildren(), exceptionState); 508 setBaseAndExtent(n, 0, n, n->countChildren(), exceptionState);
509 } 509 }
510 510
511 String DOMSelection::toString() 511 String DOMSelection::toString()
512 { 512 {
513 if (!m_frame) 513 if (!m_frame)
514 return String(); 514 return String();
515 515
516 const EphemeralRange range = m_frame->selection().selection().toNormalizedEp hemeralRange(); 516 return m_frame->selection().selectedText(TextIteratorForSelectionToString);
yosin_UTC9 2015/10/06 05:41:51 Since we can't change behavior Selection.toString(
517 return plainText(range, TextIteratorForSelectionToString);
518 } 517 }
519 518
520 Node* DOMSelection::shadowAdjustedNode(const Position& position) const 519 Node* DOMSelection::shadowAdjustedNode(const Position& position) const
521 { 520 {
522 if (position.isNull()) 521 if (position.isNull())
523 return 0; 522 return 0;
524 523
525 Node* containerNode = position.computeContainerNode(); 524 Node* containerNode = position.computeContainerNode();
526 Node* adjustedNode = m_treeScope->ancestorInThisScope(containerNode); 525 Node* adjustedNode = m_treeScope->ancestorInThisScope(containerNode);
527 526
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 565 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
567 } 566 }
568 567
569 DEFINE_TRACE(DOMSelection) 568 DEFINE_TRACE(DOMSelection)
570 { 569 {
571 visitor->trace(m_treeScope); 570 visitor->trace(m_treeScope);
572 DOMWindowProperty::trace(visitor); 571 DOMWindowProperty::trace(visitor);
573 } 572 }
574 573
575 } // namespace blink 574 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698