Bug 1415940 Part 6: Create an InspectorUtils::HasRulesModifiedByCSSOM for use by devtools. draft
authorBrad Werth <bwerth@mozilla.com>
Fri, 05 Jan 2018 13:38:56 -0800
changeset 721878 b512865ac99916f48dca42916211da1f9809c722
parent 721877 c81f439f1adb43621ea77e3fc90fbda5573fb7d5
child 721879 e56586ae529829312128ac0cb929381a81ea07ca
push id95979
push userbwerth@mozilla.com
push dateThu, 18 Jan 2018 00:40:34 +0000
bugs1415940
milestone59.0a1
Bug 1415940 Part 6: Create an InspectorUtils::HasRulesModifiedByCSSOM for use by devtools. MozReview-Commit-ID: GrQ7HvBIzkZ
dom/webidl/InspectorUtils.webidl
layout/inspector/InspectorUtils.cpp
layout/inspector/InspectorUtils.h
--- a/dom/webidl/InspectorUtils.webidl
+++ b/dom/webidl/InspectorUtils.webidl
@@ -13,16 +13,17 @@
 namespace InspectorUtils {
   sequence<StyleSheet> getAllStyleSheets(Document document);
   sequence<CSSRule> getCSSStyleRules(
     Element element,
     [TreatNullAs=EmptyString] optional DOMString pseudo = "");
   unsigned long getRuleLine(CSSRule rule);
   unsigned long getRuleColumn(CSSRule rule);
   unsigned long getRelativeRuleLine(CSSRule rule);
+  boolean hasRulesModifiedByCSSOM(CSSStyleSheet sheet);
   [NewObject] CSSLexer getCSSLexer(DOMString text);
   unsigned long getSelectorCount(CSSStyleRule rule);
   [Throws] DOMString getSelectorText(CSSStyleRule rule,
                                      unsigned long selectorIndex);
   [Throws] unsigned long long getSpecificity(CSSStyleRule rule,
                                              unsigned long selectorIndex);
   [Throws] boolean selectorMatchesElement(
       Element element,
--- a/layout/inspector/InspectorUtils.cpp
+++ b/layout/inspector/InspectorUtils.cpp
@@ -314,16 +314,22 @@ InspectorUtils::GetRelativeRuleLine(Glob
         }
       }
     }
   }
 
   return lineNumber;
 }
 
+/* static */ bool
+InspectorUtils::HasRulesModifiedByCSSOM(GlobalObject& aGlobal, StyleSheet& aSheet)
+{
+  return aSheet.HasModifiedRules();
+}
+
 /* static */ CSSLexer*
 InspectorUtils::GetCSSLexer(GlobalObject& aGlobal, const nsAString& aText)
 {
   return new CSSLexer(aText);
 }
 
 /* static */ uint32_t
 InspectorUtils::GetSelectorCount(GlobalObject& aGlobal,
--- a/layout/inspector/InspectorUtils.h
+++ b/layout/inspector/InspectorUtils.h
@@ -64,16 +64,18 @@ public:
    * returns a line number relative to the start of the element.
    *
    * @param aRule the rule to examine
    * @return the line number of the rule, possibly relative to the
    *         <style> element
    */
   static uint32_t GetRelativeRuleLine(GlobalObject& aGlobal, css::Rule& aRule);
 
+  static bool HasRulesModifiedByCSSOM(GlobalObject& aGlobal, StyleSheet& aSheet);
+
   static CSSLexer* GetCSSLexer(GlobalObject& aGlobal, const nsAString& aText);
 
   // Utilities for working with selectors.  We don't have a JS OM representation
   // of a single selector or a selector list yet, but given a rule we can index
   // into the selector list.
   //
   // These methods would probably make more sense being [ChromeOnly] APIs on
   // CSSStyleRule itself (bug 1428245).