Index: Source/core/editing/markup.cpp |
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp |
index 2ea076869acc2465946b2c0dd052084f46f536dc..c2b23c359fb6df6067664cf41cfcc71f9417aed8 100644 |
--- a/Source/core/editing/markup.cpp |
+++ b/Source/core/editing/markup.cpp |
@@ -136,7 +136,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() |
@@ -305,6 +305,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(); |
@@ -331,8 +334,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); |
} |
@@ -1071,4 +1078,12 @@ void mergeWithNextTextNode(PassRefPtr<Node> node, ExceptionState& exceptionState |
textNext->remove(exceptionState); |
} |
+String createStyledMarkupForNavigationTransition(Node* node) |
+{ |
+ StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigationTransition, 0, 0); |
+ accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)); |
+ |
+ return accumulator.takeResults(); |
+} |
+ |
} |