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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 out.appendLiteral("<div style=\""); | 186 out.appendLiteral("<div style=\""); |
187 else | 187 else |
188 out.appendLiteral("<span style=\""); | 188 out.appendLiteral("<span style=\""); |
189 appendAttributeValue(out, style->asText(), document->isHTMLDocument()); | 189 appendAttributeValue(out, style->asText(), document->isHTMLDocument()); |
190 out.append('\"'); | 190 out.append('\"'); |
191 out.append('>'); | 191 out.append('>'); |
192 } | 192 } |
193 | 193 |
194 const String& StyledMarkupAccumulator::styleNodeCloseTag(bool isBlock) | 194 const String& StyledMarkupAccumulator::styleNodeCloseTag(bool isBlock) |
195 { | 195 { |
196 DEFINE_STATIC_LOCAL(const String, divClose, (ASCIILiteral("</div>"))); | 196 DEFINE_STATIC_LOCAL(const String, divClose, ("</div>")); |
197 DEFINE_STATIC_LOCAL(const String, styleSpanClose, (ASCIILiteral("</span>")))
; | 197 DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>")); |
198 return isBlock ? divClose : styleSpanClose; | 198 return isBlock ? divClose : styleSpanClose; |
199 } | 199 } |
200 | 200 |
201 String StyledMarkupAccumulator::takeResults() | 201 String StyledMarkupAccumulator::takeResults() |
202 { | 202 { |
203 StringBuilder result; | 203 StringBuilder result; |
204 result.reserveCapacity(totalLength(m_reversedPrecedingMarkup) + length()); | 204 result.reserveCapacity(totalLength(m_reversedPrecedingMarkup) + length()); |
205 | 205 |
206 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) | 206 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) |
207 result.append(m_reversedPrecedingMarkup[i - 1]); | 207 result.append(m_reversedPrecedingMarkup[i - 1]); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 } | 540 } |
541 | 541 |
542 // FIXME: Shouldn't we omit style info when annotate == DoNotAnnotateForIntercha
nge? | 542 // FIXME: Shouldn't we omit style info when annotate == DoNotAnnotateForIntercha
nge? |
543 // FIXME: At least, annotation and style info should probably not be included in
range.markupString() | 543 // FIXME: At least, annotation and style info should probably not be included in
range.markupString() |
544 static String createMarkupInternal(Document* document, const Range* range, const
Range* updatedRange, Vector<Node*>* nodes, | 544 static String createMarkupInternal(Document* document, const Range* range, const
Range* updatedRange, Vector<Node*>* nodes, |
545 EAnnotateForInterchange shouldAnnotate, bool convertBlocksToInlines, EAbsolu
teURLs shouldResolveURLs, Node* constrainingAncestor) | 545 EAnnotateForInterchange shouldAnnotate, bool convertBlocksToInlines, EAbsolu
teURLs shouldResolveURLs, Node* constrainingAncestor) |
546 { | 546 { |
547 ASSERT(document); | 547 ASSERT(document); |
548 ASSERT(range); | 548 ASSERT(range); |
549 ASSERT(updatedRange); | 549 ASSERT(updatedRange); |
550 DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, (ASCIILiteral("<
br class=\"" AppleInterchangeNewline "\">"))); | 550 DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\""
AppleInterchangeNewline "\">")); |
551 | 551 |
552 bool collapsed = updatedRange->collapsed(ASSERT_NO_EXCEPTION); | 552 bool collapsed = updatedRange->collapsed(ASSERT_NO_EXCEPTION); |
553 if (collapsed) | 553 if (collapsed) |
554 return emptyString(); | 554 return emptyString(); |
555 Node* commonAncestor = updatedRange->commonAncestorContainer(ASSERT_NO_EXCEP
TION); | 555 Node* commonAncestor = updatedRange->commonAncestorContainer(ASSERT_NO_EXCEP
TION); |
556 if (!commonAncestor) | 556 if (!commonAncestor) |
557 return emptyString(); | 557 return emptyString(); |
558 | 558 |
559 document->updateLayoutIgnorePendingStylesheets(); | 559 document->updateLayoutIgnorePendingStylesheets(); |
560 | 560 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 if (hasOneChild(containerNode.get())) { | 1090 if (hasOneChild(containerNode.get())) { |
1091 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), es); | 1091 containerNode->replaceChild(textNode.release(), containerNode->firstChil
d(), es); |
1092 return; | 1092 return; |
1093 } | 1093 } |
1094 | 1094 |
1095 containerNode->removeChildren(); | 1095 containerNode->removeChildren(); |
1096 containerNode->appendChild(textNode.release(), es); | 1096 containerNode->appendChild(textNode.release(), es); |
1097 } | 1097 } |
1098 | 1098 |
1099 } | 1099 } |
OLD | NEW |