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

Side by Side 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: Update from other review 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "core/dom/TransformSource.h" 93 #include "core/dom/TransformSource.h"
94 #include "core/dom/TreeWalker.h" 94 #include "core/dom/TreeWalker.h"
95 #include "core/dom/VisitedLinkState.h" 95 #include "core/dom/VisitedLinkState.h"
96 #include "core/dom/XMLDocument.h" 96 #include "core/dom/XMLDocument.h"
97 #include "core/dom/custom/CustomElementRegistrationContext.h" 97 #include "core/dom/custom/CustomElementRegistrationContext.h"
98 #include "core/dom/shadow/ElementShadow.h" 98 #include "core/dom/shadow/ElementShadow.h"
99 #include "core/dom/shadow/ShadowRoot.h" 99 #include "core/dom/shadow/ShadowRoot.h"
100 #include "core/editing/Editor.h" 100 #include "core/editing/Editor.h"
101 #include "core/editing/FrameSelection.h" 101 #include "core/editing/FrameSelection.h"
102 #include "core/editing/SpellChecker.h" 102 #include "core/editing/SpellChecker.h"
103 #include "core/editing/markup.h"
103 #include "core/events/BeforeUnloadEvent.h" 104 #include "core/events/BeforeUnloadEvent.h"
104 #include "core/events/Event.h" 105 #include "core/events/Event.h"
105 #include "core/events/EventFactory.h" 106 #include "core/events/EventFactory.h"
106 #include "core/events/EventListener.h" 107 #include "core/events/EventListener.h"
107 #include "core/events/HashChangeEvent.h" 108 #include "core/events/HashChangeEvent.h"
108 #include "core/events/PageTransitionEvent.h" 109 #include "core/events/PageTransitionEvent.h"
109 #include "core/events/ScopedEventQueue.h" 110 #include "core/events/ScopedEventQueue.h"
110 #include "core/fetch/ResourceFetcher.h" 111 #include "core/fetch/ResourceFetcher.h"
111 #include "core/frame/DOMWindow.h" 112 #include "core/frame/DOMWindow.h"
112 #include "core/frame/FrameConsole.h" 113 #include "core/frame/FrameConsole.h"
(...skipping 5595 matching lines...) Expand 10 before | Expand all | Expand 10 after
5708 m_taskRunner->postTask(AutofocusTask::create()); 5709 m_taskRunner->postTask(AutofocusTask::create());
5709 } 5710 }
5710 5711
5711 Element* Document::activeElement() const 5712 Element* Document::activeElement() const
5712 { 5713 {
5713 if (Element* element = treeScope().adjustedFocusedElement()) 5714 if (Element* element = treeScope().adjustedFocusedElement())
5714 return element; 5715 return element;
5715 return body(); 5716 return body();
5716 } 5717 }
5717 5718
5719 void Document::getTransitionElementData(Vector<TransitionElementData>& elementDa ta, ExceptionState& exceptionState)
5720 {
5721 for (HTMLMetaElement* metaElement = head() ? Traversal<HTMLMetaElement>::fir stChild(*head()) : 0; metaElement; metaElement = Traversal<HTMLMetaElement>::nex tSibling(*metaElement)) {
esprehn 2014/06/26 09:32:55 Lets early return instead. if (!head()) return;
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Done.
5722 if (metaElement->name() != "transition-elements")
5723 continue;
5724
5725 Vector<String> tokens;
5726 metaElement->content().string().split(';', tokens);
esprehn 2014/06/26 09:32:55 ";" is valid in CSS selectors, I don't think you c
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Done.
5727 if (tokens.size() != 2)
5728 continue;
5729
5730 RefPtr<NodeList> nodeList = querySelectorAll(AtomicString(tokens[0]), ex ceptionState);
esprehn 2014/06/26 09:32:55 What happens if the elements you select are nested
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Sure, there'll be a few "doing this is undefined b
5731 if (!nodeList || exceptionState.hadException())
5732 continue;
5733
5734 String markup;
5735 unsigned nodeListLength = nodeList->length();
5736 for (unsigned nodeIdx = 0; nodeIdx < nodeListLength; ++nodeIdx) {
esprehn 2014/06/26 09:32:55 nodeIndex, don't abbreviate.
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Done.
5737 Node* node = nodeList->item(nodeIdx);
5738 markup = markup + createStyledMarkupForNavigationTransition(node);
esprehn 2014/06/26 09:32:55 I think there's a string builder for this kind of
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Done.
5739 }
5740
5741 if (!markup.isEmpty()) {
esprehn 2014/06/26 09:32:55 How can markup be empty if nodeList was non empty?
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Done.
5742 TransitionElementData newElements;
5743 newElements.scope = tokens[1];
esprehn 2014/06/26 09:32:55 You'll want to trim() this.
oystein (OOO til 10th of July) 2014/06/26 23:13:43 Done.
5744 newElements.markup = markup;
5745 elementData.append(newElements);
5746 }
5747 }
5748 }
5749
5718 bool Document::hasFocus() const 5750 bool Document::hasFocus() const
5719 { 5751 {
5720 Page* page = this->page(); 5752 Page* page = this->page();
5721 if (!page) 5753 if (!page)
5722 return false; 5754 return false;
5723 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5755 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
5724 return false; 5756 return false;
5725 Frame* focusedFrame = page->focusController().focusedFrame(); 5757 Frame* focusedFrame = page->focusController().focusedFrame();
5726 if (focusedFrame && focusedFrame->isLocalFrame()) { 5758 if (focusedFrame && focusedFrame->isLocalFrame()) {
5727 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) 5759 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame()))
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
5854 visitor->trace(m_compositorPendingAnimations); 5886 visitor->trace(m_compositorPendingAnimations);
5855 visitor->trace(m_contextDocument); 5887 visitor->trace(m_contextDocument);
5856 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5888 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5857 DocumentSupplementable::trace(visitor); 5889 DocumentSupplementable::trace(visitor);
5858 TreeScope::trace(visitor); 5890 TreeScope::trace(visitor);
5859 ContainerNode::trace(visitor); 5891 ContainerNode::trace(visitor);
5860 ExecutionContext::trace(visitor); 5892 ExecutionContext::trace(visitor);
5861 } 5893 }
5862 5894
5863 } // namespace WebCore 5895 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698