OLD | NEW |
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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 return nullptr; | 581 return nullptr; |
582 return frame()->selection().documentCachedRange(); | 582 return frame()->selection().documentCachedRange(); |
583 } | 583 } |
584 | 584 |
585 void DOMSelection::clearCachedRangeIfSelectionOfDocument() { | 585 void DOMSelection::clearCachedRangeIfSelectionOfDocument() { |
586 if (!isSelectionOfDocument()) | 586 if (!isSelectionOfDocument()) |
587 return; | 587 return; |
588 frame()->selection().clearDocumentCachedRange(); | 588 frame()->selection().clearDocumentCachedRange(); |
589 } | 589 } |
590 | 590 |
| 591 void DOMSelection::removeRange(Range* range) { |
| 592 DCHECK(range); |
| 593 if (!isAvailable()) |
| 594 return; |
| 595 if (range == primaryRangeOrNull()) |
| 596 frame()->selection().clear(); |
| 597 } |
| 598 |
591 void DOMSelection::removeAllRanges() { | 599 void DOMSelection::removeAllRanges() { |
592 if (!isAvailable()) | 600 if (!isAvailable()) |
593 return; | 601 return; |
594 frame()->selection().clear(); | 602 frame()->selection().clear(); |
595 } | 603 } |
596 | 604 |
597 void DOMSelection::addRange(Range* newRange) { | 605 void DOMSelection::addRange(Range* newRange) { |
598 DCHECK(newRange); | 606 DCHECK(newRange); |
599 | 607 |
600 if (!isAvailable()) | 608 if (!isAvailable()) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 m_treeScope->document().addConsoleMessage( | 825 m_treeScope->document().addConsoleMessage( |
818 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 826 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
819 } | 827 } |
820 | 828 |
821 DEFINE_TRACE(DOMSelection) { | 829 DEFINE_TRACE(DOMSelection) { |
822 visitor->trace(m_treeScope); | 830 visitor->trace(m_treeScope); |
823 ContextClient::trace(visitor); | 831 ContextClient::trace(visitor); |
824 } | 832 } |
825 | 833 |
826 } // namespace blink | 834 } // namespace blink |
OLD | NEW |