Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Unified Diff: Source/core/editing/markup.cpp

Issue 281383006: Navigation transitions: Added createStyledMarkupForNavigationTransition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« Source/core/editing/EditingStyle.cpp ('K') | « Source/core/editing/markup.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
+
}
« Source/core/editing/EditingStyle.cpp ('K') | « Source/core/editing/markup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698