Bug 1415940 Part 6: Create an InspectorUtils::HasRulesModifiedByCSSOM for use by devtools. r=bz,tromey
authorBrad Werth <bwerth@mozilla.com>
Fri, 05 Jan 2018 13:38:56 -0800
changeset 400080 fc525a00ff0cc6aebbd5c696a88974d6ef519019
parent 400079 1d6ebcc1be8f0ac1efc7240ca11f7e4a33bbad0c
child 400081 626ed9760dd19ada063716a3ddba44bd4913d2b6
push id58384
push userbwerth@mozilla.com
push dateSat, 20 Jan 2018 04:27:28 +0000
treeherderautoland@9cef0d0769af [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, tromey
bugs1415940
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1415940 Part 6: Create an InspectorUtils::HasRulesModifiedByCSSOM for use by devtools. r=bz,tromey 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).