Index: Source/core/editing/markup.cpp |
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp |
index c256e91188405d72f9ab8d464a74648fae00aa19..c54cf08ea9ca93ae8177b8736f2ac7a62e085346 100644 |
--- a/Source/core/editing/markup.cpp |
+++ b/Source/core/editing/markup.cpp |
@@ -148,7 +148,7 @@ private: |
enum NodeTraversalMode { EmitString, DoNotEmitString }; |
Node* traverseNodesForSerialization(Node* startNode, Node* pastEnd, NodeTraversalMode); |
- bool shouldAnnotate() { return m_shouldAnnotate == AnnotateForInterchange; } |
+ bool shouldAnnotate() const { return m_shouldAnnotate == AnnotateForInterchange || m_shouldAnnotate == AnnotateForNavigationTransition; } |
bool shouldApplyWrappingStyle(const Node& node) const |
{ |
return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNode() == node.parentNode() |
@@ -316,6 +316,9 @@ void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element |
if (shouldAnnotate()) |
newInlineStyle->mergeStyleFromRulesForSerialization(&toHTMLElement(element)); |
+ if (element == m_highestNodeToBeSerialized && m_shouldAnnotate == AnnotateForNavigationTransition) |
+ newInlineStyle->addAbsolutePositioningFromElement(element); |
+ |
if (addDisplayInline) |
newInlineStyle->forceInline(); |
@@ -342,8 +345,12 @@ Node* StyledMarkupAccumulator::serializeNodes(Node* startNode, Node* pastEnd) |
m_highestNodeToBeSerialized = lastClosed; |
} |
- if (m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNode()) |
+ if (m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNode()) { |
m_wrappingStyle = EditingStyle::wrappingStyleForSerialization(m_highestNodeToBeSerialized->parentNode(), shouldAnnotate()); |
+ if (m_shouldAnnotate == AnnotateForNavigationTransition) |
+ m_wrappingStyle->style()->removeProperty(CSSPropertyBackground); |
+ } |
+ |
return traverseNodesForSerialization(startNode, pastEnd, EmitString); |
} |
@@ -370,7 +377,7 @@ Node* StyledMarkupAccumulator::traverseNodesForSerialization(Node* startNode, No |
// Don't write out empty block containers that aren't fully selected. |
continue; |
- if (!n->renderer() && !enclosingNodeWithTag(firstPositionInOrBeforeNode(n), selectTag)) { |
+ if (!n->renderer() && !enclosingNodeWithTag(firstPositionInOrBeforeNode(n), selectTag) && m_shouldAnnotate != AnnotateForNavigationTransition) { |
next = NodeTraversal::nextSkippingChildren(*n); |
// Don't skip over pastEnd. |
if (pastEnd && pastEnd->isDescendantOf(n)) |
@@ -1082,4 +1089,12 @@ void mergeWithNextTextNode(PassRefPtrWillBeRawPtr<Node> node, ExceptionState& ex |
textNext->remove(exceptionState); |
} |
+String createStyledMarkupForNavigationTransition(Node* node) |
+{ |
+ StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigationTransition, 0, 0); |
+ accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)); |
+ |
+ return accumulator.takeResults(); |
+} |
+ |
} |