| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 DEFINE_STATIC_LOCAL(String, nonBreakingSpaceString, (&noBreakSpace, 1)); | 383 DEFINE_STATIC_LOCAL(String, nonBreakingSpaceString, (&noBreakSpace, 1)); |
| 384 return nonBreakingSpaceString; | 384 return nonBreakingSpaceString; |
| 385 } | 385 } |
| 386 | 386 |
| 387 // FIXME: need to dump this | 387 // FIXME: need to dump this |
| 388 bool isSpecialHTMLElement(const Node* n) | 388 bool isSpecialHTMLElement(const Node* n) |
| 389 { | 389 { |
| 390 if (!n) | 390 if (!n) |
| 391 return false; | 391 return false; |
| 392 | 392 |
| 393 if (!n->isHTMLElement()) | 393 if (!n->isElementNode()) |
| 394 return false; | 394 return false; |
| 395 | 395 |
| 396 if (n->isLink()) | 396 if (n->isLink()) |
| 397 return true; | 397 return true; |
| 398 | 398 |
| 399 return false; | 399 return false; |
| 400 } | 400 } |
| 401 | 401 |
| 402 static HTMLElement* firstInSpecialElement(const Position& pos) | 402 static HTMLElement* firstInSpecialElement(const Position& pos) |
| 403 { | 403 { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 | 601 |
| 602 for (Element* ancestor = ElementTraversal::firstAncestorOrSelf(*p.deprecated
Node()); ancestor; ancestor = ElementTraversal::firstAncestor(*ancestor)) { | 602 for (Element* ancestor = ElementTraversal::firstAncestorOrSelf(*p.deprecated
Node()); ancestor; ancestor = ElementTraversal::firstAncestor(*ancestor)) { |
| 603 if (ancestor->isLink()) | 603 if (ancestor->isLink()) |
| 604 return ancestor; | 604 return ancestor; |
| 605 } | 605 } |
| 606 return 0; | 606 return 0; |
| 607 } | 607 } |
| 608 | 608 |
| 609 bool canMergeLists(Element* firstList, Element* secondList) | 609 bool canMergeLists(Element* firstList, Element* secondList) |
| 610 { | 610 { |
| 611 if (!firstList || !secondList || !firstList->isHTMLElement() || !secondList-
>isHTMLElement()) | 611 if (!firstList || !secondList) |
| 612 return false; | 612 return false; |
| 613 | 613 |
| 614 return firstList->hasTagName(secondList->tagQName()) // make sure the list t
ypes match (ol vs. ul) | 614 return firstList->hasTagName(secondList->tagQName()) // make sure the list t
ypes match (ol vs. ul) |
| 615 && firstList->hasEditableStyle() && secondList->hasEditableStyle() // both l
ists are editable | 615 && firstList->hasEditableStyle() && secondList->hasEditableStyle() // both l
ists are editable |
| 616 && firstList->rootEditableElement() == secondList->rootEditableElement() //
don't cross editing boundaries | 616 && firstList->rootEditableElement() == secondList->rootEditableElement() //
don't cross editing boundaries |
| 617 && isVisiblyAdjacent(positionInParentAfterNode(*firstList), positionInParent
BeforeNode(*secondList)); | 617 && isVisiblyAdjacent(positionInParentAfterNode(*firstList), positionInParent
BeforeNode(*secondList)); |
| 618 // Make sure there is no visible content between this li and the previous li
st | 618 // Make sure there is no visible content between this li and the previous li
st |
| 619 } | 619 } |
| 620 | 620 |
| 621 bool isRenderedTableElement(const Node* node) | 621 bool isRenderedTableElement(const Node* node) |
| 622 { | 622 { |
| 623 return false; | 623 return false; |
| 624 } | 624 } |
| 625 | 625 |
| 626 bool isEmptyTableCell(const Node* node) | 626 bool isEmptyTableCell(const Node* node) |
| 627 { | 627 { |
| 628 return false; | 628 return false; |
| 629 } | 629 } |
| 630 | 630 |
| 631 PassRefPtr<HTMLElement> createDefaultParagraphElement(Document& document) | 631 PassRefPtr<HTMLElement> createDefaultParagraphElement(Document& document) |
| 632 { | 632 { |
| 633 return nullptr; | 633 return nullptr; |
| 634 } | 634 } |
| 635 | 635 |
| 636 PassRefPtr<HTMLElement> createHTMLElement(Document& document, const QualifiedNam
e& name) | |
| 637 { | |
| 638 return createHTMLElement(document, name.localName()); | |
| 639 } | |
| 640 | |
| 641 PassRefPtr<HTMLElement> createHTMLElement(Document& document, const AtomicString
& tagName) | |
| 642 { | |
| 643 return HTMLElementFactory::createHTMLElement(tagName, document, false); | |
| 644 } | |
| 645 | |
| 646 bool isNodeRendered(const Node *node) | 636 bool isNodeRendered(const Node *node) |
| 647 { | 637 { |
| 648 return node && node->renderer(); | 638 return node && node->renderer(); |
| 649 } | 639 } |
| 650 | 640 |
| 651 // return first preceding DOM position rendered at a different location, or "thi
s" | 641 // return first preceding DOM position rendered at a different location, or "thi
s" |
| 652 static Position previousCharacterPosition(const Position& position, EAffinity af
finity) | 642 static Position previousCharacterPosition(const Position& position, EAffinity af
finity) |
| 653 { | 643 { |
| 654 if (position.isNull()) | 644 if (position.isNull()) |
| 655 return Position(); | 645 return Position(); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // if the selection starts just before a paragraph break, skip over it | 915 // if the selection starts just before a paragraph break, skip over it |
| 926 if (isEndOfParagraph(visiblePosition)) | 916 if (isEndOfParagraph(visiblePosition)) |
| 927 return visiblePosition.next().deepEquivalent().downstream(); | 917 return visiblePosition.next().deepEquivalent().downstream(); |
| 928 | 918 |
| 929 // otherwise, make sure to be at the start of the first selected node, | 919 // otherwise, make sure to be at the start of the first selected node, |
| 930 // instead of possibly at the end of the last node before the selection | 920 // instead of possibly at the end of the last node before the selection |
| 931 return visiblePosition.deepEquivalent().downstream(); | 921 return visiblePosition.deepEquivalent().downstream(); |
| 932 } | 922 } |
| 933 | 923 |
| 934 } // namespace blink | 924 } // namespace blink |
| OLD | NEW |