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

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

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 void DOMSelection::addRange(Range* newRange) 410 void DOMSelection::addRange(Range* newRange)
411 { 411 {
412 DCHECK(newRange); 412 DCHECK(newRange);
413 413
414 if (!isAvailable()) 414 if (!isAvailable())
415 return; 415 return;
416 416
417 if (newRange->ownerDocument() != m_frame->document()) 417 if (newRange->ownerDocument() != m_frame->document())
418 return; 418 return;
419 419
420 if (!newRange->inShadowIncludingDocument()) { 420 if (!newRange->isConnected()) {
421 addConsoleError("The given range isn't in document."); 421 addConsoleError("The given range isn't in document.");
422 return; 422 return;
423 } 423 }
424 424
425 FrameSelection& selection = m_frame->selection(); 425 FrameSelection& selection = m_frame->selection();
426 426
427 if (newRange->ownerDocument() != selection.document()) { 427 if (newRange->ownerDocument() != selection.document()) {
428 // "editing/selection/selection-in-iframe-removed-crash.html" goes here. 428 // "editing/selection/selection-in-iframe-removed-crash.html" goes here.
429 return; 429 return;
430 } 430 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 return position.computeOffsetInContainerNode(); 570 return position.computeOffsetInContainerNode();
571 571
572 return adjustedNode->nodeIndex(); 572 return adjustedNode->nodeIndex();
573 } 573 }
574 574
575 bool DOMSelection::isValidForPosition(Node* node) const 575 bool DOMSelection::isValidForPosition(Node* node) const
576 { 576 {
577 DCHECK(m_frame); 577 DCHECK(m_frame);
578 if (!node) 578 if (!node)
579 return true; 579 return true;
580 return node->document() == m_frame->document() && node->inShadowIncludingDoc ument(); 580 return node->document() == m_frame->document() && node->isConnected();
581 } 581 }
582 582
583 void DOMSelection::addConsoleError(const String& message) 583 void DOMSelection::addConsoleError(const String& message)
584 { 584 {
585 if (m_treeScope) 585 if (m_treeScope)
586 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 586 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
587 } 587 }
588 588
589 DEFINE_TRACE(DOMSelection) 589 DEFINE_TRACE(DOMSelection)
590 { 590 {
591 visitor->trace(m_treeScope); 591 visitor->trace(m_treeScope);
592 DOMWindowProperty::trace(visitor); 592 DOMWindowProperty::trace(visitor);
593 } 593 }
594 594
595 } // namespace blink 595 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp ('k') | third_party/WebKit/Source/core/editing/EphemeralRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698