| Index: third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| index 7ed5a9c0565280f5f17062fd8b95b99a931f7895..c4d6421d1dfdcdfa3d8b59a844ea52e7e7c0b393 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
|
| @@ -581,6 +581,30 @@ Node* InspectorDOMAgent::nodeForId(int id)
|
| return nullptr;
|
| }
|
|
|
| +void InspectorDOMAgent::collectClassNames(ErrorString* errorString, int nodeId, Maybe<protocol::Array<String>>* classNames)
|
| +{
|
| + HashSet<String> uniqueNames;
|
| + *classNames = protocol::Array<String>::create();
|
| + Node* node = nodeForId(nodeId);
|
| + if (!node || (!node->isElementNode() && !node->isDocumentNode() && !node->isDocumentFragment())) {
|
| + *errorString = "No suitable node with given id found";
|
| + return;
|
| + }
|
| +
|
| + for (; node; node = FlatTreeTraversal::next(*node)) {
|
| + if (node->isElementNode()) {
|
| + const Element& element = toElement(*node);
|
| + if (!element.hasClass())
|
| + continue;
|
| + const SpaceSplitString& classNameList = element.classNames();
|
| + for (unsigned i = 0; i < classNameList.size(); ++i)
|
| + uniqueNames.add(classNameList[i]);
|
| + }
|
| + }
|
| + for (const String& className : uniqueNames)
|
| + classNames->fromJust()->addItem(className);
|
| +}
|
| +
|
| void InspectorDOMAgent::requestChildNodes(ErrorString* errorString, int nodeId, const Maybe<int>& depth)
|
| {
|
| int sanitizedDepth = depth.fromMaybe(1);
|
|
|