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

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 196143004: Fix usage of pseudo style cache (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: check for cached pseudo style and mark pseudo styles with animations as unique Created 6 years, 9 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
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.cpp ('k') | Source/core/rendering/style/RenderStyle.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) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId)) 821 if (pseudoId < FIRST_INTERNAL_PSEUDOID && !parentRenderer->style()->hasPseud oStyle(pseudoId))
822 return nullptr; 822 return nullptr;
823 823
824 if (pseudoId == BACKDROP && !parent.isInTopLayer()) 824 if (pseudoId == BACKDROP && !parent.isInTopLayer())
825 return nullptr; 825 return nullptr;
826 826
827 if (!parentRenderer->canHaveGeneratedChildren()) 827 if (!parentRenderer->canHaveGeneratedChildren())
828 return nullptr; 828 return nullptr;
829 829
830 RenderStyle* parentStyle = parentRenderer->style(); 830 RenderStyle* parentStyle = parentRenderer->style();
831 if (RenderStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId)) {
832 if (!pseudoElementRendererIsNeeded(cachedStyle))
833 return nullptr;
834 return PseudoElement::create(&parent, pseudoId);
835 }
836
831 StyleResolverState state(document(), &parent, parentStyle); 837 StyleResolverState state(document(), &parent, parentStyle);
832 if (!pseudoStyleForElementInternal(parent, pseudoId, parentStyle, state)) 838 if (!pseudoStyleForElementInternal(parent, pseudoId, parentStyle, state))
833 return nullptr; 839 return nullptr;
834 RefPtr<RenderStyle> style = state.takeStyle(); 840 RefPtr<RenderStyle> style = state.takeStyle();
835 ASSERT(style); 841 ASSERT(style);
842 parentStyle->addCachedPseudoStyle(style);
836 843
837 if (!pseudoElementRendererIsNeeded(style.get())) 844 if (!pseudoElementRendererIsNeeded(style.get()))
838 return nullptr; 845 return nullptr;
839 846
840 parentStyle->addCachedPseudoStyle(style.release());
841 RefPtr<PseudoElement> pseudo = PseudoElement::create(&parent, pseudoId); 847 RefPtr<PseudoElement> pseudo = PseudoElement::create(&parent, pseudoId);
842 848
843 setAnimationUpdateIfNeeded(state, *pseudo); 849 setAnimationUpdateIfNeeded(state, *pseudo);
844 if (ActiveAnimations* activeAnimations = pseudo->activeAnimations()) 850 if (ActiveAnimations* activeAnimations = pseudo->activeAnimations())
845 activeAnimations->cssAnimations().maybeApplyPendingUpdate(pseudo.get()); 851 activeAnimations->cssAnimations().maybeApplyPendingUpdate(pseudo.get());
846 return pseudo.release(); 852 return pseudo.release();
847 } 853 }
848 854
849 bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo StyleRequest& pseudoStyleRequest, RenderStyle* parentStyle, StyleResolverState& state) 855 bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo StyleRequest& pseudoStyleRequest, RenderStyle* parentStyle, StyleResolverState& state)
850 { 856 {
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 bool StyleResolver::mediaQueryAffectedByViewportChange() const 1414 bool StyleResolver::mediaQueryAffectedByViewportChange() const
1409 { 1415 {
1410 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1416 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1411 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1417 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1412 return true; 1418 return true;
1413 } 1419 }
1414 return false; 1420 return false;
1415 } 1421 }
1416 1422
1417 } // namespace WebCore 1423 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleAdjuster.cpp ('k') | Source/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698