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

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

Issue 1181023004: Move rem handling out of CSSParserValues.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Another attempt Created 5 years, 4 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 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())
1750 styleEngine().setUsesRemUnit(true);
1751
1752 updateStyle(change); 1749 updateStyle(change);
1753 1750
1754 notifyLayoutTreeOfSubtreeChanges(); 1751 notifyLayoutTreeOfSubtreeChanges();
1755 1752
1756 // As a result of the style recalculation, the currently hovered element mig ht have been 1753 // 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 1754 // 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. 1755 // to check if any other elements ended up under the mouse pointer due to re -layout.
1759 if (hoverNode() && !hoverNode()->layoutObject() && frame()) 1756 if (hoverNode() && !hoverNode()->layoutObject() && frame())
1760 frame()->eventHandler().dispatchFakeMouseMoveEventSoon(); 1757 frame()->eventHandler().dispatchFakeMouseMoveEventSoon();
1761 1758
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2867 m_baseURL = m_url; 2864 m_baseURL = m_url;
2868 2865
2869 selectorQueryCache().invalidate(); 2866 selectorQueryCache().invalidate();
2870 2867
2871 if (!m_baseURL.isValid()) 2868 if (!m_baseURL.isValid())
2872 m_baseURL = KURL(); 2869 m_baseURL = KURL();
2873 2870
2874 if (m_elemSheet) { 2871 if (m_elemSheet) {
2875 // Element sheet is silly. It never contains anything. 2872 // Element sheet is silly. It never contains anything.
2876 ASSERT(!m_elemSheet->contents()->ruleCount()); 2873 ASSERT(!m_elemSheet->contents()->ruleCount());
2877 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
2878 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 2874 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
2879 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
2880 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
2881 } 2875 }
2882 2876
2883 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) { 2877 if (!equalIgnoringFragmentIdentifier(oldBaseURL, m_baseURL)) {
2884 // Base URL change changes any relative visited links. 2878 // Base URL change changes any relative visited links.
2885 // 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. 2879 // 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.
2886 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft er(*this)) 2880 for (HTMLAnchorElement& anchor : Traversal<HTMLAnchorElement>::startsAft er(*this))
2887 anchor.invalidateCachedVisitedLinkHash(); 2881 anchor.invalidateCachedVisitedLinkHash();
2888 } 2882 }
2889 } 2883 }
2890 2884
(...skipping 2897 matching lines...) Expand 10 before | Expand all | Expand 10 after
5788 #ifndef NDEBUG 5782 #ifndef NDEBUG
5789 using namespace blink; 5783 using namespace blink;
5790 void showLiveDocumentInstances() 5784 void showLiveDocumentInstances()
5791 { 5785 {
5792 WeakDocumentSet& set = liveDocumentSet(); 5786 WeakDocumentSet& set = liveDocumentSet();
5793 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5787 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5794 for (Document* document : set) 5788 for (Document* document : set)
5795 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5789 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5796 } 5790 }
5797 #endif 5791 #endif
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/dom/DocumentStyleSheetCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698