OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 if (!position.anchorNode()) | 388 if (!position.anchorNode()) |
389 return false; | 389 return false; |
390 | 390 |
391 if (position.anchorNode() == node) | 391 if (position.anchorNode() == node) |
392 return true; | 392 return true; |
393 | 393 |
394 if (!node.isElementNode()) | 394 if (!node.isElementNode()) |
395 return false; | 395 return false; |
396 | 396 |
397 Element& element = toElement(node); | 397 Element& element = toElement(node); |
398 return element.containsIncludingShadowDOM(position.anchorNode()); | 398 return element.isShadowIncludingInclusiveAncestorOf(position.anchorNode()); |
399 } | 399 } |
400 | 400 |
401 void FrameSelection::nodeWillBeRemoved(Node& node) | 401 void FrameSelection::nodeWillBeRemoved(Node& node) |
402 { | 402 { |
403 // There can't be a selection inside a fragment, so if a fragment's node is
being removed, | 403 // There can't be a selection inside a fragment, so if a fragment's node is
being removed, |
404 // the selection in the document that created the fragment needs no adjustme
nt. | 404 // the selection in the document that created the fragment needs no adjustme
nt. |
405 if (isNone() || !node.inActiveDocument()) | 405 if (isNone() || !node.inActiveDocument()) |
406 return; | 406 return; |
407 | 407 |
408 respondToNodeModification(node, removingNodeRemovesPosition(node, selection(
).base()), removingNodeRemovesPosition(node, selection().extent()), | 408 respondToNodeModification(node, removingNodeRemovesPosition(node, selection(
).base()), removingNodeRemovesPosition(node, selection().extent()), |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 return false; | 1049 return false; |
1050 | 1050 |
1051 Element* root = rootEditableElement(); | 1051 Element* root = rootEditableElement(); |
1052 if (!root) | 1052 if (!root) |
1053 return false; | 1053 return false; |
1054 | 1054 |
1055 Element* focusedElement = root->document().focusedElement(); | 1055 Element* focusedElement = root->document().focusedElement(); |
1056 if (!focusedElement) | 1056 if (!focusedElement) |
1057 return false; | 1057 return false; |
1058 | 1058 |
1059 return focusedElement->containsIncludingShadowDOM(selection().start().anchor
Node()); | 1059 return focusedElement->isShadowIncludingInclusiveAncestorOf(selection().star
t().anchorNode()); |
1060 } | 1060 } |
1061 | 1061 |
1062 void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*) | 1062 void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*) |
1063 { | 1063 { |
1064 ASSERT(m_caretBase->caretIsVisible()); | 1064 ASSERT(m_caretBase->caretIsVisible()); |
1065 ASSERT(isCaret()); | 1065 ASSERT(isCaret()); |
1066 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) | 1066 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) |
1067 return; | 1067 return; |
1068 m_shouldPaintCaret = !m_shouldPaintCaret; | 1068 m_shouldPaintCaret = !m_shouldPaintCaret; |
1069 setCaretRectNeedsUpdate(); | 1069 setCaretRectNeedsUpdate(); |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 | 1422 |
1423 void showTree(const blink::FrameSelection* sel) | 1423 void showTree(const blink::FrameSelection* sel) |
1424 { | 1424 { |
1425 if (sel) | 1425 if (sel) |
1426 sel->showTreeForThis(); | 1426 sel->showTreeForThis(); |
1427 else | 1427 else |
1428 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); | 1428 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); |
1429 } | 1429 } |
1430 | 1430 |
1431 #endif | 1431 #endif |
OLD | NEW |