| Index: Source/core/inspector/InspectorDOMAgent.cpp
|
| diff --git a/Source/core/inspector/InspectorDOMAgent.cpp b/Source/core/inspector/InspectorDOMAgent.cpp
|
| index a16bb309a89066ab8a27e3a215f9b64953b9debe..83956e1ed0a50f38ae0cc4dca2f17e9246a7e26a 100644
|
| --- a/Source/core/inspector/InspectorDOMAgent.cpp
|
| +++ b/Source/core/inspector/InspectorDOMAgent.cpp
|
| @@ -98,40 +98,6 @@ static const char domAgentEnabled[] = "domAgentEnabled";
|
| static const size_t maxTextSize = 10000;
|
| static const UChar ellipsisUChar[] = { 0x2026, 0 };
|
|
|
| -static Color parseColor(const RefPtr<JSONObject>* colorObject)
|
| -{
|
| - if (!colorObject || !(*colorObject))
|
| - return Color::transparent;
|
| -
|
| - int r;
|
| - int g;
|
| - int b;
|
| - bool success = (*colorObject)->getNumber("r", &r);
|
| - success |= (*colorObject)->getNumber("g", &g);
|
| - success |= (*colorObject)->getNumber("b", &b);
|
| - if (!success)
|
| - return Color::transparent;
|
| -
|
| - double a;
|
| - success = (*colorObject)->getNumber("a", &a);
|
| - if (!success)
|
| - return Color(r, g, b);
|
| -
|
| - // Clamp alpha to the [0..1] range.
|
| - if (a < 0)
|
| - a = 0;
|
| - else if (a > 1)
|
| - a = 1;
|
| -
|
| - return Color(r, g, b, static_cast<int>(a * 255));
|
| -}
|
| -
|
| -static Color parseConfigColor(const String& fieldName, JSONObject* configObject)
|
| -{
|
| - const RefPtr<JSONObject> colorObject = configObject->getObject(fieldName);
|
| - return parseColor(&colorObject);
|
| -}
|
| -
|
| static bool parseQuad(const RefPtr<JSONArray>& quadArray, FloatQuad* quad)
|
| {
|
| if (!quadArray)
|
| @@ -1230,27 +1196,7 @@ PassOwnPtr<InspectorHighlightConfig> InspectorDOMAgent::highlightConfigFromInspe
|
| *errorString = "Internal error: highlight configuration parameter is missing";
|
| return nullptr;
|
| }
|
| -
|
| - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig());
|
| - bool showInfo = false; // Default: false (do not show a tooltip).
|
| - highlightInspectorObject->getBoolean("showInfo", &showInfo);
|
| - highlightConfig->showInfo = showInfo;
|
| - bool showRulers = false; // Default: false (do not show rulers).
|
| - highlightInspectorObject->getBoolean("showRulers", &showRulers);
|
| - highlightConfig->showRulers = showRulers;
|
| - bool showExtensionLines = false; // Default: false (do not show extension lines).
|
| - highlightInspectorObject->getBoolean("showExtensionLines", &showExtensionLines);
|
| - highlightConfig->showExtensionLines = showExtensionLines;
|
| - highlightConfig->content = parseConfigColor("contentColor", highlightInspectorObject);
|
| - highlightConfig->contentOutline = parseConfigColor("contentOutlineColor", highlightInspectorObject);
|
| - highlightConfig->padding = parseConfigColor("paddingColor", highlightInspectorObject);
|
| - highlightConfig->border = parseConfigColor("borderColor", highlightInspectorObject);
|
| - highlightConfig->margin = parseConfigColor("marginColor", highlightInspectorObject);
|
| - highlightConfig->eventTarget = parseConfigColor("eventTargetColor", highlightInspectorObject);
|
| - highlightConfig->shape = parseConfigColor("shapeColor", highlightInspectorObject);
|
| - highlightConfig->shapeMargin = parseConfigColor("shapeMarginColor", highlightInspectorObject);
|
| -
|
| - return highlightConfig.release();
|
| + return InspectorHighlight::highlightConfigFromInspectorObject(highlightInspectorObject);
|
| }
|
|
|
| void InspectorDOMAgent::setInspectModeEnabled(ErrorString* errorString, bool enabled, const bool* inspectUAShadowDOM, const RefPtr<JSONObject>* highlightConfig)
|
| @@ -1279,9 +1225,7 @@ void InspectorDOMAgent::highlightQuad(ErrorString* errorString, const RefPtr<JSO
|
|
|
| void InspectorDOMAgent::innerHighlightQuad(PassOwnPtr<FloatQuad> quad, const RefPtr<JSONObject>* color, const RefPtr<JSONObject>* outlineColor)
|
| {
|
| - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig());
|
| - highlightConfig->content = parseColor(color);
|
| - highlightConfig->contentOutline = parseColor(outlineColor);
|
| + OwnPtr<InspectorHighlightConfig> highlightConfig = InspectorHighlight::highlightConfigWithColors(color, outlineColor);
|
| m_overlay->highlightQuad(quad, *highlightConfig);
|
| }
|
|
|
| @@ -1319,10 +1263,8 @@ void InspectorDOMAgent::highlightFrame(
|
| LocalFrame* frame = m_pageAgent->frameForId(frameId);
|
| // FIXME: Inspector doesn't currently work cross process.
|
| if (frame && frame->deprecatedLocalOwner()) {
|
| - OwnPtr<InspectorHighlightConfig> highlightConfig = adoptPtr(new InspectorHighlightConfig());
|
| + OwnPtr<InspectorHighlightConfig> highlightConfig = InspectorHighlight::highlightConfigWithColors(color, outlineColor);
|
| highlightConfig->showInfo = true; // Always show tooltips for frames.
|
| - highlightConfig->content = parseColor(color);
|
| - highlightConfig->contentOutline = parseColor(outlineColor);
|
| m_overlay->highlightNode(frame->deprecatedLocalOwner(), 0 /* eventTarget */, *highlightConfig, false);
|
| }
|
| }
|
|
|