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

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

Issue 772803002: Delay construction of StyleResolverState until after style sharing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.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
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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 } 554 }
555 555
556 document().setHasNodesWithPlaceholderStyle(); 556 document().setHasNodesWithPlaceholderStyle();
557 return s_styleNotYetAvailable; 557 return s_styleNotYetAvailable;
558 } 558 }
559 559
560 didAccess(); 560 didAccess();
561 561
562 StyleResolverParentScope::ensureParentStackIsPushed(); 562 StyleResolverParentScope::ensureParentStackIsPushed();
563 563
564 StyleResolverState state(document(), element, defaultParent); 564 ElementResolveContext elementContext(*element);
565 565
566 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { 566 if (sharingBehavior == AllowStyleSharing && (defaultParent || elementContext .parentStyle())) {
567 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this); 567 SharedStyleFinder styleFinder(elementContext, m_features, m_siblingRuleS et.get(), m_uncommonAttributeRuleSet.get(), *this);
568 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) 568 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle())
569 return sharedStyle.release(); 569 return sharedStyle.release();
570 } 570 }
571 571
572 StyleResolverState state(document(), elementContext, defaultParent);
andersr 2014/12/02 14:08:17 I ran blink_perf.css locally on this patch, and I
573
572 ActiveAnimations* activeAnimations = element->activeAnimations(); 574 ActiveAnimations* activeAnimations = element->activeAnimations();
573 const RenderStyle* baseRenderStyle = activeAnimations ? activeAnimations->ba seRenderStyle() : nullptr; 575 const RenderStyle* baseRenderStyle = activeAnimations ? activeAnimations->ba seRenderStyle() : nullptr;
574 576
575 if (baseRenderStyle) { 577 if (baseRenderStyle) {
576 state.setStyle(RenderStyle::clone(baseRenderStyle)); 578 state.setStyle(RenderStyle::clone(baseRenderStyle));
577 if (!state.parentStyle()) 579 if (!state.parentStyle())
578 state.setParentStyle(defaultStyleForElement()); 580 state.setParentStyle(defaultStyleForElement());
579 } else { 581 } else {
580 if (state.parentStyle()) { 582 if (state.parentStyle()) {
581 RefPtr<RenderStyle> style = RenderStyle::create(); 583 RefPtr<RenderStyle> style = RenderStyle::create();
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 visitor->trace(m_uncommonAttributeRuleSet); 1606 visitor->trace(m_uncommonAttributeRuleSet);
1605 visitor->trace(m_watchedSelectorsRules); 1607 visitor->trace(m_watchedSelectorsRules);
1606 visitor->trace(m_treeBoundaryCrossingRules); 1608 visitor->trace(m_treeBoundaryCrossingRules);
1607 visitor->trace(m_styleSharingLists); 1609 visitor->trace(m_styleSharingLists);
1608 visitor->trace(m_pendingStyleSheets); 1610 visitor->trace(m_pendingStyleSheets);
1609 visitor->trace(m_document); 1611 visitor->trace(m_document);
1610 #endif 1612 #endif
1611 } 1613 }
1612 1614
1613 } // namespace blink 1615 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698