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

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

Issue 212873002: Remove Selection.containsNode assertion that is not valid. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix spacing Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/editing/selection/contains-node-cleared-document-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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 unsigned nodeIndex = n->nodeIndex(); 474 unsigned nodeIndex = n->nodeIndex();
475 RefPtr<Range> selectedRange = selection.selection().toNormalizedRange(); 475 RefPtr<Range> selectedRange = selection.selection().toNormalizedRange();
476 476
477 ContainerNode* parentNode = n->parentNode(); 477 ContainerNode* parentNode = n->parentNode();
478 if (!parentNode) 478 if (!parentNode)
479 return false; 479 return false;
480 480
481 TrackExceptionState exceptionState; 481 TrackExceptionState exceptionState;
482 bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), exceptionState) >= 0 && !exceptionState.hadException() 482 bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), exceptionState) >= 0 && !exceptionState.hadException()
483 && Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange ->endContainer(), selectedRange->endOffset(), exceptionState) <= 0 && !exception State.hadException(); 483 && Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange ->endContainer(), selectedRange->endOffset(), exceptionState) <= 0 && !exception State.hadException();
484 ASSERT(!exceptionState.hadException()); 484 if (exceptionState.hadException())
485 return false;
485 if (nodeFullySelected) 486 if (nodeFullySelected)
486 return true; 487 return true;
487 488
488 bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeInd ex, selectedRange->endContainer(), selectedRange->endOffset(), exceptionState) > 0 && !exceptionState.hadException()) 489 bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeInd ex, selectedRange->endContainer(), selectedRange->endOffset(), exceptionState) > 0 && !exceptionState.hadException())
489 || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRang e->startContainer(), selectedRange->startOffset(), exceptionState) < 0 && !excep tionState.hadException()); 490 || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRang e->startContainer(), selectedRange->startOffset(), exceptionState) < 0 && !excep tionState.hadException());
490 ASSERT(!exceptionState.hadException()); 491 ASSERT(!exceptionState.hadException());
491 if (nodeFullyUnselected) 492 if (nodeFullyUnselected)
492 return false; 493 return false;
493 494
494 return allowPartial || n->isTextNode(); 495 return allowPartial || n->isTextNode();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return node->document() == m_frame->document(); 555 return node->document() == m_frame->document();
555 } 556 }
556 557
557 void DOMSelection::addConsoleError(const String& message) 558 void DOMSelection::addConsoleError(const String& message)
558 { 559 {
559 if (m_treeScope) 560 if (m_treeScope)
560 m_treeScope->document().addConsoleMessage(JSMessageSource, ErrorMessageL evel, message); 561 m_treeScope->document().addConsoleMessage(JSMessageSource, ErrorMessageL evel, message);
561 } 562 }
562 563
563 } // namespace WebCore 564 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/contains-node-cleared-document-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698