OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 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 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 if (isNull()) | 1009 if (isNull()) |
1010 return false; | 1010 return false; |
1011 ASSERT(isOffsetInAnchor()); | 1011 ASSERT(isOffsetInAnchor()); |
1012 if (!anchorNode()->isTextNode()) | 1012 if (!anchorNode()->isTextNode()) |
1013 return false; | 1013 return false; |
1014 | 1014 |
1015 LayoutObject* layoutObject = anchorNode()->layoutObject(); | 1015 LayoutObject* layoutObject = anchorNode()->layoutObject(); |
1016 if (!layoutObject) | 1016 if (!layoutObject) |
1017 return false; | 1017 return false; |
1018 | 1018 |
1019 const int offset = offsetInContainerNode(); | 1019 return toLayoutText(layoutObject)->isRenderedCharacter(offsetInContainerNode
()); |
1020 LayoutText* textLayoutObject = toLayoutText(layoutObject); | |
1021 for (InlineTextBox* box = textLayoutObject->firstTextBox(); box; box = box->
nextTextBox()) { | |
1022 if (offset < static_cast<int>(box->start()) && !textLayoutObject->contai
nsReversedText()) { | |
1023 // The offset we're looking for is before this node | |
1024 // this means the offset must be in content that is | |
1025 // not laid out. Return false. | |
1026 return false; | |
1027 } | |
1028 if (offset >= static_cast<int>(box->start()) && offset < static_cast<int
>(box->start() + box->len())) | |
1029 return true; | |
1030 } | |
1031 | |
1032 return false; | |
1033 } | 1020 } |
1034 | 1021 |
1035 // TODO(yosin) We should move |rendersInDifferentPosition()to "htmlediting.cpp" | 1022 // TODO(yosin) We should move |rendersInDifferentPosition()to "htmlediting.cpp" |
1036 // with |renderedOffsetOf()|. | 1023 // with |renderedOffsetOf()|. |
1037 bool rendersInDifferentPosition(const Position& position1, const Position& posit
ion2) | 1024 bool rendersInDifferentPosition(const Position& position1, const Position& posit
ion2) |
1038 { | 1025 { |
1039 if (position1.isNull() || position2.isNull()) | 1026 if (position1.isNull() || position2.isNull()) |
1040 return false; | 1027 return false; |
1041 | 1028 |
1042 LayoutObject* layoutObject = position1.anchorNode()->layoutObject(); | 1029 LayoutObject* layoutObject = position1.anchorNode()->layoutObject(); |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 | 1508 |
1522 void showTree(const blink::Position* pos) | 1509 void showTree(const blink::Position* pos) |
1523 { | 1510 { |
1524 if (pos) | 1511 if (pos) |
1525 pos->showTreeForThis(); | 1512 pos->showTreeForThis(); |
1526 else | 1513 else |
1527 fprintf(stderr, "Cannot showTree for (nil)\n"); | 1514 fprintf(stderr, "Cannot showTree for (nil)\n"); |
1528 } | 1515 } |
1529 | 1516 |
1530 #endif | 1517 #endif |
OLD | NEW |