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

Side by Side Diff: sky/engine/core/dom/Document.cpp

Issue 774953002: Always Reconstruct when stylesheets change. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentStyleSheetCollection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); 1585 bool usesRemUnits = m_elemSheet->contents()->usesRemUnits();
1586 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL); 1586 m_elemSheet = CSSStyleSheet::createInline(this, m_baseURL);
1587 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. 1587 // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely.
1588 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); 1588 m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits);
1589 } 1589 }
1590 } 1590 }
1591 1591
1592 void Document::didLoadAllImports() 1592 void Document::didLoadAllImports()
1593 { 1593 {
1594 if (!importLoader()) 1594 if (!importLoader())
1595 styleResolverMayHaveChanged(); 1595 styleResolverChanged();
1596 didLoadAllScriptBlockingResources(); 1596 didLoadAllScriptBlockingResources();
1597 } 1597 }
1598 1598
1599 void Document::didRemoveAllPendingStylesheet() 1599 void Document::didRemoveAllPendingStylesheet()
1600 { 1600 {
1601 styleResolverMayHaveChanged(); 1601 styleResolverChanged();
1602 1602
1603 // Only imports on master documents can trigger rendering. 1603 // Only imports on master documents can trigger rendering.
1604 if (HTMLImportLoader* import = importLoader()) 1604 if (HTMLImportLoader* import = importLoader())
1605 import->didRemoveAllPendingStylesheet(); 1605 import->didRemoveAllPendingStylesheet();
1606 if (!haveImportsLoaded()) 1606 if (!haveImportsLoaded())
1607 return; 1607 return;
1608 didLoadAllScriptBlockingResources(); 1608 didLoadAllScriptBlockingResources();
1609 } 1609 }
1610 1610
1611 void Document::didLoadAllScriptBlockingResources() 1611 void Document::didLoadAllScriptBlockingResources()
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 void Document::notifyResizeForViewportUnits() 1702 void Document::notifyResizeForViewportUnits()
1703 { 1703 {
1704 if (m_mediaQueryMatcher) 1704 if (m_mediaQueryMatcher)
1705 m_mediaQueryMatcher->viewportChanged(); 1705 m_mediaQueryMatcher->viewportChanged();
1706 if (!hasViewportUnits()) 1706 if (!hasViewportUnits())
1707 return; 1707 return;
1708 ensureStyleResolver().notifyResizeForViewportUnits(); 1708 ensureStyleResolver().notifyResizeForViewportUnits();
1709 setNeedsStyleRecalcForViewportUnits(); 1709 setNeedsStyleRecalcForViewportUnits();
1710 } 1710 }
1711 1711
1712 void Document::styleResolverChanged(StyleResolverUpdateMode updateMode) 1712 void Document::styleResolverChanged()
1713 { 1713 {
1714 // styleResolverChanged() can be invoked during Document destruction. 1714 // styleResolverChanged() can be invoked during Document destruction.
1715 // We just skip that case. 1715 // We just skip that case.
1716 if (!m_styleEngine) 1716 if (!m_styleEngine)
1717 return; 1717 return;
1718 1718
1719 m_styleEngine->resolverChanged(updateMode); 1719 m_styleEngine->resolverChanged();
1720 1720
1721 if (didLayoutWithPendingStylesheets()) { 1721 if (didLayoutWithPendingStylesheets()) {
1722 // We need to manually repaint because we avoid doing all repaints in la yout or style 1722 // We need to manually repaint because we avoid doing all repaints in la yout or style
1723 // recalc while sheets are still loading to avoid FOUC. 1723 // recalc while sheets are still loading to avoid FOUC.
1724 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets; 1724 m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
1725 1725
1726 ASSERT(renderView() || importsController()); 1726 ASSERT(renderView() || importsController());
1727 if (renderView()) 1727 if (renderView())
1728 renderView()->setShouldDoFullPaintInvalidation(true); 1728 renderView()->setShouldDoFullPaintInvalidation(true);
1729 } 1729 }
1730 } 1730 }
1731 1731
1732 void Document::styleResolverMayHaveChanged()
1733 {
1734 styleResolverChanged(hasNodesWithPlaceholderStyle() ? FullStyleUpdate : Anal yzedStyleUpdate);
1735 }
1736
1737 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) 1732 void Document::setHoverNode(PassRefPtr<Node> newHoverNode)
1738 { 1733 {
1739 m_hoverNode = newHoverNode; 1734 m_hoverNode = newHoverNode;
1740 } 1735 }
1741 1736
1742 void Document::setActiveHoverElement(PassRefPtr<Element> newActiveElement) 1737 void Document::setActiveHoverElement(PassRefPtr<Element> newActiveElement)
1743 { 1738 {
1744 if (!newActiveElement) { 1739 if (!newActiveElement) {
1745 m_activeHoverElement.clear(); 1740 m_activeHoverElement.clear();
1746 return; 1741 return;
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 PassOwnPtr<LifecycleNotifier<Document> > Document::createLifecycleNotifier() 2708 PassOwnPtr<LifecycleNotifier<Document> > Document::createLifecycleNotifier()
2714 { 2709 {
2715 return DocumentLifecycleNotifier::create(this); 2710 return DocumentLifecycleNotifier::create(this);
2716 } 2711 }
2717 2712
2718 DocumentLifecycleNotifier& Document::lifecycleNotifier() 2713 DocumentLifecycleNotifier& Document::lifecycleNotifier()
2719 { 2714 {
2720 return static_cast<DocumentLifecycleNotifier&>(LifecycleContext<Document>::l ifecycleNotifier()); 2715 return static_cast<DocumentLifecycleNotifier&>(LifecycleContext<Document>::l ifecycleNotifier());
2721 } 2716 }
2722 2717
2723 void Document::removedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upda teMode) 2718 void Document::removedStyleSheet(StyleSheet* sheet)
2724 { 2719 {
2725 // If we're in document teardown, then we don't need this notification of ou r sheet's removal. 2720 // If we're in document teardown, then we don't need this notification of ou r sheet's removal.
2726 // styleResolverChanged() is needed even when the document is inactive so th at 2721 // styleResolverChanged() is needed even when the document is inactive so th at
2727 // imported docuements (which is inactive) notifies the change to the master document. 2722 // imported docuements (which is inactive) notifies the change to the master document.
2728 if (isActive()) 2723 if (isActive())
2729 styleEngine()->modifiedStyleSheet(sheet); 2724 styleEngine()->modifiedStyleSheet(sheet);
2730 styleResolverChanged(updateMode); 2725 styleResolverChanged();
2731 } 2726 }
2732 2727
2733 void Document::modifiedStyleSheet(StyleSheet* sheet, StyleResolverUpdateMode upd ateMode) 2728 void Document::modifiedStyleSheet(StyleSheet* sheet)
2734 { 2729 {
2735 // If we're in document teardown, then we don't need this notification of ou r sheet's removal. 2730 // If we're in document teardown, then we don't need this notification of ou r sheet's removal.
2736 // styleResolverChanged() is needed even when the document is inactive so th at 2731 // styleResolverChanged() is needed even when the document is inactive so th at
2737 // imported docuements (which is inactive) notifies the change to the master document. 2732 // imported docuements (which is inactive) notifies the change to the master document.
2738 if (isActive()) 2733 if (isActive())
2739 styleEngine()->modifiedStyleSheet(sheet); 2734 styleEngine()->modifiedStyleSheet(sheet);
2740 styleResolverChanged(updateMode); 2735 styleResolverChanged();
2741 } 2736 }
2742 2737
2743 Element* Document::activeElement() const 2738 Element* Document::activeElement() const
2744 { 2739 {
2745 if (Element* element = treeScope().adjustedFocusedElement()) 2740 if (Element* element = treeScope().adjustedFocusedElement())
2746 return element; 2741 return element;
2747 return documentElement(); 2742 return documentElement();
2748 } 2743 }
2749 2744
2750 void Document::getTransitionElementData(Vector<TransitionElementData>& elementDa ta) 2745 void Document::getTransitionElementData(Vector<TransitionElementData>& elementDa ta)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2795 using namespace blink; 2790 using namespace blink;
2796 void showLiveDocumentInstances() 2791 void showLiveDocumentInstances()
2797 { 2792 {
2798 WeakDocumentSet& set = liveDocumentSet(); 2793 WeakDocumentSet& set = liveDocumentSet();
2799 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 2794 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
2800 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) { 2795 for (WeakDocumentSet::const_iterator it = set.begin(); it != set.end(); ++it ) {
2801 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data()); 2796 fprintf(stderr, "- Document %p URL: %s\n", *it, (*it)->url().string().ut f8().data());
2802 } 2797 }
2803 } 2798 }
2804 #endif 2799 #endif
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | sky/engine/core/dom/DocumentStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698