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

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

Issue 427803002: DevTools: nits: introduce a handy asBool(bool*) and use across agents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « Source/core/inspector/InspectorBaseAgent.h ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('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) 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // directly here. We need to provide the Inspector better APIs to get this i nformation 663 // directly here. We need to provide the Inspector better APIs to get this i nformation
664 // without grabbing at internal style classes! 664 // without grabbing at internal style classes!
665 665
666 // Matched rules. 666 // Matched rules.
667 StyleResolver& styleResolver = ownerDocument->ensureStyleResolver(); 667 StyleResolver& styleResolver = ownerDocument->ensureStyleResolver();
668 668
669 RefPtrWillBeRawPtr<CSSRuleList> matchedRules = styleResolver.pseudoCSSRulesF orElement(element, elementPseudoId, StyleResolver::AllCSSRules); 669 RefPtrWillBeRawPtr<CSSRuleList> matchedRules = styleResolver.pseudoCSSRulesF orElement(element, elementPseudoId, StyleResolver::AllCSSRules);
670 matchedCSSRules = buildArrayForMatchedRuleList(matchedRules.get(), originalE lement); 670 matchedCSSRules = buildArrayForMatchedRuleList(matchedRules.get(), originalE lement);
671 671
672 // Pseudo elements. 672 // Pseudo elements.
673 if (!elementPseudoId && (!includePseudo || *includePseudo)) { 673 if (!elementPseudoId && asBool(includePseudo, true)) {
yurys 2014/07/29 13:48:05 Can we fix this place and get rid of defaultValue?
aandrey 2014/07/29 13:51:42 Done. Reverted.
674 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> > pseudoEle ments = TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches>::create(); 674 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> > pseudoEle ments = TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches>::create();
675 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_IN TERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { 675 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_IN TERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
676 RefPtrWillBeRawPtr<CSSRuleList> matchedRules = styleResolver.pseudoC SSRulesForElement(element, pseudoId, StyleResolver::AllCSSRules); 676 RefPtrWillBeRawPtr<CSSRuleList> matchedRules = styleResolver.pseudoC SSRulesForElement(element, pseudoId, StyleResolver::AllCSSRules);
677 if (matchedRules && matchedRules->length()) { 677 if (matchedRules && matchedRules->length()) {
678 RefPtr<TypeBuilder::CSS::PseudoIdMatches> matches = TypeBuilder: :CSS::PseudoIdMatches::create() 678 RefPtr<TypeBuilder::CSS::PseudoIdMatches> matches = TypeBuilder: :CSS::PseudoIdMatches::create()
679 .setPseudoId(static_cast<int>(pseudoId)) 679 .setPseudoId(static_cast<int>(pseudoId))
680 .setMatches(buildArrayForMatchedRuleList(matchedRules.get(), element)); 680 .setMatches(buildArrayForMatchedRuleList(matchedRules.get(), element));
681 pseudoElements->addItem(matches.release()); 681 pseudoElements->addItem(matches.release());
682 } 682 }
683 } 683 }
684 684
685 pseudoIdMatches = pseudoElements.release(); 685 pseudoIdMatches = pseudoElements.release();
686 } 686 }
687 687
688 // Inherited styles. 688 // Inherited styles.
689 if (!elementPseudoId && (!includeInherited || *includeInherited)) { 689 if (!elementPseudoId && asBool(includeInherited, true)) {
yurys 2014/07/29 13:48:05 ditto
690 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entri es = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create(); 690 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entri es = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create();
691 Element* parentElement = element->parentElement(); 691 Element* parentElement = element->parentElement();
692 while (parentElement) { 692 while (parentElement) {
693 StyleResolver& parentStyleResolver = parentElement->ownerDocument()- >ensureStyleResolver(); 693 StyleResolver& parentStyleResolver = parentElement->ownerDocument()- >ensureStyleResolver();
694 RefPtrWillBeRawPtr<CSSRuleList> parentMatchedRules = parentStyleReso lver.cssRulesForElement(parentElement, StyleResolver::AllCSSRules); 694 RefPtrWillBeRawPtr<CSSRuleList> parentMatchedRules = parentStyleReso lver.cssRulesForElement(parentElement, StyleResolver::AllCSSRules);
695 RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::C SS::InheritedStyleEntry::create() 695 RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::C SS::InheritedStyleEntry::create()
696 .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRu les.get(), parentElement)); 696 .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRu les.get(), parentElement));
697 if (parentElement->style() && parentElement->style()->length()) { 697 if (parentElement->style() && parentElement->style()->length()) {
698 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyle Sheet(parentElement); 698 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyle Sheet(parentElement);
699 if (styleSheet) 699 if (styleSheet)
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 visitor->trace(m_invalidatedDocuments); 1446 visitor->trace(m_invalidatedDocuments);
1447 visitor->trace(m_nodeToInspectorStyleSheet); 1447 visitor->trace(m_nodeToInspectorStyleSheet);
1448 visitor->trace(m_documentToViaInspectorStyleSheet); 1448 visitor->trace(m_documentToViaInspectorStyleSheet);
1449 #endif 1449 #endif
1450 visitor->trace(m_inspectorUserAgentStyleSheet); 1450 visitor->trace(m_inspectorUserAgentStyleSheet);
1451 InspectorBaseAgent::trace(visitor); 1451 InspectorBaseAgent::trace(visitor);
1452 } 1452 }
1453 1453
1454 } // namespace blink 1454 } // namespace blink
1455 1455
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorBaseAgent.h ('k') | Source/core/inspector/InspectorDOMAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698