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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
574 return nullptr; | 574 return nullptr; |
575 return frame()->selection().documentCachedRange(); | 575 return frame()->selection().documentCachedRange(); |
576 } | 576 } |
577 | 577 |
578 void DOMSelection::clearCachedRangeIfSelectionOfDocument() { | 578 void DOMSelection::clearCachedRangeIfSelectionOfDocument() { |
579 if (!isSelectionOfDocument()) | 579 if (!isSelectionOfDocument()) |
580 return; | 580 return; |
581 frame()->selection().clearDocumentCachedRange(); | 581 frame()->selection().clearDocumentCachedRange(); |
582 } | 582 } |
583 | 583 |
584 void DOMSelection::removeRange(Range* range) { | |
585 DCHECK(range); | |
586 if (!isAvailable()) | |
587 return; | |
588 if (range == primaryRangeOrNull()) | |
yosin_UTC9
2017/02/24 14:47:55
nit: I prefer early-return style:
if (range != pr
tkent
2017/02/24 17:44:12
I prefer early-return in general. However, not-ea
| |
589 frame()->selection().clear(); | |
590 } | |
591 | |
584 void DOMSelection::removeAllRanges() { | 592 void DOMSelection::removeAllRanges() { |
585 if (!isAvailable()) | 593 if (!isAvailable()) |
586 return; | 594 return; |
587 frame()->selection().clear(); | 595 frame()->selection().clear(); |
588 } | 596 } |
589 | 597 |
590 void DOMSelection::addRange(Range* newRange) { | 598 void DOMSelection::addRange(Range* newRange) { |
591 DCHECK(newRange); | 599 DCHECK(newRange); |
592 | 600 |
593 if (!isAvailable()) | 601 if (!isAvailable()) |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 m_treeScope->document().addConsoleMessage( | 815 m_treeScope->document().addConsoleMessage( |
808 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); | 816 ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message)); |
809 } | 817 } |
810 | 818 |
811 DEFINE_TRACE(DOMSelection) { | 819 DEFINE_TRACE(DOMSelection) { |
812 visitor->trace(m_treeScope); | 820 visitor->trace(m_treeScope); |
813 ContextClient::trace(visitor); | 821 ContextClient::trace(visitor); |
814 } | 822 } |
815 | 823 |
816 } // namespace blink | 824 } // namespace blink |
OLD | NEW |