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

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: ToT-ed again... Created 5 years, 5 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 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 updateDistribution(); 1739 updateDistribution();
1740 updateStyleInvalidationIfNeeded(); 1740 updateStyleInvalidationIfNeeded();
1741 1741
1742 // FIXME: We should update style on our ancestor chain before proceeding 1742 // FIXME: We should update style on our ancestor chain before proceeding
1743 // however doing so currently causes several tests to crash, as LocalFrame:: setDocument calls Document::attach 1743 // however doing so currently causes several tests to crash, as LocalFrame:: setDocument calls Document::attach
1744 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi n on the document. The attach, in turn 1744 // before setting the LocalDOMWindow on the LocalFrame, or the SecurityOrigi n on the document. The attach, in turn
1745 // resolves style (here) and then when we resolve style on the parent chain, we may end up 1745 // resolves style (here) and then when we resolve style on the parent chain, we may end up
1746 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed 1746 // re-attaching our containing iframe, which when asked HTMLFrameElementBase ::isURLAllowed
1747 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. 1747 // hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
1748 1748
1749 if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) 1749 if (m_elemSheet) {
1750 styleEngine().setUsesRemUnit(true); 1750 if (m_elemSheet->contents()->usesRemUnits())
1751 styleEngine().setUsesRemUnit(true);
1752 if (m_elemSheet->contents()->usesVariables()) {
1753 ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
1754 styleEngine().setUsesVariables(true);
1755 }
1756 }
1751 1757
1752 updateStyle(change); 1758 updateStyle(change);
1753 1759
1754 notifyLayoutTreeOfSubtreeChanges(); 1760 notifyLayoutTreeOfSubtreeChanges();
1755 1761
1756 // As a result of the style recalculation, the currently hovered element mig ht have been 1762 // As a result of the style recalculation, the currently hovered element mig ht have been
1757 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event 1763 // detached (for example, by setting display:none in the :hover style), sche dule another mouseMove event
1758 // to check if any other elements ended up under the mouse pointer due to re -layout. 1764 // to check if any other elements ended up under the mouse pointer due to re -layout.
1759 if (hoverNode() && !hoverNode()->layoutObject() && frame()) 1765 if (hoverNode() && !hoverNode()->layoutObject() && frame())
1760 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); 1766 frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 if (!m_baseURL.isValid()) 2876 if (!m_baseURL.isValid())
2871 m_baseURL = KURL(); 2877 m_baseURL = KURL();
2872 2878
2873 if (m_elemSheet) { 2879 if (m_elemSheet) {
2874 // Element sheet is silly. It never contains anything. 2880 // Element sheet is silly. It never contains anything.
2875 ASSERT(!m_elemSheet->contents()->ruleCount()); 2881 ASSERT(!m_elemSheet->contents()->ruleCount());
2876 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 2882 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2877 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2883 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2878 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 2884 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2879 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 2885 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2886 m_elemSheet->contents()->parserSetUsesVariables(m_elemSheet->contents()- >usesVariables());
2880 } 2887 }
2881 2888
2882 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2889 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2883 // Base URL change changes any relative visited links. 2890 // Base URL change changes any relative visited links.
2884 // 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. 2891 // 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.
2885 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft er(*this)) 2892 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft er(*this))
2886 anchor.invalidateCachedVisitedLinkHash(); 2893 anchor.invalidateCachedVisitedLinkHash();
2887 } 2894 }
2888 } 2895 }
2889 2896
(...skipping 2910 matching lines...) Expand 10 before | Expand all | Expand 10 after
5800 #ifndef NDEBUG 5807 #ifndef NDEBUG
5801 using namespace blink; 5808 using namespace blink;
5802 void showLiveDocumentInstances() 5809 void showLiveDocumentInstances()
5803 { 5810 {
5804 WeakDocumentSet& set = liveDocumentSet(); 5811 WeakDocumentSet& set = liveDocumentSet();
5805 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5812 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5806 for (Document* document : set) 5813 for (Document* document : set)
5807 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5814 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5808 } 5815 }
5809 #endif 5816 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698