Chromium Code Reviews

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.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « 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..4967b1385e2d2b73f21713ec995abc6f6b578fc1 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)
yosin_UTC9 2014/05/29 03:58:52 nit: You don't need |&| for |element|. |Node| has
oystein (OOO til 10th of July) 2014/05/29 18:26:49 Done.
+ 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);
esprehn 2014/05/22 18:29:06 Huh?
+ }
+
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));
esprehn 2014/05/22 18:29:06 This code doesn't make sense, why are you going to
+
+ return accumulator.takeResults();
+}
+
}
« no previous file with comments | « Source/core/editing/markup.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine