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

Side by Side Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 1182483004: DevTools: [CSS] getMatchedStylesForNode should return styles inherited through shadow boundary (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaseline Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector-protocol/css/css-shadow-host-rule-expected.txt ('k') | no next file » | 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 pseudoElements->addItem(matches.release()); 767 pseudoElements->addItem(matches.release());
768 } 768 }
769 } 769 }
770 770
771 pseudoIdMatches = pseudoElements.release(); 771 pseudoIdMatches = pseudoElements.release();
772 } 772 }
773 773
774 // Inherited styles. 774 // Inherited styles.
775 if (!elementPseudoId && !asBool(excludeInherited)) { 775 if (!elementPseudoId && !asBool(excludeInherited)) {
776 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entri es = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create(); 776 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entri es = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create();
777 Element* parentElement = element->parentElement(); 777 Element* parentElement = element->parentOrShadowHostElement();
778 while (parentElement) { 778 while (parentElement) {
779 StyleResolver& parentStyleResolver = parentElement->ownerDocument()- >ensureStyleResolver(); 779 StyleResolver& parentStyleResolver = parentElement->ownerDocument()- >ensureStyleResolver();
780 RefPtrWillBeRawPtr<CSSRuleList> parentMatchedRules = parentStyleReso lver.cssRulesForElement(parentElement, StyleResolver::AllCSSRules); 780 RefPtrWillBeRawPtr<CSSRuleList> parentMatchedRules = parentStyleReso lver.cssRulesForElement(parentElement, StyleResolver::AllCSSRules);
781 RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::C SS::InheritedStyleEntry::create() 781 RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::C SS::InheritedStyleEntry::create()
782 .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRu les.get(), parentElement, NOPSEUDO)); 782 .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRu les.get(), parentElement, NOPSEUDO));
783 if (parentElement->style() && parentElement->style()->length()) { 783 if (parentElement->style() && parentElement->style()->length()) {
784 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyle Sheet(parentElement); 784 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyle Sheet(parentElement);
785 if (styleSheet) 785 if (styleSheet)
786 entry->setInlineStyle(styleSheet->buildObjectForStyle(styleS heet->styleAt(0))); 786 entry->setInlineStyle(styleSheet->buildObjectForStyle(styleS heet->styleAt(0)));
787 } 787 }
788 788
789 entries->addItem(entry.release()); 789 entries->addItem(entry.release());
790 parentElement = parentElement->parentElement(); 790 parentElement = parentElement->parentOrShadowHostElement();
791 } 791 }
792 792
793 inheritedEntries = entries.release(); 793 inheritedEntries = entries.release();
794 } 794 }
795 } 795 }
796 796
797 void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nod eId, RefPtr<TypeBuilder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::C SSStyle>& attributesStyle) 797 void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nod eId, RefPtr<TypeBuilder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::C SSStyle>& attributesStyle)
798 { 798 {
799 Element* element = elementForId(errorString, nodeId); 799 Element* element = elementForId(errorString, nodeId);
800 if (!element) 800 if (!element)
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1589 visitor->trace(m_invalidatedDocuments); 1589 visitor->trace(m_invalidatedDocuments);
1590 visitor->trace(m_nodeToInspectorStyleSheet); 1590 visitor->trace(m_nodeToInspectorStyleSheet);
1591 visitor->trace(m_documentToViaInspectorStyleSheet); 1591 visitor->trace(m_documentToViaInspectorStyleSheet);
1592 #endif 1592 #endif
1593 visitor->trace(m_inspectorUserAgentStyleSheet); 1593 visitor->trace(m_inspectorUserAgentStyleSheet);
1594 InspectorBaseAgent::trace(visitor); 1594 InspectorBaseAgent::trace(visitor);
1595 } 1595 }
1596 1596
1597 } // namespace blink 1597 } // namespace blink
1598 1598
OLDNEW
« no previous file with comments | « LayoutTests/inspector-protocol/css/css-shadow-host-rule-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698