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

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

Issue 1521323002: Show custom properties in the computed style pane of the inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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) 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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 981
982 void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int no deId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >& s tyle) 982 void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int no deId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >& s tyle)
983 { 983 {
984 Node* node = m_domAgent->assertNode(errorString, nodeId); 984 Node* node = m_domAgent->assertNode(errorString, nodeId);
985 if (!node) 985 if (!node)
986 return; 986 return;
987 987
988 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu tedStyleDeclaration::create(node, true); 988 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> computedStyleInfo = CSSCompu tedStyleDeclaration::create(node, true);
989 RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(c omputedStyleInfo, nullptr, nullptr); 989 RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(c omputedStyleInfo, nullptr, nullptr);
990 style = inspectorStyle->buildArrayForComputedStyle(); 990 style = inspectorStyle->buildArrayForComputedStyle();
991
992 if (!RuntimeEnabledFeatures::cssVariablesEnabled())
993 return;
994
995 const HashMap<AtomicString, RefPtr<CSSVariableData>>* variables = computedSt yleInfo->getVariables();
996
997 if (variables && !variables->isEmpty()) {
998 for (const auto& it : *variables) {
999 RefPtr<TypeBuilder::CSS::CSSComputedStyleProperty> entry = TypeBuild er::CSS::CSSComputedStyleProperty::create()
1000 .setName(it.key)
1001 .setValue(it.value->tokenRange().serialize());
1002 style->addItem(entry);
1003 }
1004 }
991 } 1005 }
992 1006
993 void InspectorCSSAgent::collectPlatformFontsForLayoutObject(LayoutObject* layout Object, HashCountedSet<String>* fontStats) 1007 void InspectorCSSAgent::collectPlatformFontsForLayoutObject(LayoutObject* layout Object, HashCountedSet<String>* fontStats)
994 { 1008 {
995 if (!layoutObject->isText()) 1009 if (!layoutObject->isText())
996 return; 1010 return;
997 1011
998 FontCachePurgePreventer preventer; 1012 FontCachePurgePreventer preventer;
999 LayoutText* layoutText = toLayoutText(layoutObject); 1013 LayoutText* layoutText = toLayoutText(layoutObject);
1000 for (InlineTextBox* box = layoutText->firstTextBox(); box; box = box->nextTe xtBox()) { 1014 for (InlineTextBox* box = layoutText->firstTextBox(); box; box = box->nextTe xtBox()) {
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 visitor->trace(m_documentToCSSStyleSheets); 2003 visitor->trace(m_documentToCSSStyleSheets);
1990 visitor->trace(m_invalidatedDocuments); 2004 visitor->trace(m_invalidatedDocuments);
1991 visitor->trace(m_nodeToInspectorStyleSheet); 2005 visitor->trace(m_nodeToInspectorStyleSheet);
1992 visitor->trace(m_documentToViaInspectorStyleSheet); 2006 visitor->trace(m_documentToViaInspectorStyleSheet);
1993 #endif 2007 #endif
1994 visitor->trace(m_inspectorUserAgentStyleSheet); 2008 visitor->trace(m_inspectorUserAgentStyleSheet);
1995 InspectorBaseAgent::trace(visitor); 2009 InspectorBaseAgent::trace(visitor);
1996 } 2010 }
1997 2011
1998 } // namespace blink 2012 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698