Index: Source/core/editing/markup.cpp |
diff --git a/Source/core/editing/markup.cpp b/Source/core/editing/markup.cpp |
index c0591bf59aac0ab0ea692a30b036b6202e5bcfa7..7ac30589bdcacdc986fb6d129b06116b293bb40e 100644 |
--- a/Source/core/editing/markup.cpp |
+++ b/Source/core/editing/markup.cpp |
@@ -146,7 +146,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() |
@@ -317,6 +317,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(); |
@@ -343,8 +346,14 @@ 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(CSSPropertyBackgroundColor); |
+ m_wrappingStyle->style()->removeProperty(CSSPropertyBackgroundImage); |
+ } |
+ } |
+ |
return traverseNodesForSerialization(startNode, pastEnd, EmitString); |
} |
@@ -371,7 +380,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)) |
@@ -1095,4 +1104,13 @@ void mergeWithNextTextNode(PassRefPtrWillBeRawPtr<Node> node, ExceptionState& ex |
textNext->remove(exceptionState); |
} |
+String createStyledMarkupForNavigationTransition(Node* node) |
+{ |
+ StyledMarkupAccumulator accumulator(0, ResolveAllURLs, AnnotateForNavigationTransition, nullptr, 0); |
esprehn
2014/07/14 22:04:31
What updates the style of the page before you get
oystein (OOO til 10th of July)
2014/07/14 22:44:57
Not sure what you're asking here, exactly. If ther
|
+ accumulator.serializeNodes(node, NodeTraversal::nextSkippingChildren(*node)); |
+ |
+ static const char* documentMarkup = "<!DOCTYPE html><meta name=\"viewport\" content=\"width=device-width, user-scalable=0\">"; |
+ return documentMarkup + accumulator.takeResults(); |
+} |
+ |
} |