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

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

Issue 817693002: Handle null argument for Selection.selectAllChildren() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/editing/selection/selectAllChildren-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRang e->startContainer(), selectedRange->startOffset(), exceptionState) < 0 && !excep tionState.hadException()); 486 || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRang e->startContainer(), selectedRange->startOffset(), exceptionState) < 0 && !excep tionState.hadException());
487 ASSERT(!exceptionState.hadException()); 487 ASSERT(!exceptionState.hadException());
488 if (nodeFullyUnselected) 488 if (nodeFullyUnselected)
489 return false; 489 return false;
490 490
491 return allowPartial || n->isTextNode(); 491 return allowPartial || n->isTextNode();
492 } 492 }
493 493
494 void DOMSelection::selectAllChildren(Node* n, ExceptionState& exceptionState) 494 void DOMSelection::selectAllChildren(Node* n, ExceptionState& exceptionState)
495 { 495 {
496 ASSERT(n); 496 if (!n)
497 return;
497 498
498 // This doesn't (and shouldn't) select text node characters. 499 // This doesn't (and shouldn't) select text node characters.
499 setBaseAndExtent(n, 0, n, n->countChildren(), exceptionState); 500 setBaseAndExtent(n, 0, n, n->countChildren(), exceptionState);
500 } 501 }
501 502
502 String DOMSelection::toString() 503 String DOMSelection::toString()
503 { 504 {
504 if (!m_frame) 505 if (!m_frame)
505 return String(); 506 return String();
506 507
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message)); 560 m_treeScope->document().addConsoleMessage(ConsoleMessage::create(JSMessa geSource, ErrorMessageLevel, message));
560 } 561 }
561 562
562 void DOMSelection::trace(Visitor* visitor) 563 void DOMSelection::trace(Visitor* visitor)
563 { 564 {
564 visitor->trace(m_treeScope); 565 visitor->trace(m_treeScope);
565 DOMWindowProperty::trace(visitor); 566 DOMWindowProperty::trace(visitor);
566 } 567 }
567 568
568 } // namespace blink 569 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/selectAllChildren-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698