OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 static bool isInterchangeNewlineNode(const Node *node) | 99 static bool isInterchangeNewlineNode(const Node *node) |
100 { | 100 { |
101 DEFINE_STATIC_LOCAL(String, interchangeNewlineClassString, (AppleInterchange
Newline)); | 101 DEFINE_STATIC_LOCAL(String, interchangeNewlineClassString, (AppleInterchange
Newline)); |
102 return node && node->hasTagName(brTag) && toElement(node)->getAttribute(clas
sAttr) == interchangeNewlineClassString; | 102 return node && node->hasTagName(brTag) && toElement(node)->getAttribute(clas
sAttr) == interchangeNewlineClassString; |
103 } | 103 } |
104 | 104 |
105 static bool isInterchangeConvertedSpaceSpan(const Node *node) | 105 static bool isInterchangeConvertedSpaceSpan(const Node *node) |
106 { | 106 { |
107 DEFINE_STATIC_LOCAL(String, convertedSpaceSpanClassString, (AppleConvertedSp
ace)); | 107 DEFINE_STATIC_LOCAL(String, convertedSpaceSpanClassString, (AppleConvertedSp
ace)); |
108 return node->isHTMLElement() && | 108 return node->isHTMLElement() && toHTMLElement(node)->getAttribute(classAttr)
== convertedSpaceSpanClassString; |
109 static_cast<const HTMLElement *>(node)->getAttribute(classAttr) == co
nvertedSpaceSpanClassString; | |
110 } | 109 } |
111 | 110 |
112 static Position positionAvoidingPrecedingNodes(Position pos) | 111 static Position positionAvoidingPrecedingNodes(Position pos) |
113 { | 112 { |
114 // If we're already on a break, it's probably a placeholder and we shouldn't
change our position. | 113 // If we're already on a break, it's probably a placeholder and we shouldn't
change our position. |
115 if (editingIgnoresContent(pos.deprecatedNode())) | 114 if (editingIgnoresContent(pos.deprecatedNode())) |
116 return pos; | 115 return pos; |
117 | 116 |
118 // We also stop when changing block flow elements because even though the vi
sual position is the | 117 // We also stop when changing block flow elements because even though the vi
sual position is the |
119 // same. E.g., | 118 // same. E.g., |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 { | 855 { |
857 // We don't want to skip over any block elements. | 856 // We don't want to skip over any block elements. |
858 if (isBlock(node)) | 857 if (isBlock(node)) |
859 return false; | 858 return false; |
860 | 859 |
861 if (!node->isHTMLElement()) | 860 if (!node->isHTMLElement()) |
862 return false; | 861 return false; |
863 | 862 |
864 // We can skip over elements whose class attribute is | 863 // We can skip over elements whose class attribute is |
865 // one of our internal classes. | 864 // one of our internal classes. |
866 const HTMLElement* element = static_cast<const HTMLElement*>(node); | 865 const HTMLElement* element = toHTMLElement(node); |
867 const AtomicString& classAttributeValue = element->getAttribute(classAttr); | 866 const AtomicString& classAttributeValue = element->getAttribute(classAttr); |
868 if (classAttributeValue == AppleTabSpanClass | 867 if (classAttributeValue == AppleTabSpanClass |
869 || classAttributeValue == AppleConvertedSpace | 868 || classAttributeValue == AppleConvertedSpace |
870 || classAttributeValue == ApplePasteAsQuotation) | 869 || classAttributeValue == ApplePasteAsQuotation) |
871 return true; | 870 return true; |
872 | 871 |
873 return EditingStyle::elementIsStyledSpanOrHTMLEquivalent(element); | 872 return EditingStyle::elementIsStyledSpanOrHTMLEquivalent(element); |
874 } | 873 } |
875 | 874 |
876 inline Node* nodeToSplitToAvoidPastingIntoInlineNodesWithStyle(const Position& i
nsertionPos) | 875 inline Node* nodeToSplitToAvoidPastingIntoInlineNodesWithStyle(const Position& i
nsertionPos) |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); | 1486 removeNodeAndPruneAncestors(nodeAfterInsertionPos.get()); |
1488 | 1487 |
1489 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); | 1488 VisibleSelection selectionAfterReplace(m_selectReplacement ? start : end, en
d); |
1490 | 1489 |
1491 setEndingSelection(selectionAfterReplace); | 1490 setEndingSelection(selectionAfterReplace); |
1492 | 1491 |
1493 return true; | 1492 return true; |
1494 } | 1493 } |
1495 | 1494 |
1496 } // namespace WebCore | 1495 } // namespace WebCore |
OLD | NEW |