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

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

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: with missing files Created 5 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 | Annotate | Revision Log
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 1763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 updateDistribution(); 1774 updateDistribution();
1775 updateStyleInvalidationIfNeeded(); 1775 updateStyleInvalidationIfNeeded();
1776 1776
1777 // FIXME: We should update style on our ancestor chain before proceeding 1777 // FIXME: We should update style on our ancestor chain before proceeding
1778 // however doing so currently causes several tests to crash, as LocalFrame:: setDocument calls Document::attach 1778 // however doing so currently causes several tests to crash, as LocalFrame:: setDocument calls Document::attach
1779 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi n on the document. The attach, in turn 1779 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi n on the document. The attach, in turn
1780 // resolves style (here) and then when we resolve style on the parent chain, we may end up 1780 // resolves style (here) and then when we resolve style on the parent chain, we may end up
1781 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed 1781 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed
1782 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. 1782 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
1783 1783
1784 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) 1784 if (m_elemSheet) {
1785 styleEngine().setUsesRemUnit(true); 1785 if (m_elemSheet->contents()->usesRemUnits())
1786 styleEngine().setUsesRemUnit(true);
1787 if (m_elemSheet->contents()->usesVariables()) {
1788 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
1789 styleEngine().setUsesVariables(true);
1790 }
1791 }
1786 1792
1787 updateStyle(change); 1793 updateStyle(change);
1788 1794
1789 notifyLayoutTreeOfSubtreeChanges(); 1795 notifyLayoutTreeOfSubtreeChanges();
1790 1796
1791 // As a result of the style recalculation, the currently hovered element mig ht have been 1797 // As a result of the style recalculation, the currently hovered element mig ht have been
1792 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event 1798 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event
1793 // to check if any other elements ended up under the mouse pointer due to re -layout. 1799 // to check if any other elements ended up under the mouse pointer due to re -layout.
1794 if (hoverNode() && !hoverNode()->layoutObject() && frame()) 1800 if (hoverNode() && !hoverNode()->layoutObject() && frame())
1795 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); 1801 frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 if (!m_baseURL.isValid()) 2843 if (!m_baseURL.isValid())
2838 m_baseURL = KURL(); 2844 m_baseURL = KURL();
2839 2845
2840 if (m_elemSheet) { 2846 if (m_elemSheet) {
2841 // Element sheet is silly. It never contains anything. 2847 // Element sheet is silly. It never contains anything.
2842 ASSERT(!m_elemSheet->contents()->ruleCount()); 2848 ASSERT(!m_elemSheet->contents()->ruleCount());
2843 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2849 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2844 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2850 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2845 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2851 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2846 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2852 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2853 m_elemSheet->contents()->parserSetUsesVariables(m_elemSheet->contents()- >usesVariables());
2847 } 2854 }
2848 2855
2849 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2856 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2850 // Base URL change changes any relative visited links. 2857 // Base URL change changes any relative visited links.
2851 // FIXME: There are other URLs in the tree that would need to be re-eval uated on dynamic base URL change. Style should be invalidated too. 2858 // FIXME: There are other URLs in the tree that would need to be re-eval uated on dynamic base URL change. Style should be invalidated too.
2852 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft er(*this)) 2859 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft er(*this))
2853 anchor.invalidateCachedVisitedLinkHash(); 2860 anchor.invalidateCachedVisitedLinkHash();
2854 } 2861 }
2855 } 2862 }
2856 2863
(...skipping 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after
5771 #ifndef NDEBUG 5778 #ifndef NDEBUG
5772 using namespace blink; 5779 using namespace blink;
5773 void showLiveDocumentInstances() 5780 void showLiveDocumentInstances()
5774 { 5781 {
5775 WeakDocumentSet& set = liveDocumentSet(); 5782 WeakDocumentSet& set = liveDocumentSet();
5776 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5783 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5777 for (Document* document : set) 5784 for (Document* document : set)
5778 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5785 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5779 } 5786 }
5780 #endif 5787 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698