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

Unified Diff: Source/core/dom/Document.cpp

Issue 281383006: Navigation transitions: Added createStyledMarkupForNavigationTransition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review fixes Created 6 years, 6 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
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 4b97db5687594905c5098d97a830f72460741aa7..8d83c87d4c4d0a96329037f4bbca31779ba9b361 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -88,6 +88,7 @@
#include "core/dom/ScriptRunner.h"
#include "core/dom/ScriptedAnimationController.h"
#include "core/dom/SelectorQuery.h"
+#include "core/dom/StaticNodeList.h"
#include "core/dom/StyleEngine.h"
#include "core/dom/TouchList.h"
#include "core/dom/TransformSource.h"
@@ -100,6 +101,7 @@
#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
#include "core/editing/SpellChecker.h"
+#include "core/editing/markup.h"
#include "core/events/BeforeUnloadEvent.h"
#include "core/events/Event.h"
#include "core/events/EventFactory.h"
@@ -5696,6 +5698,44 @@ Element* Document::activeElement() const
return body();
}
+void Document::getTransitionElementData(Vector<TransitionElementData>& elementData, ExceptionState& exceptionState)
+{
+ if (!head())
+ return;
+
+ for (HTMLMetaElement* metaElement = Traversal<HTMLMetaElement>::firstChild(*head()); metaElement; metaElement = Traversal<HTMLMetaElement>::nextSibling(*metaElement)) {
+ if (metaElement->name() != "transition-elements")
+ continue;
+
+ Vector<String> tokens;
esprehn 2014/07/14 22:04:31 Dead code?
oystein (OOO til 10th of July) 2014/07/14 22:44:57 Done.
+ const String& metaElementContents = metaElement->content().string();
+ size_t firstSemicolon = metaElementContents.find(';');
+ if (firstSemicolon == kNotFound)
+ continue;
+
+ AtomicString selector(metaElementContents.substring(0, firstSemicolon));
+ RefPtr<StaticNodeList> nodeList = querySelectorAll(selector, exceptionState);
+ if (!nodeList || exceptionState.hadException())
+ continue;
+
+ unsigned nodeListLength = nodeList->length();
+ if (!nodeListLength)
+ continue;
+
+ StringBuilder markup;
+ for (unsigned nodeIndex = 0; nodeIndex < nodeListLength; ++nodeIndex) {
+ Node* node = nodeList->item(nodeIndex);
+ markup.append(createStyledMarkupForNavigationTransition(node));
+ }
+
+ TransitionElementData newElements;
+ newElements.scope = metaElementContents.substring(firstSemicolon + 1).stripWhiteSpace();
esprehn 2014/07/14 22:04:31 What happens if there's nothing after the ;, isn't
oystein (OOO til 10th of July) 2014/07/14 22:44:57 StringImpl::substring does a bounds check and retu
+ newElements.selector = selector;
+ newElements.markup = markup.toString();
+ elementData.append(newElements);
+ }
+}
+
bool Document::hasFocus() const
{
Page* page = this->page();

Powered by Google App Engine
This is Rietveld 408576698