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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 715653004: Navigation transitions (web to native app): Hide/Show transition elements (Blink side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add helper function Created 6 years, 1 month 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 5627 matching lines...) Expand 10 before | Expand all | Expand 10 after
5638 newElements.elements.append(transitionElement); 5638 newElements.elements.append(transitionElement);
5639 } 5639 }
5640 5640
5641 newElements.scope = metaElementContents.substring(firstSemicolon + 1).st ripWhiteSpace(); 5641 newElements.scope = metaElementContents.substring(firstSemicolon + 1).st ripWhiteSpace();
5642 newElements.selector = selector; 5642 newElements.selector = selector;
5643 newElements.markup = markup.toString(); 5643 newElements.markup = markup.toString();
5644 elementData.append(newElements); 5644 elementData.append(newElements);
5645 } 5645 }
5646 } 5646 }
5647 5647
5648 void Document::hideTransitionElements(const AtomicString& cssSelector) 5648 void Document::updateElementOpacity(const AtomicString& cssSelector, double opac ity)
5649 { 5649 {
5650 TrackExceptionState exceptionState; 5650 TrackExceptionState exceptionState;
5651 RefPtrWillBeRawPtr<StaticElementList> elementList = querySelectorAll(cssSele ctor, exceptionState); 5651 RefPtrWillBeRawPtr<StaticElementList> elementList = querySelectorAll(cssSele ctor, exceptionState);
5652 if (elementList && !exceptionState.hadException()) { 5652 if (elementList && !exceptionState.hadException()) {
5653 unsigned nodeListLength = elementList->length(); 5653 unsigned nodeListLength = elementList->length();
5654 5654
5655 for (unsigned nodeIndex = 0; nodeIndex < nodeListLength; ++nodeIndex) { 5655 for (unsigned nodeIndex = 0; nodeIndex < nodeListLength; ++nodeIndex) {
5656 Element* element = elementList->item(nodeIndex); 5656 Element* element = elementList->item(nodeIndex);
5657 element->setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiv eValue::CSS_NUMBER); 5657 element->setInlineStyleProperty(CSSPropertyOpacity, opacity, CSSPrim itiveValue::CSS_NUMBER);
5658 } 5658 }
5659 } 5659 }
5660 } 5660 }
5661 5661
5662 void Document::hideTransitionElements(const AtomicString& cssSelector)
5663 {
5664 updateElementOpacity(cssSelector, 0.0);
5665 }
5666
5667 void Document::showTransitionElements(const AtomicString& cssSelector)
5668 {
5669 updateElementOpacity(cssSelector, 1.0);
5670 }
5671
5662 bool Document::hasFocus() const 5672 bool Document::hasFocus() const
5663 { 5673 {
5664 Page* page = this->page(); 5674 Page* page = this->page();
5665 if (!page) 5675 if (!page)
5666 return false; 5676 return false;
5667 if (!page->focusController().isActive() || !page->focusController().isFocuse d()) 5677 if (!page->focusController().isActive() || !page->focusController().isFocuse d())
5668 return false; 5678 return false;
5669 Frame* focusedFrame = page->focusController().focusedFrame(); 5679 Frame* focusedFrame = page->focusController().focusedFrame();
5670 if (focusedFrame && focusedFrame->isLocalFrame()) { 5680 if (focusedFrame && focusedFrame->isLocalFrame()) {
5671 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame())) 5681 if (toLocalFrame(focusedFrame)->tree().isDescendantOf(frame()))
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5838 #ifndef NDEBUG 5848 #ifndef NDEBUG
5839 using namespace blink; 5849 using namespace blink;
5840 void showLiveDocumentInstances() 5850 void showLiveDocumentInstances()
5841 { 5851 {
5842 WeakDocumentSet& set = liveDocumentSet(); 5852 WeakDocumentSet& set = liveDocumentSet();
5843 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5853 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5844 for (Document* document : set) 5854 for (Document* document : set)
5845 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5855 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5846 } 5856 }
5847 #endif 5857 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698