| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 static void completeURLs(DocumentFragment& fragment, const String& baseURL) | 104 static void completeURLs(DocumentFragment& fragment, const String& baseURL) |
| 105 { | 105 { |
| 106 WillBeHeapVector<AttributeChange> changes; | 106 WillBeHeapVector<AttributeChange> changes; |
| 107 | 107 |
| 108 KURL parsedBaseURL(ParsedURLString, baseURL); | 108 KURL parsedBaseURL(ParsedURLString, baseURL); |
| 109 | 109 |
| 110 for (Element* element = ElementTraversal::firstWithin(fragment); element; el
ement = ElementTraversal::next(*element, &fragment)) { | 110 for (Element* element = ElementTraversal::firstWithin(fragment); element; el
ement = ElementTraversal::next(*element, &fragment)) { |
| 111 if (!element->hasAttributes()) | 111 if (!element->hasAttributes()) |
| 112 continue; | 112 continue; |
| 113 AttributeIteratorAccessor attributes = element->attributesIterator(); | 113 AttributeCollection attributes = element->attributes(); |
| 114 AttributeConstIterator end = attributes.end(); | 114 AttributeCollection::const_iterator end = attributes.end(); |
| 115 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { | 115 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { |
| 116 if (element->isURLAttribute(**it) && !it->value().isEmpty()) | 116 if (element->isURLAttribute(*it) && !it->value().isEmpty()) |
| 117 changes.append(AttributeChange(element, it->name(), KURL(parsedB
aseURL, it->value()).string())); | 117 changes.append(AttributeChange(element, it->name(), KURL(parsedB
aseURL, it->value()).string())); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 size_t numChanges = changes.size(); | 121 size_t numChanges = changes.size(); |
| 122 for (size_t i = 0; i < numChanges; ++i) | 122 for (size_t i = 0; i < numChanges; ++i) |
| 123 changes[i].apply(); | 123 changes[i].apply(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 class StyledMarkupAccumulator FINAL : public MarkupAccumulator { | 126 class StyledMarkupAccumulator FINAL : public MarkupAccumulator { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, bool addDisplayInline, RangeFullySelectsNode rangeFullySelectsNode) | 284 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, bool addDisplayInline, RangeFullySelectsNode rangeFullySelectsNode) |
| 285 { | 285 { |
| 286 const bool documentIsHTML = element.document().isHTMLDocument(); | 286 const bool documentIsHTML = element.document().isHTMLDocument(); |
| 287 appendOpenTag(out, element, 0); | 287 appendOpenTag(out, element, 0); |
| 288 | 288 |
| 289 const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldA
nnotate() || addDisplayInline); | 289 const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldA
nnotate() || addDisplayInline); |
| 290 const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldAp
plyWrappingStyle(element); | 290 const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldAp
plyWrappingStyle(element); |
| 291 | 291 |
| 292 if (element.hasAttributes()) { | 292 if (element.hasAttributes()) { |
| 293 AttributeIteratorAccessor attributes = element.attributesIterator(); | 293 AttributeCollection attributes = element.attributes(); |
| 294 AttributeConstIterator end = attributes.end(); | 294 AttributeCollection::const_iterator end = attributes.end(); |
| 295 for (AttributeConstIterator it = attributes.begin(); it != end; ++it) { | 295 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { |
| 296 // We'll handle the style attribute separately, below. | 296 // We'll handle the style attribute separately, below. |
| 297 if (it->name() == styleAttr && shouldOverrideStyleAttr) | 297 if (it->name() == styleAttr && shouldOverrideStyleAttr) |
| 298 continue; | 298 continue; |
| 299 appendAttribute(out, element, **it, 0); | 299 appendAttribute(out, element, *it, 0); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 if (shouldOverrideStyleAttr) { | 303 if (shouldOverrideStyleAttr) { |
| 304 RefPtrWillBeRawPtr<EditingStyle> newInlineStyle = nullptr; | 304 RefPtrWillBeRawPtr<EditingStyle> newInlineStyle = nullptr; |
| 305 | 305 |
| 306 if (shouldApplyWrappingStyle(element)) { | 306 if (shouldApplyWrappingStyle(element)) { |
| 307 newInlineStyle = m_wrappingStyle->copy(); | 307 newInlineStyle = m_wrappingStyle->copy(); |
| 308 newInlineStyle->removePropertiesInElementDefaultStyle(&element); | 308 newInlineStyle->removePropertiesInElementDefaultStyle(&element); |
| 309 newInlineStyle->removeStyleConflictingWithStyleOfNode(&element); | 309 newInlineStyle->removeStyleConflictingWithStyleOfNode(&element); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 return; | 1077 return; |
| 1078 | 1078 |
| 1079 RefPtrWillBeRawPtr<Text> textNode = toText(node.get()); | 1079 RefPtrWillBeRawPtr<Text> textNode = toText(node.get()); |
| 1080 RefPtrWillBeRawPtr<Text> textNext = toText(next); | 1080 RefPtrWillBeRawPtr<Text> textNext = toText(next); |
| 1081 textNode->appendData(textNext->data()); | 1081 textNode->appendData(textNext->data()); |
| 1082 if (textNext->parentNode()) // Might have been removed by mutation event. | 1082 if (textNext->parentNode()) // Might have been removed by mutation event. |
| 1083 textNext->remove(exceptionState); | 1083 textNext->remove(exceptionState); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 } | 1086 } |
| OLD | NEW |