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

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

Issue 772103002: Collect content:attr(...)-features in RuleFeatureSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Avoid findPropertyIndex when possible. 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor () : 1); 510 documentStyle->setZoom(frame && !document.printing() ? frame->pageZoomFactor () : 1);
511 documentStyle->setLocale(document.contentLanguage()); 511 documentStyle->setLocale(document.contentLanguage());
512 documentStyle->setZIndex(0); 512 documentStyle->setZIndex(0);
513 documentStyle->setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONL Y); 513 documentStyle->setUserModify(document.inDesignMode() ? READ_WRITE : READ_ONL Y);
514 514
515 document.setupFontBuilder(documentStyle.get()); 515 document.setupFontBuilder(documentStyle.get());
516 516
517 return documentStyle.release(); 517 return documentStyle.release();
518 } 518 }
519 519
520 static void addContentAttrValuesToFeatures(const Vector<AtomicString>& contentAt trValues, RuleFeatureSet& features)
521 {
522 for (size_t i = 0; i < contentAttrValues.size(); ++i)
523 features.addContentAttr(contentAttrValues[i]);
524 }
525
526 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen t) 520 void StyleResolver::adjustRenderStyle(StyleResolverState& state, Element* elemen t)
527 { 521 {
528 StyleAdjuster adjuster(document().inQuirksMode()); 522 StyleAdjuster adjuster(document().inQuirksMode());
529 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, stat e.cachedUAStyle()); 523 adjuster.adjustRenderStyle(state.style(), state.parentStyle(), element, stat e.cachedUAStyle());
530 } 524 }
531 525
532 // Start loading resources referenced by this style. 526 // Start loading resources referenced by this style.
533 void StyleResolver::loadPendingResources(StyleResolverState& state) 527 void StyleResolver::loadPendingResources(StyleResolverState& state)
534 { 528 {
535 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources()); 529 m_styleResourceLoader.loadPendingResources(state.style(), state.elementStyle Resources());
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 if (element->renderStyle() && element->renderStyle()->textAutosizingMult iplier() != state.style()->textAutosizingMultiplier()) { 617 if (element->renderStyle() && element->renderStyle()->textAutosizingMult iplier() != state.style()->textAutosizingMultiplier()) {
624 // Preserve the text autosizing multiplier on style recalc. Autosize r will update it during layout if needed. 618 // Preserve the text autosizing multiplier on style recalc. Autosize r will update it during layout if needed.
625 // NOTE: this must occur before applyMatchedProperties for correct c omputation of font-relative lengths. 619 // NOTE: this must occur before applyMatchedProperties for correct c omputation of font-relative lengths.
626 state.style()->setTextAutosizingMultiplier(element->renderStyle()->t extAutosizingMultiplier()); 620 state.style()->setTextAutosizingMultiplier(element->renderStyle()->t extAutosizingMultiplier());
627 state.style()->setUnique(); 621 state.style()->setUnique();
628 } 622 }
629 623
630 applyMatchedProperties(state, collector.matchedResult()); 624 applyMatchedProperties(state, collector.matchedResult());
631 applyCallbackSelectors(state); 625 applyCallbackSelectors(state);
632 626
633 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features);
634
635 // Cache our original display. 627 // Cache our original display.
636 state.style()->setOriginalDisplay(state.style()->display()); 628 state.style()->setOriginalDisplay(state.style()->display());
637 629
638 adjustRenderStyle(state, element); 630 adjustRenderStyle(state, element);
639 631
640 if (activeAnimations) 632 if (activeAnimations)
641 activeAnimations->updateBaseRenderStyle(state.style()); 633 activeAnimations->updateBaseRenderStyle(state.style());
642 } 634 }
643 635
644 // FIXME: The CSSWG wants to specify that the effects of animations are appl ied before 636 // FIXME: The CSSWG wants to specify that the effects of animations are appl ied before
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 798
807 matchUARules(collector); 799 matchUARules(collector);
808 matchAuthorRules(state.element(), collector, false); 800 matchAuthorRules(state.element(), collector, false);
809 801
810 if (collector.matchedResult().matchedProperties.isEmpty()) 802 if (collector.matchedResult().matchedProperties.isEmpty())
811 return false; 803 return false;
812 804
813 applyMatchedProperties(state, collector.matchedResult()); 805 applyMatchedProperties(state, collector.matchedResult());
814 applyCallbackSelectors(state); 806 applyCallbackSelectors(state);
815 807
816 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features);
817
818 // Cache our original display. 808 // Cache our original display.
819 state.style()->setOriginalDisplay(state.style()->display()); 809 state.style()->setOriginalDisplay(state.style()->display());
820 810
821 // FIXME: Passing 0 as the Element* introduces a lot of complexity 811 // FIXME: Passing 0 as the Element* introduces a lot of complexity
822 // in the adjustRenderStyle code. 812 // in the adjustRenderStyle code.
823 adjustRenderStyle(state, 0); 813 adjustRenderStyle(state, 0);
824 814
825 if (activeAnimations) 815 if (activeAnimations)
826 activeAnimations->updateBaseRenderStyle(state.style()); 816 activeAnimations->updateBaseRenderStyle(state.style());
827 } 817 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 bool inheritedOnly = false; 871 bool inheritedOnly = false;
882 872
883 MatchResult& result = collector.matchedResult(); 873 MatchResult& result = collector.matchedResult();
884 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu lt.matchedProperties.size() - 1, inheritedOnly); 874 applyMatchedProperties<HighPriorityProperties>(state, result, false, 0, resu lt.matchedProperties.size() - 1, inheritedOnly);
885 875
886 // If our font got dirtied, go ahead and update it now. 876 // If our font got dirtied, go ahead and update it now.
887 updateFont(state); 877 updateFont(state);
888 878
889 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul t.matchedProperties.size() - 1, inheritedOnly); 879 applyMatchedProperties<LowPriorityProperties>(state, result, false, 0, resul t.matchedProperties.size() - 1, inheritedOnly);
890 880
891 addContentAttrValuesToFeatures(state.contentAttrValues(), m_features);
892
893 loadPendingResources(state); 881 loadPendingResources(state);
894 882
895 didAccess(); 883 didAccess();
896 884
897 // Now return the style. 885 // Now return the style.
898 return state.takeStyle(); 886 return state.takeStyle();
899 } 887 }
900 888
901 void StyleResolver::collectViewportRules() 889 void StyleResolver::collectViewportRules()
902 { 890 {
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 visitor->trace(m_uncommonAttributeRuleSet); 1602 visitor->trace(m_uncommonAttributeRuleSet);
1615 visitor->trace(m_watchedSelectorsRules); 1603 visitor->trace(m_watchedSelectorsRules);
1616 visitor->trace(m_treeBoundaryCrossingRules); 1604 visitor->trace(m_treeBoundaryCrossingRules);
1617 visitor->trace(m_styleSharingLists); 1605 visitor->trace(m_styleSharingLists);
1618 visitor->trace(m_pendingStyleSheets); 1606 visitor->trace(m_pendingStyleSheets);
1619 visitor->trace(m_document); 1607 visitor->trace(m_document);
1620 #endif 1608 #endif
1621 } 1609 }
1622 1610
1623 } // namespace blink 1611 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleBuilderCustom.cpp ('k') | Source/core/css/resolver/StyleResolverState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698