| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 namespace blink { | 109 namespace blink { |
| 110 | 110 |
| 111 static void completeURLs(DocumentFragment& fragment, const String& baseURL) | 111 static void completeURLs(DocumentFragment& fragment, const String& baseURL) |
| 112 { | 112 { |
| 113 WillBeHeapVector<AttributeChange> changes; | 113 WillBeHeapVector<AttributeChange> changes; |
| 114 | 114 |
| 115 KURL parsedBaseURL(ParsedURLString, baseURL); | 115 KURL parsedBaseURL(ParsedURLString, baseURL); |
| 116 | 116 |
| 117 for (Element* element = ElementTraversal::firstWithin(fragment); element; el
ement = ElementTraversal::next(*element, &fragment)) { | 117 for (Element* element = ElementTraversal::firstWithin(fragment); element; el
ement = ElementTraversal::next(*element, &fragment)) { |
| 118 AttributeCollection attributes = element->attributes(); | 118 AttributeCollection attributes = element->attributes(); |
| 119 AttributeCollection::const_iterator end = attributes.end(); | 119 AttributeCollection::iterator end = attributes.end(); |
| 120 for (AttributeCollection::const_iterator it = attributes.begin(); it !=
end; ++it) { | 120 for (AttributeCollection::iterator it = attributes.begin(); it != end; +
+it) { |
| 121 if (element->isURLAttribute(*it) && !it->value().isEmpty()) | 121 if (element->isURLAttribute(*it) && !it->value().isEmpty()) |
| 122 changes.append(AttributeChange(element, it->name(), KURL(parsedB
aseURL, it->value()).string())); | 122 changes.append(AttributeChange(element, it->name(), KURL(parsedB
aseURL, it->value()).string())); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 size_t numChanges = changes.size(); | 126 size_t numChanges = changes.size(); |
| 127 for (size_t i = 0; i < numChanges; ++i) | 127 for (size_t i = 0; i < numChanges; ++i) |
| 128 changes[i].apply(); | 128 changes[i].apply(); |
| 129 } | 129 } |
| 130 | 130 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, bool addDisplayInline, RangeFullySelectsNode rangeFullySelectsNode) | 290 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, bool addDisplayInline, RangeFullySelectsNode rangeFullySelectsNode) |
| 291 { | 291 { |
| 292 const bool documentIsHTML = element.document().isHTMLDocument(); | 292 const bool documentIsHTML = element.document().isHTMLDocument(); |
| 293 appendOpenTag(out, element, 0); | 293 appendOpenTag(out, element, 0); |
| 294 | 294 |
| 295 const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldA
nnotate() || addDisplayInline); | 295 const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldA
nnotate() || addDisplayInline); |
| 296 const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldAp
plyWrappingStyle(element); | 296 const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldAp
plyWrappingStyle(element); |
| 297 | 297 |
| 298 AttributeCollection attributes = element.attributes(); | 298 AttributeCollection attributes = element.attributes(); |
| 299 AttributeCollection::const_iterator end = attributes.end(); | 299 AttributeCollection::iterator end = attributes.end(); |
| 300 for (AttributeCollection::const_iterator it = attributes.begin(); it != end;
++it) { | 300 for (AttributeCollection::iterator it = attributes.begin(); it != end; ++it)
{ |
| 301 // We'll handle the style attribute separately, below. | 301 // We'll handle the style attribute separately, below. |
| 302 if (it->name() == styleAttr && shouldOverrideStyleAttr) | 302 if (it->name() == styleAttr && shouldOverrideStyleAttr) |
| 303 continue; | 303 continue; |
| 304 appendAttribute(out, element, *it, 0); | 304 appendAttribute(out, element, *it, 0); |
| 305 } | 305 } |
| 306 | 306 |
| 307 if (shouldOverrideStyleAttr) { | 307 if (shouldOverrideStyleAttr) { |
| 308 RefPtrWillBeRawPtr<EditingStyle> newInlineStyle = nullptr; | 308 RefPtrWillBeRawPtr<EditingStyle> newInlineStyle = nullptr; |
| 309 | 309 |
| 310 if (shouldApplyWrappingStyle(element)) { | 310 if (shouldApplyWrappingStyle(element)) { |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1089 node->document().updateLayoutIgnorePendingStylesheets(); | 1089 node->document().updateLayoutIgnorePendingStylesheets(); |
| 1090 | 1090 |
| 1091 StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigation
Transition, nullptr, 0); | 1091 StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigation
Transition, nullptr, 0); |
| 1092 accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node))
; | 1092 accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node))
; |
| 1093 | 1093 |
| 1094 static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\"
content=\"width=device-width, user-scalable=0\">"; | 1094 static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\"
content=\"width=device-width, user-scalable=0\">"; |
| 1095 return documentMarkup + accumulator.takeResults(); | 1095 return documentMarkup + accumulator.takeResults(); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 } | 1098 } |
| OLD | NEW |