Chromium Code Reviews| 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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()); |
|
haraken
2014/03/26 13:06:30
How about this ASSERT? Should we also fix this one
Mads Ager (chromium)
2014/03/26 13:18:00
I honestly don't know. I'm hoping that someone fam
| |
| 491 if (nodeFullyUnselected) | 492 if (nodeFullyUnselected) |
| 492 return false; | 493 return false; |
| 493 | 494 |
| 494 return allowPartial || n->isTextNode(); | 495 return allowPartial || n->isTextNode(); |
| 495 } | 496 } |
| 496 | 497 |
| 497 void DOMSelection::selectAllChildren(Node* n, ExceptionState& exceptionState) | 498 void DOMSelection::selectAllChildren(Node* n, ExceptionState& exceptionState) |
| 498 { | 499 { |
| 499 if (!n) | 500 if (!n) |
| 500 return; | 501 return; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| OLD | NEW |