Bug 1427419 - Part 10: Remove unused nsIDOMUtils.colorNameToRGB. r=bz draft
authorCameron McCormack <cam@mcc.id.au>
Sat, 06 Jan 2018 15:08:14 +0800
changeset 716755 657f7f8ffc0aaaa7c3988431c575a5e54f444ea8
parent 716754 4337aeb9f092e05d33b3ae9c3a4f10598439775b
child 716756 7d5820e22808742b38700fb6b483627ac4c98580
push id94496
push userbmo:cam@mcc.id.au
push dateSat, 06 Jan 2018 07:08:40 +0000
reviewersbz
bugs1427419
milestone59.0a1
Bug 1427419 - Part 10: Remove unused nsIDOMUtils.colorNameToRGB. r=bz MozReview-Commit-ID: 962UjCZqX6I
dom/webidl/InspectorUtils.webidl
layout/inspector/inDOMUtils.cpp
layout/inspector/inIDOMUtils.idl
--- a/dom/webidl/InspectorUtils.webidl
+++ b/dom/webidl/InspectorUtils.webidl
@@ -33,28 +33,16 @@ namespace InspectorUtils {
   sequence<DOMString> getCSSPropertyNames(optional PropertyNamesOptions options);
   [Throws] sequence<DOMString> getCSSValuesForProperty(DOMString property);
 };
 
 dictionary PropertyNamesOptions {
   boolean includeAliases = false;
 };
 
-dictionary InspectorRGBTriple {
-  /*
-   * NOTE: Using octet for RGB components is not generally OK, because
-   * they can be outside the 0-255 range, but for backwards-compatible
-   * named colors (which is what we use this dictionary for) the 0-255
-   * assumption is fine.
-   */
-  octet r = 0;
-  octet g = 0;
-  octet b = 0;
-};
-
 dictionary InspectorRGBATuple {
   /*
    * NOTE: This tuple is in the normal 0-255-sized RGB space but can be
    * fractional and may extend outside the 0-255 range.
    *
    * a is in the range 0 - 1.
    */
   double r = 0;
--- a/layout/inspector/inDOMUtils.cpp
+++ b/layout/inspector/inDOMUtils.cpp
@@ -854,37 +854,16 @@ InspectorUtils::GetCSSValuesForProperty(
   InsertNoDuplicates(aResult, NS_LITERAL_STRING("inherit"));
   InsertNoDuplicates(aResult, NS_LITERAL_STRING("unset"));
 }
 
 } // namespace dom
 } // namespace mozilla
 
 NS_IMETHODIMP
-inDOMUtils::ColorNameToRGB(const nsAString& aColorName, JSContext* aCx,
-                           JS::MutableHandle<JS::Value> aValue)
-{
-  nscolor color;
-  if (!NS_ColorNameToRGB(aColorName, &color)) {
-    return NS_ERROR_INVALID_ARG;
-  }
-
-  InspectorRGBTriple triple;
-  triple.mR = NS_GET_R(color);
-  triple.mG = NS_GET_G(color);
-  triple.mB = NS_GET_B(color);
-
-  if (!ToJSValue(aCx, triple, aValue)) {
-    return NS_ERROR_FAILURE;
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 inDOMUtils::RgbToColorName(uint8_t aR, uint8_t aG, uint8_t aB,
                            nsAString& aColorName)
 {
   const char* color = NS_RGBToColorName(NS_RGB(aR, aG, aB));
   if (!color) {
     aColorName.Truncate();
     return NS_ERROR_INVALID_ARG;
   }
--- a/layout/inspector/inIDOMUtils.idl
+++ b/layout/inspector/inIDOMUtils.idl
@@ -16,18 +16,16 @@ interface nsIDOMNodeList;
 interface nsIDOMFontFaceList;
 interface nsIDOMRange;
 interface nsIDOMCSSStyleSheet;
 
 [scriptable, uuid(362e98c3-82c2-4ad8-8dcb-00e8e4eab497)]
 interface inIDOMUtils : nsISupports
 {
   // Utilities for working with CSS colors
-  [implicit_jscontext]
-  jsval colorNameToRGB(in DOMString aColorName);
   AString rgbToColorName(in octet aR, in octet aG, in octet aB);
 
   // Convert a given CSS color string to rgba. Returns null on failure or an
   // InspectorRGBATuple on success.
   //
   // NOTE: Converting a color to RGBA may be lossy when converting from some
   // formats e.g. CMYK.
   [implicit_jscontext]