OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (!style) | 162 if (!style) |
163 return false; | 163 return false; |
164 const CSSValue* value = style->getPropertyCSSValue(propertyID); | 164 const CSSValue* value = style->getPropertyCSSValue(propertyID); |
165 if (!value) | 165 if (!value) |
166 return true; | 166 return true; |
167 if (!value->isPrimitiveValue()) | 167 if (!value->isPrimitiveValue()) |
168 return false; | 168 return false; |
169 return toCSSPrimitiveValue(value)->getValueID() == CSSValueNone; | 169 return toCSSPrimitiveValue(value)->getValueID() == CSSValueNone; |
170 } | 170 } |
171 | 171 |
172 static bool isPresentationalHTMLElement(const Node* node) | |
173 { | |
174 if (!node->isHTMLElement()) | |
175 return false; | |
176 | |
177 const HTMLElement& element = toHTMLElement(*node); | |
178 return element.hasTagName(uTag) || element.hasTagName(sTag) || element.hasTa
gName(strikeTag) | |
179 || element.hasTagName(iTag) || element.hasTagName(emTag) || element.hasT
agName(bTag) || element.hasTagName(strongTag); | |
180 } | |
181 | |
182 template<typename Strategy> | 172 template<typename Strategy> |
183 static HTMLElement* highestAncestorToWrapMarkup(const PositionTemplate<Strategy>
& startPosition, const PositionTemplate<Strategy>& endPosition, EAnnotateForInte
rchange shouldAnnotate, Node* constrainingAncestor) | 173 static HTMLElement* highestAncestorToWrapMarkup(const PositionTemplate<Strategy>
& startPosition, const PositionTemplate<Strategy>& endPosition, EAnnotateForInte
rchange shouldAnnotate, Node* constrainingAncestor) |
184 { | 174 { |
185 Node* firstNode = startPosition.nodeAsRangeFirstNode(); | 175 Node* firstNode = startPosition.nodeAsRangeFirstNode(); |
186 // For compatibility reason, we use container node of start and end | 176 // For compatibility reason, we use container node of start and end |
187 // positions rather than first node and last node in selection. | 177 // positions rather than first node and last node in selection. |
188 Node* commonAncestor = Strategy::commonAncestor(*startPosition.computeContai
nerNode(), *endPosition.computeContainerNode()); | 178 Node* commonAncestor = Strategy::commonAncestor(*startPosition.computeContai
nerNode(), *endPosition.computeContainerNode()); |
189 DCHECK(commonAncestor); | 179 DCHECK(commonAncestor); |
190 HTMLElement* specialCommonAncestor = nullptr; | 180 HTMLElement* specialCommonAncestor = nullptr; |
191 if (shouldAnnotate == AnnotateForInterchange) { | 181 if (shouldAnnotate == AnnotateForInterchange) { |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 Text* textNext = toText(next); | 675 Text* textNext = toText(next); |
686 textNode->appendData(textNext->data()); | 676 textNode->appendData(textNext->data()); |
687 if (textNext->parentNode()) // Might have been removed by mutation event. | 677 if (textNext->parentNode()) // Might have been removed by mutation event. |
688 textNext->remove(exceptionState); | 678 textNext->remove(exceptionState); |
689 } | 679 } |
690 | 680 |
691 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; | 681 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingStrategy>; |
692 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingInFlatTreeStrat
egy>; | 682 template class CORE_TEMPLATE_EXPORT CreateMarkupAlgorithm<EditingInFlatTreeStrat
egy>; |
693 | 683 |
694 } // namespace blink | 684 } // namespace blink |
OLD | NEW |