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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 if (element->isURLAttribute(*attribute) && !attribute->value().isEmp ty()) | 105 if (element->isURLAttribute(*attribute) && !attribute->value().isEmp ty()) |
106 changes.append(AttributeChange(element, attribute->name(), KURL( parsedBaseURL, attribute->value()).string())); | 106 changes.append(AttributeChange(element, attribute->name(), KURL( parsedBaseURL, attribute->value()).string())); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 size_t numChanges = changes.size(); | 110 size_t numChanges = changes.size(); |
111 for (size_t i = 0; i < numChanges; ++i) | 111 for (size_t i = 0; i < numChanges; ++i) |
112 changes[i].apply(); | 112 changes[i].apply(); |
113 } | 113 } |
114 | 114 |
115 class StyledMarkupAccumulator : public MarkupAccumulator { | 115 class StyledMarkupAccumulator FINAL : public MarkupAccumulator { |
116 public: | 116 public: |
117 enum RangeFullySelectsNode { DoesFullySelectNode, DoesNotFullySelectNode }; | 117 enum RangeFullySelectsNode { DoesFullySelectNode, DoesNotFullySelectNode }; |
118 | 118 |
119 StyledMarkupAccumulator(Vector<Node*>* nodes, EAbsoluteURLs, EAnnotateForInt erchange, const Range*, Node* highestNodeToBeSerialized = 0); | 119 StyledMarkupAccumulator(Vector<Node*>* nodes, EAbsoluteURLs, EAnnotateForInt erchange, const Range*, Node* highestNodeToBeSerialized = 0); |
120 Node* serializeNodes(Node* startNode, Node* pastEnd); | 120 Node* serializeNodes(Node* startNode, Node* pastEnd); |
121 virtual void appendString(const String& s) { return MarkupAccumulator::appen dString(s); } | 121 void appendString(const String& s) { return MarkupAccumulator::appendString( s); } |
adamk
2014/01/07 19:10:47
Why is this needed at all?
Inactive
2014/01/07 19:42:06
To make it public. It is protected in the base cla
| |
122 void wrapWithNode(Node*, bool convertBlocksToInlines = false, RangeFullySele ctsNode = DoesFullySelectNode); | 122 void wrapWithNode(Node*, bool convertBlocksToInlines = false, RangeFullySele ctsNode = DoesFullySelectNode); |
123 void wrapWithStyleNode(StylePropertySet*, Document*, bool isBlock = false); | 123 void wrapWithStyleNode(StylePropertySet*, Document*, bool isBlock = false); |
124 String takeResults(); | 124 String takeResults(); |
125 | 125 |
126 private: | 126 private: |
127 void appendStyleNodeOpenTag(StringBuilder&, StylePropertySet*, Document*, bo ol isBlock = false); | 127 void appendStyleNodeOpenTag(StringBuilder&, StylePropertySet*, Document*, bo ol isBlock = false); |
128 const String& styleNodeCloseTag(bool isBlock = false); | 128 const String& styleNodeCloseTag(bool isBlock = false); |
129 virtual void appendText(StringBuilder& out, Text*); | 129 virtual void appendText(StringBuilder& out, Text*) OVERRIDE; |
130 String renderedText(const Node*, const Range*); | 130 String renderedText(const Node*, const Range*); |
131 String stringValueForRange(const Node*, const Range*); | 131 String stringValueForRange(const Node*, const Range*); |
132 void appendElement(StringBuilder& out, Element*, bool addDisplayInline, Rang eFullySelectsNode); | 132 void appendElement(StringBuilder& out, Element*, bool addDisplayInline, Rang eFullySelectsNode); |
133 void appendElement(StringBuilder& out, Element* element, Namespaces*) { appe ndElement(out, element, false, DoesFullySelectNode); } | 133 void appendElement(StringBuilder& out, Element* element, Namespaces*) OVERRI DE { appendElement(out, element, false, DoesFullySelectNode); } |
134 | 134 |
135 enum NodeTraversalMode { EmitString, DoNotEmitString }; | 135 enum NodeTraversalMode { EmitString, DoNotEmitString }; |
136 Node* traverseNodesForSerialization(Node* startNode, Node* pastEnd, NodeTrav ersalMode); | 136 Node* traverseNodesForSerialization(Node* startNode, Node* pastEnd, NodeTrav ersalMode); |
137 | 137 |
138 bool shouldAnnotate() { return m_shouldAnnotate == AnnotateForInterchange; } | 138 bool shouldAnnotate() { return m_shouldAnnotate == AnnotateForInterchange; } |
139 bool shouldApplyWrappingStyle(Node* node) const | 139 bool shouldApplyWrappingStyle(Node* node) const |
140 { | 140 { |
141 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->paren tNode() == node->parentNode() | 141 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->paren tNode() == node->parentNode() |
142 && m_wrappingStyle && m_wrappingStyle->style(); | 142 && m_wrappingStyle && m_wrappingStyle->style(); |
143 } | 143 } |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1080 return; | 1080 return; |
1081 | 1081 |
1082 RefPtr<Text> textNode = toText(node.get()); | 1082 RefPtr<Text> textNode = toText(node.get()); |
1083 RefPtr<Text> textNext = toText(next); | 1083 RefPtr<Text> textNext = toText(next); |
1084 textNode->appendData(textNext->data()); | 1084 textNode->appendData(textNext->data()); |
1085 if (textNext->parentNode()) // Might have been removed by mutation event. | 1085 if (textNext->parentNode()) // Might have been removed by mutation event. |
1086 textNext->remove(exceptionState); | 1086 textNext->remove(exceptionState); |
1087 } | 1087 } |
1088 | 1088 |
1089 } | 1089 } |
OLD | NEW |