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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 | 447 |
448 RefPtrWillBeRawPtr<Range> selectedRange = selection.selection().toNormalized Range(); | 448 RefPtrWillBeRawPtr<Range> selectedRange = selection.selection().toNormalized Range(); |
449 if (!selectedRange) | 449 if (!selectedRange) |
450 return; | 450 return; |
451 | 451 |
452 selectedRange->deleteContents(ASSERT_NO_EXCEPTION); | 452 selectedRange->deleteContents(ASSERT_NO_EXCEPTION); |
453 | 453 |
454 setBaseAndExtent(selectedRange->startContainer(), selectedRange->startOffset (), selectedRange->startContainer(), selectedRange->startOffset(), ASSERT_NO_EXC EPTION); | 454 setBaseAndExtent(selectedRange->startContainer(), selectedRange->startOffset (), selectedRange->startContainer(), selectedRange->startOffset(), ASSERT_NO_EXC EPTION); |
455 } | 455 } |
456 | 456 |
457 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const | 457 bool DOMSelection::containsNode(const Node* n, bool allowPartial) const |
philipj_slow
2015/08/31 14:48:21
ASSERT(n) at the top of this method so that it's v
tanay.c
2015/09/01 10:58:08
Done.
| |
458 { | 458 { |
459 if (!m_frame) | 459 if (!m_frame) |
460 return false; | 460 return false; |
461 | 461 |
462 FrameSelection& selection = m_frame->selection(); | 462 FrameSelection& selection = m_frame->selection(); |
463 | 463 |
464 if (!n || m_frame->document() != n->document() || selection.isNone()) | 464 if (m_frame->document() != n->document() || selection.isNone()) |
465 return false; | 465 return false; |
466 | 466 |
467 unsigned nodeIndex = n->nodeIndex(); | 467 unsigned nodeIndex = n->nodeIndex(); |
468 const EphemeralRange selectedRange = selection.selection().toNormalizedEphem eralRange(); | 468 const EphemeralRange selectedRange = selection.selection().toNormalizedEphem eralRange(); |
469 | 469 |
470 ContainerNode* parentNode = n->parentNode(); | 470 ContainerNode* parentNode = n->parentNode(); |
471 if (!parentNode) | 471 if (!parentNode) |
472 return false; | 472 return false; |
473 | 473 |
474 const Position startPosition = selectedRange.startPosition().toOffsetInAncho r(); | 474 const Position startPosition = selectedRange.startPosition().toOffsetInAncho r(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); | 556 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); |
557 } | 557 } |
558 | 558 |
559 DEFINE_TRACE(DOMSelection) | 559 DEFINE_TRACE(DOMSelection) |
560 { | 560 { |
561 visitor->trace(m_treeScope); | 561 visitor->trace(m_treeScope); |
562 DOMWindowProperty::trace(visitor); | 562 DOMWindowProperty::trace(visitor); |
563 } | 563 } |
564 | 564 |
565 } // namespace blink | 565 } // namespace blink |
OLD | NEW |