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

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

Issue 547823002: Track reasons for |Node::SetNeedsStyleRecalc| (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use const char[] Created 6 years, 3 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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 setEncodingData(newEncodingData); 1197 setEncodingData(newEncodingData);
1198 } 1198 }
1199 1199
1200 void Document::setContentLanguage(const AtomicString& language) 1200 void Document::setContentLanguage(const AtomicString& language)
1201 { 1201 {
1202 if (m_contentLanguage == language) 1202 if (m_contentLanguage == language)
1203 return; 1203 return;
1204 m_contentLanguage = language; 1204 m_contentLanguage = language;
1205 1205
1206 // Document's style depends on the content language. 1206 // Document's style depends on the content language.
1207 setNeedsStyleRecalc(SubtreeStyleChange); 1207 setNeedsStyleRecalc(StyleChangeReasonForTracing::Language, SubtreeStyleChang e);
1208 } 1208 }
1209 1209
1210 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta te) 1210 void Document::setXMLVersion(const String& version, ExceptionState& exceptionSta te)
1211 { 1211 {
1212 if (!XMLDocumentParser::supportsXMLVersion(version)) { 1212 if (!XMLDocumentParser::supportsXMLVersion(version)) {
1213 exceptionState.throwDOMException(NotSupportedError, "This document does not support the XML version '" + version + "'."); 1213 exceptionState.throwDOMException(NotSupportedError, "This document does not support the XML version '" + version + "'.");
1214 return; 1214 return;
1215 } 1215 }
1216 1216
1217 m_xmlVersion = version; 1217 m_xmlVersion = version;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 1728
1729 // Resolved rem units are stored in the matched properties cache so we need to make sure to 1729 // Resolved rem units are stored in the matched properties cache so we need to make sure to
1730 // invalidate the cache if the documentElement needed to reattach or the fon t size changed 1730 // invalidate the cache if the documentElement needed to reattach or the fon t size changed
1731 // and then trigger a full document recalc. We also need to clear it here si nce the 1731 // and then trigger a full document recalc. We also need to clear it here si nce the
1732 // call to styleForElement on the body above can cache bad values for rem un its if the 1732 // call to styleForElement on the body above can cache bad values for rem un its if the
1733 // documentElement's style was dirty. We could keep track of which elements depend on 1733 // documentElement's style was dirty. We could keep track of which elements depend on
1734 // rem units like we do for viewport styles, but we assume root font size ch anges are 1734 // rem units like we do for viewport styles, but we assume root font size ch anges are
1735 // rare and just invalidate the cache for now. 1735 // rare and just invalidate the cache for now.
1736 if (styleEngine()->usesRemUnits() && (documentElement()->needsAttach() || do cumentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize() )) { 1736 if (styleEngine()->usesRemUnits() && (documentElement()->needsAttach() || do cumentElement()->computedStyle()->fontSize() != documentElementStyle->fontSize() )) {
1737 ensureStyleResolver().invalidateMatchedPropertiesCache(); 1737 ensureStyleResolver().invalidateMatchedPropertiesCache();
1738 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); 1738 documentElement()->setNeedsStyleRecalc(StyleChangeReasonForTracing::Font SizeChange, SubtreeStyleChange);
1739 } 1739 }
1740 1740
1741 EOverflow overflowX = OAUTO; 1741 EOverflow overflowX = OAUTO;
1742 EOverflow overflowY = OAUTO; 1742 EOverflow overflowY = OAUTO;
1743 float columnGap = 0; 1743 float columnGap = 0;
1744 if (overflowStyle) { 1744 if (overflowStyle) {
1745 overflowX = overflowStyle->overflowX(); 1745 overflowX = overflowStyle->overflowX();
1746 overflowY = overflowStyle->overflowY(); 1746 overflowY = overflowStyle->overflowY();
1747 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto': 1747 // Visible overflow on the viewport is meaningless, and the spec says to treat it as 'auto':
1748 if (overflowX == OVISIBLE) 1748 if (overflowX == OVISIBLE)
(...skipping 17 matching lines...) Expand all
1766 newStyle->setColumnGap(columnGap); 1766 newStyle->setColumnGap(columnGap);
1767 newStyle->setOverflowX(overflowX); 1767 newStyle->setOverflowX(overflowX);
1768 newStyle->setOverflowY(overflowY); 1768 newStyle->setOverflowY(overflowY);
1769 renderView()->setStyle(newStyle); 1769 renderView()->setStyle(newStyle);
1770 setupFontBuilder(newStyle.get()); 1770 setupFontBuilder(newStyle.get());
1771 } 1771 }
1772 1772
1773 if (body) { 1773 if (body) {
1774 if (RenderStyle* style = body->renderStyle()) { 1774 if (RenderStyle* style = body->renderStyle()) {
1775 if (style->direction() != rootDirection || style->writingMode() != r ootWritingMode) 1775 if (style->direction() != rootDirection || style->writingMode() != r ootWritingMode)
1776 body->setNeedsStyleRecalc(SubtreeStyleChange); 1776 body->setNeedsStyleRecalc(StyleChangeReasonForTracing::WritingMo deChange, SubtreeStyleChange);
1777 } 1777 }
1778 } 1778 }
1779 1779
1780 if (RenderStyle* style = documentElement()->renderStyle()) { 1780 if (RenderStyle* style = documentElement()->renderStyle()) {
1781 if (style->direction() != rootDirection || style->writingMode() != rootW ritingMode) 1781 if (style->direction() != rootDirection || style->writingMode() != rootW ritingMode)
1782 documentElement()->setNeedsStyleRecalc(SubtreeStyleChange); 1782 documentElement()->setNeedsStyleRecalc(StyleChangeReasonForTracing:: WritingModeChange, SubtreeStyleChange);
1783 } 1783 }
1784 } 1784 }
1785 1785
1786 void Document::updateRenderTree(StyleRecalcChange change) 1786 void Document::updateRenderTree(StyleRecalcChange change)
1787 { 1787 {
1788 ASSERT(isMainThread()); 1788 ASSERT(isMainThread());
1789 1789
1790 ScriptForbiddenScope forbidScript; 1790 ScriptForbiddenScope forbidScript;
1791 1791
1792 if (!view() || !isActive()) 1792 if (!view() || !isActive())
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 1955
1956 if (frameView->needsLayout()) 1956 if (frameView->needsLayout())
1957 frameView->layout(); 1957 frameView->layout();
1958 1958
1959 if (lifecycle().state() < DocumentLifecycle::LayoutClean) 1959 if (lifecycle().state() < DocumentLifecycle::LayoutClean)
1960 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); 1960 lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
1961 } 1961 }
1962 1962
1963 void Document::setNeedsFocusedElementCheck() 1963 void Document::setNeedsFocusedElementCheck()
1964 { 1964 {
1965 setNeedsStyleRecalc(LocalStyleChange); 1965 setNeedsStyleRecalc(StyleChangeReasonForTracing::FocusPseudoClass, LocalStyl eChange);
1966 } 1966 }
1967 1967
1968 void Document::clearFocusedElementSoon() 1968 void Document::clearFocusedElementSoon()
1969 { 1969 {
1970 if (!m_clearFocusedElementTimer.isActive()) 1970 if (!m_clearFocusedElementTimer.isActive())
1971 m_clearFocusedElementTimer.startOneShot(0, FROM_HERE); 1971 m_clearFocusedElementTimer.startOneShot(0, FROM_HERE);
1972 } 1972 }
1973 1973
1974 void Document::clearFocusedElementTimerFired(Timer<Document>*) 1974 void Document::clearFocusedElementTimerFired(Timer<Document>*)
1975 { 1975 {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 setSecurityOrigin(SecurityOrigin::createUnique()); 2081 setSecurityOrigin(SecurityOrigin::createUnique());
2082 didUpdateSecurityOrigin(); 2082 didUpdateSecurityOrigin();
2083 } 2083 }
2084 2084
2085 bool Document::dirtyElementsForLayerUpdate() 2085 bool Document::dirtyElementsForLayerUpdate()
2086 { 2086 {
2087 if (m_layerUpdateSVGFilterElements.isEmpty()) 2087 if (m_layerUpdateSVGFilterElements.isEmpty())
2088 return false; 2088 return false;
2089 2089
2090 for (WillBeHeapHashSet<RawPtrWillBeMember<Element> >::iterator it = m_layerU pdateSVGFilterElements.begin(), end = m_layerUpdateSVGFilterElements.end(); it ! = end; ++it) 2090 for (WillBeHeapHashSet<RawPtrWillBeMember<Element> >::iterator it = m_layerU pdateSVGFilterElements.begin(), end = m_layerUpdateSVGFilterElements.end(); it ! = end; ++it)
2091 (*it)->setNeedsStyleRecalc(LocalStyleChange); 2091 (*it)->setNeedsStyleRecalc(StyleChangeReasonForTracing::SVGFilterLayerUp date, LocalStyleChange);
2092 m_layerUpdateSVGFilterElements.clear(); 2092 m_layerUpdateSVGFilterElements.clear();
2093 return true; 2093 return true;
2094 } 2094 }
2095 2095
2096 void Document::scheduleSVGFilterLayerUpdateHack(Element& element) 2096 void Document::scheduleSVGFilterLayerUpdateHack(Element& element)
2097 { 2097 {
2098 if (element.styleChangeType() == NeedsReattachStyleChange) 2098 if (element.styleChangeType() == NeedsReattachStyleChange)
2099 return; 2099 return;
2100 element.setSVGFilterNeedsLayerUpdate(); 2100 element.setSVGFilterNeedsLayerUpdate();
2101 m_layerUpdateSVGFilterElements.add(&element); 2101 m_layerUpdateSVGFilterElements.add(&element);
(...skipping 2205 matching lines...) Expand 10 before | Expand all | Expand 10 after
4307 4307
4308 m_encodingData = newData; 4308 m_encodingData = newData;
4309 4309
4310 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is sues/detail?id=319643 4310 // FIXME: Should be removed as part of https://code.google.com/p/chromium/is sues/detail?id=319643
4311 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering( ); 4311 bool shouldUseVisualOrdering = m_encodingData.encoding().usesVisualOrdering( );
4312 if (shouldUseVisualOrdering != m_visuallyOrdered) { 4312 if (shouldUseVisualOrdering != m_visuallyOrdered) {
4313 m_visuallyOrdered = shouldUseVisualOrdering; 4313 m_visuallyOrdered = shouldUseVisualOrdering;
4314 // FIXME: How is possible to not have a renderer here? 4314 // FIXME: How is possible to not have a renderer here?
4315 if (renderView()) 4315 if (renderView())
4316 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde r : LogicalOrder); 4316 renderView()->style()->setRTLOrdering(m_visuallyOrdered ? VisualOrde r : LogicalOrder);
4317 setNeedsStyleRecalc(SubtreeStyleChange); 4317 setNeedsStyleRecalc(StyleChangeReasonForTracing::VisuallyOrdered, Subtre eStyleChange);
4318 } 4318 }
4319 } 4319 }
4320 4320
4321 KURL Document::completeURL(const String& url) const 4321 KURL Document::completeURL(const String& url) const
4322 { 4322 {
4323 return completeURLWithOverride(url, m_baseURL); 4323 return completeURLWithOverride(url, m_baseURL);
4324 } 4324 }
4325 4325
4326 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve rride) const 4326 KURL Document::completeURLWithOverride(const String& url, const KURL& baseURLOve rride) const
4327 { 4327 {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
4469 } 4469 }
4470 4470
4471 void Document::setDesignMode(InheritedBool value) 4471 void Document::setDesignMode(InheritedBool value)
4472 { 4472 {
4473 m_designMode = value; 4473 m_designMode = value;
4474 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) { 4474 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext(m_fra me)) {
4475 if (!frame->isLocalFrame()) 4475 if (!frame->isLocalFrame())
4476 continue; 4476 continue;
4477 if (!toLocalFrame(frame)->document()) 4477 if (!toLocalFrame(frame)->document())
4478 break; 4478 break;
4479 toLocalFrame(frame)->document()->setNeedsStyleRecalc(SubtreeStyleChange) ; 4479 toLocalFrame(frame)->document()->setNeedsStyleRecalc(StyleChangeReasonFo rTracing::DesignMode, SubtreeStyleChange);
4480 } 4480 }
4481 } 4481 }
4482 4482
4483 Document::InheritedBool Document::getDesignMode() const 4483 Document::InheritedBool Document::getDesignMode() const
4484 { 4484 {
4485 return m_designMode; 4485 return m_designMode;
4486 } 4486 }
4487 4487
4488 bool Document::inDesignMode() const 4488 bool Document::inDesignMode() const
4489 { 4489 {
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
5850 using namespace blink; 5850 using namespace blink;
5851 void showLiveDocumentInstances() 5851 void showLiveDocumentInstances()
5852 { 5852 {
5853 WeakDocumentSet& set = liveDocumentSet(); 5853 WeakDocumentSet& set = liveDocumentSet();
5854 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5854 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5855 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 5855 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
5856 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 5856 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
5857 } 5857 }
5858 } 5858 }
5859 #endif 5859 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698