| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 bool VisibleSelection::expandUsingGranularityInComposedTree(TextGranularity gran
ularity) | 331 bool VisibleSelection::expandUsingGranularityInComposedTree(TextGranularity gran
ularity) |
| 332 { | 332 { |
| 333 m_base = toPositionInDOMTree(baseInComposedTree()); | 333 m_base = toPositionInDOMTree(baseInComposedTree()); |
| 334 m_extent = toPositionInDOMTree(extentInComposedTree()); | 334 m_extent = toPositionInDOMTree(extentInComposedTree()); |
| 335 return expandUsingGranularity(granularity); | 335 return expandUsingGranularity(granularity); |
| 336 } | 336 } |
| 337 | 337 |
| 338 static PassRefPtrWillBeRawPtr<Range> makeSearchRange(const Position& pos) | 338 static PassRefPtrWillBeRawPtr<Range> makeSearchRange(const Position& pos) |
| 339 { | 339 { |
| 340 Node* node = pos.deprecatedNode(); | 340 Node* node = pos.anchorNode(); |
| 341 if (!node) | 341 if (!node) |
| 342 return nullptr; | 342 return nullptr; |
| 343 Document& document = node->document(); | 343 Document& document = node->document(); |
| 344 if (!document.documentElement()) | 344 if (!document.documentElement()) |
| 345 return nullptr; | 345 return nullptr; |
| 346 Element* boundary = enclosingBlockFlowElement(*node); | 346 Element* boundary = enclosingBlockFlowElement(*node); |
| 347 if (!boundary) | 347 if (!boundary) |
| 348 return nullptr; | 348 return nullptr; |
| 349 | 349 |
| 350 RefPtrWillBeRawPtr<Range> searchRange(Range::create(document)); | 350 RefPtrWillBeRawPtr<Range> searchRange(Range::create(document)); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 // Edge case: If the caret is after the last word in a paragraph, select
from the the end of the | 487 // Edge case: If the caret is after the last word in a paragraph, select
from the the end of the |
| 488 // last word to the line break (also RightWordIfOnBoundary); | 488 // last word to the line break (also RightWordIfOnBoundary); |
| 489 VisiblePosition originalEnd(m_end, m_affinity); | 489 VisiblePosition originalEnd(m_end, m_affinity); |
| 490 EWordSide side = wordSide; | 490 EWordSide side = wordSide; |
| 491 if (isEndOfEditableOrNonEditableContent(originalEnd) || (isEndOfLine(ori
ginalEnd) && !isStartOfLine(originalEnd) && !isEndOfParagraph(originalEnd))) | 491 if (isEndOfEditableOrNonEditableContent(originalEnd) || (isEndOfLine(ori
ginalEnd) && !isStartOfLine(originalEnd) && !isEndOfParagraph(originalEnd))) |
| 492 side = LeftWordIfOnBoundary; | 492 side = LeftWordIfOnBoundary; |
| 493 | 493 |
| 494 VisiblePosition wordEnd(endOfWord(originalEnd, side)); | 494 VisiblePosition wordEnd(endOfWord(originalEnd, side)); |
| 495 VisiblePosition end(wordEnd); | 495 VisiblePosition end(wordEnd); |
| 496 | 496 |
| 497 if (isEndOfParagraph(originalEnd) && !isEmptyTableCell(m_start.deprecate
dNode())) { | 497 if (isEndOfParagraph(originalEnd) && !isEmptyTableCell(m_start.anchorNod
e())) { |
| 498 // Select the paragraph break (the space from the end of a paragraph
to the start of | 498 // Select the paragraph break (the space from the end of a paragraph
to the start of |
| 499 // the next one) to match TextEdit. | 499 // the next one) to match TextEdit. |
| 500 end = wordEnd.next(); | 500 end = wordEnd.next(); |
| 501 | 501 |
| 502 if (Element* table = isFirstPositionAfterTable(end)) { | 502 if (Element* table = isFirstPositionAfterTable(end)) { |
| 503 // The paragraph break after the last paragraph in the last cell
of a block table ends | 503 // The paragraph break after the last paragraph in the last cell
of a block table ends |
| 504 // at the start of the paragraph after the table. | 504 // at the start of the paragraph after the table. |
| 505 if (isBlock(table)) | 505 if (isBlock(table)) |
| 506 end = end.next(CannotCrossEditingBoundary); | 506 end = end.next(CannotCrossEditingBoundary); |
| 507 else | 507 else |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 return isRichlyEditablePosition(start()); | 1057 return isRichlyEditablePosition(start()); |
| 1058 } | 1058 } |
| 1059 | 1059 |
| 1060 Element* VisibleSelection::rootEditableElement() const | 1060 Element* VisibleSelection::rootEditableElement() const |
| 1061 { | 1061 { |
| 1062 return editableRootForPosition(start()); | 1062 return editableRootForPosition(start()); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 Node* VisibleSelection::nonBoundaryShadowTreeRootNode() const | 1065 Node* VisibleSelection::nonBoundaryShadowTreeRootNode() const |
| 1066 { | 1066 { |
| 1067 return start().deprecatedNode() && !start().deprecatedNode()->isShadowRoot()
? start().deprecatedNode()->nonBoundaryShadowTreeRootNode() : 0; | 1067 return start().anchorNode() && !start().anchorNode()->isShadowRoot() ? start
().anchorNode()->nonBoundaryShadowTreeRootNode() : 0; |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 VisibleSelection::ChangeObserver::ChangeObserver() | 1070 VisibleSelection::ChangeObserver::ChangeObserver() |
| 1071 { | 1071 { |
| 1072 } | 1072 } |
| 1073 | 1073 |
| 1074 VisibleSelection::ChangeObserver::~ChangeObserver() | 1074 VisibleSelection::ChangeObserver::~ChangeObserver() |
| 1075 { | 1075 { |
| 1076 } | 1076 } |
| 1077 | 1077 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 sel.showTreeForThis(); | 1240 sel.showTreeForThis(); |
| 1241 } | 1241 } |
| 1242 | 1242 |
| 1243 void showTree(const blink::VisibleSelection* sel) | 1243 void showTree(const blink::VisibleSelection* sel) |
| 1244 { | 1244 { |
| 1245 if (sel) | 1245 if (sel) |
| 1246 sel->showTreeForThis(); | 1246 sel->showTreeForThis(); |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 #endif | 1249 #endif |
| OLD | NEW |