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

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: Missing NULL check 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 5553 matching lines...) Expand 10 before | Expand all | Expand 10 after
5666 m_taskRunner->postTask(AutofocusTask::create()); 5667 m_taskRunner->postTask(AutofocusTask::create());
5667 } 5668 }
5668 5669
5669 Element* Document::activeElement() const 5670 Element* Document::activeElement() const
5670 { 5671 {
5671 if (Element* element = treeScope().adjustedFocusedElement()) 5672 if (Element* element = treeScope().adjustedFocusedElement())
5672 return element; 5673 return element;
5673 return body(); 5674 return body();
5674 } 5675 }
5675 5676
5677 void Document::getTransitionElementData(Vector<TransitionElementData>* elementDa ta, ExceptionState& exceptionState)
esprehn 2014/06/13 08:47:05 Since this is only used in tests, lets put it in I
5678 {
5679 ASSERT(elementData);
5680
5681 RefPtr<HTMLCollection> metaElements = getElementsByTagName(HTMLNames::metaTa g.localName());
esprehn 2014/06/13 08:47:06 We don't normally allow code like this in core/, e
oystein (OOO til 10th of July) 2014/06/17 21:07:06 Replaced getElementsByTagName with Traversal<HTMLM
5682 unsigned length = metaElements->length();
5683 for (unsigned i = 0; i < length; ++i) {
5684 ASSERT(metaElements->item(i)->isHTMLElement());
5685 HTMLMetaElement* metaElement = toHTMLMetaElement(metaElements->item(i));
5686 if (metaElement->name() != "transition-elements")
5687 continue;
5688
5689 Vector<String> tokens;
5690 String(metaElement->content().impl()).split(';', tokens);
5691 if (tokens.size() != 2)
5692 continue;
5693
5694 RefPtr<NodeList> nodeList = querySelectorAll(AtomicString(tokens[0]), ex ceptionState);
5695 if (!nodeList || exceptionState.hadException())
5696 continue;
5697
5698 String markup;
5699 unsigned nodeListLength = nodeList->length();
5700 for (unsigned nodeIdx = 0; nodeIdx < nodeListLength; ++nodeIdx) {
5701 Node* node = nodeList->item(nodeIdx);
5702 markup = markup + createStyledMarkupForNavigationTransition(node);
5703 }
5704
5705 if (!markup.isEmpty()) {
5706 TransitionElementData newElements;
5707 newElements.scope = tokens[1];
5708 newElements.markup = markup;
5709 elementData->append(newElements);
5710 }
5711 }
5712 }
5713
5676 bool Document::hasFocus() const 5714 bool Document::hasFocus() const
5677 { 5715 {
5678 Page* page = this->page(); 5716 Page* page = this->page();
5679 if (!page) 5717 if (!page)
5680 return false; 5718 return false;
5681 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5719 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
5682 return false; 5720 return false;
5683 Frame* focusedFrame = page->focusController().focusedFrame(); 5721 Frame* focusedFrame = page->focusController().focusedFrame();
5684 if (focusedFrame && focusedFrame->isLocalFrame()) { 5722 if (focusedFrame && focusedFrame->isLocalFrame()) {
5685 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) 5723 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame()))
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
5808 visitor->trace(m_compositorPendingAnimations); 5846 visitor->trace(m_compositorPendingAnimations);
5809 visitor->trace(m_contextDocument); 5847 visitor->trace(m_contextDocument);
5810 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this); 5848 visitor->registerWeakMembers<Document, &Document::clearWeakMembers>(this);
5811 DocumentSupplementable::trace(visitor); 5849 DocumentSupplementable::trace(visitor);
5812 TreeScope::trace(visitor); 5850 TreeScope::trace(visitor);
5813 ContainerNode::trace(visitor); 5851 ContainerNode::trace(visitor);
5814 ExecutionContext::trace(visitor); 5852 ExecutionContext::trace(visitor);
5815 } 5853 }
5816 5854
5817 } // namespace WebCore 5855 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698