OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 { | 568 { |
569 return n && n->renderer() && n->renderer()->isListItem(); | 569 return n && n->renderer() && n->renderer()->isListItem(); |
570 } | 570 } |
571 | 571 |
572 Element* enclosingElementWithTag(const Position& p, const QualifiedName& tagName
) | 572 Element* enclosingElementWithTag(const Position& p, const QualifiedName& tagName
) |
573 { | 573 { |
574 if (p.isNull()) | 574 if (p.isNull()) |
575 return 0; | 575 return 0; |
576 | 576 |
577 ContainerNode* root = highestEditableRoot(p); | 577 ContainerNode* root = highestEditableRoot(p); |
578 for (Element* ancestor = ElementTraversal::firstAncestorOrSelf(*p.deprecated
Node()); ancestor; ancestor = ElementTraversal::firstAncestor(*ancestor)) { | 578 Element* ancestor = p.deprecatedNode()->isElementNode() ? toElement(p.deprec
atedNode()) : p.deprecatedNode()->parentElement(); |
| 579 for (; ancestor; ancestor = ancestor->parentElement()) { |
579 if (root && !ancestor->hasEditableStyle()) | 580 if (root && !ancestor->hasEditableStyle()) |
580 continue; | 581 continue; |
581 if (ancestor->hasTagName(tagName)) | 582 if (ancestor->hasTagName(tagName)) |
582 return ancestor; | 583 return ancestor; |
583 if (ancestor == root) | 584 if (ancestor == root) |
584 return 0; | 585 return 0; |
585 } | 586 } |
586 | 587 |
587 return 0; | 588 return 0; |
588 } | 589 } |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 // if the selection starts just before a paragraph break, skip over it | 1225 // if the selection starts just before a paragraph break, skip over it |
1225 if (isEndOfParagraph(visiblePosition)) | 1226 if (isEndOfParagraph(visiblePosition)) |
1226 return visiblePosition.next().deepEquivalent().downstream(); | 1227 return visiblePosition.next().deepEquivalent().downstream(); |
1227 | 1228 |
1228 // otherwise, make sure to be at the start of the first selected node, | 1229 // otherwise, make sure to be at the start of the first selected node, |
1229 // instead of possibly at the end of the last node before the selection | 1230 // instead of possibly at the end of the last node before the selection |
1230 return visiblePosition.deepEquivalent().downstream(); | 1231 return visiblePosition.deepEquivalent().downstream(); |
1231 } | 1232 } |
1232 | 1233 |
1233 } // namespace blink | 1234 } // namespace blink |
OLD | NEW |