Bug 1345206 - Wire up bindings for @page rule. r=xidorn draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Thu, 30 Mar 2017 21:25:22 -0500
changeset 559397 f356a7deba13a793e744246e0d2074dbc5768143
parent 559396 80da119b72fb19938be462c1c291e4829f527c53
child 623375 e2c926ecb2240f0aa30da04c15db896a8173bc2c
push id53073
push userbmo:jryans@gmail.com
push dateMon, 10 Apr 2017 02:45:18 +0000
reviewersxidorn
bugs1345206
milestone55.0a1
Bug 1345206 - Wire up bindings for @page rule. r=xidorn Connect the Servo types and functions for working with @page rules to Gecko. This also adjusts the Stylo test expectations to match the current state with @page support. MozReview-Commit-ID: 513d05m51wK
layout/style/ServoArcTypeList.h
layout/style/ServoBindingList.h
layout/style/ServoCSSRuleList.cpp
layout/style/test/stylo-failures.md
--- a/layout/style/ServoArcTypeList.h
+++ b/layout/style/ServoArcTypeList.h
@@ -12,8 +12,9 @@ SERVO_ARC_TYPE(ComputedValues, ServoComp
 SERVO_ARC_TYPE(DeclarationBlock, RawServoDeclarationBlock)
 SERVO_ARC_TYPE(StyleRule, RawServoStyleRule)
 SERVO_ARC_TYPE(ImportRule, RawServoImportRule)
 SERVO_ARC_TYPE(AnimationValue, RawServoAnimationValue)
 SERVO_ARC_TYPE(AnimationValueMap, RawServoAnimationValueMap)
 SERVO_ARC_TYPE(MediaList, RawServoMediaList)
 SERVO_ARC_TYPE(MediaRule, RawServoMediaRule)
 SERVO_ARC_TYPE(NamespaceRule, RawServoNamespaceRule)
+SERVO_ARC_TYPE(PageRule, RawServoPageRule)
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -90,16 +90,17 @@ SERVO_BINDING_FUNC(Servo_CssRules_Delete
                      ServoCssRulesBorrowed rules, uint32_t index) \
   SERVO_BINDING_FUNC(Servo_##type_##Rule_Debug, void, \
                      RawServo##type_##RuleBorrowed rule, nsACString* result) \
   SERVO_BINDING_FUNC(Servo_##type_##Rule_GetCssText, void, \
                      RawServo##type_##RuleBorrowed rule, nsAString* result)
 BASIC_RULE_FUNCS(Style)
 BASIC_RULE_FUNCS(Media)
 BASIC_RULE_FUNCS(Namespace)
+BASIC_RULE_FUNCS(Page)
 #undef BASIC_RULE_FUNCS
 SERVO_BINDING_FUNC(Servo_CssRules_GetFontFaceRuleAt, nsCSSFontFaceRule*,
                    ServoCssRulesBorrowed rules, uint32_t index)
 SERVO_BINDING_FUNC(Servo_StyleRule_GetStyle, RawServoDeclarationBlockStrong,
                    RawServoStyleRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_StyleRule_SetStyle, void,
                    RawServoStyleRuleBorrowed rule,
                    RawServoDeclarationBlockBorrowed declarations)
@@ -108,16 +109,21 @@ SERVO_BINDING_FUNC(Servo_StyleRule_GetSe
 SERVO_BINDING_FUNC(Servo_MediaRule_GetMedia, RawServoMediaListStrong,
                    RawServoMediaRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_MediaRule_GetRules, ServoCssRulesStrong,
                    RawServoMediaRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_NamespaceRule_GetPrefix, nsIAtom*,
                    RawServoNamespaceRuleBorrowed rule)
 SERVO_BINDING_FUNC(Servo_NamespaceRule_GetURI, nsIAtom*,
                    RawServoNamespaceRuleBorrowed rule)
+SERVO_BINDING_FUNC(Servo_PageRule_GetStyle, RawServoDeclarationBlockStrong,
+                   RawServoPageRuleBorrowed rule)
+SERVO_BINDING_FUNC(Servo_PageRule_SetStyle, void,
+                   RawServoPageRuleBorrowed rule,
+                   RawServoDeclarationBlockBorrowed declarations)
 
 // Animations API
 SERVO_BINDING_FUNC(Servo_ParseProperty,
                    RawServoDeclarationBlockStrong,
                    const nsACString* property, const nsACString* value,
                    RawGeckoURLExtraData* data)
 SERVO_BINDING_FUNC(Servo_ParseEasing, bool,
                    const nsAString* easing,
--- a/layout/style/ServoCSSRuleList.cpp
+++ b/layout/style/ServoCSSRuleList.cpp
@@ -7,16 +7,17 @@
 /* representation of CSSRuleList for stylo */
 
 #include "mozilla/ServoCSSRuleList.h"
 
 #include "mozilla/ServoBindings.h"
 #include "mozilla/ServoStyleRule.h"
 #include "mozilla/ServoMediaRule.h"
 #include "mozilla/ServoNamespaceRule.h"
+#include "mozilla/ServoPageRule.h"
 
 namespace mozilla {
 
 ServoCSSRuleList::ServoCSSRuleList(already_AddRefed<ServoCssRules> aRawRules)
   : mRawRules(aRawRules)
 {
   Servo_CssRules_ListTypes(mRawRules, &mRules);
   // XXX We may want to eagerly create object for import rule, so that
@@ -82,16 +83,17 @@ ServoCSSRuleList::GetRule(uint32_t aInde
       case nsIDOMCSSRule::const_##_RULE: {                                  \
         ruleObj = new Servo##name_##Rule(                                   \
           Servo_CssRules_Get##name_##RuleAt(mRawRules, aIndex).Consume());  \
         break;                                                              \
       }
       CASE_RULE(STYLE, Style)
       CASE_RULE(MEDIA, Media)
       CASE_RULE(NAMESPACE, Namespace)
+      CASE_RULE(PAGE, Page)
 #undef CASE_RULE
       case nsIDOMCSSRule::FONT_FACE_RULE: {
         // Returns a borrowed nsCSSFontFaceRule object directly, so we
         // don't need to create anything here, but we still need to have
         // the style sheet and parent rule set properly.
         ruleObj = Servo_CssRules_GetFontFaceRuleAt(mRawRules, aIndex);
         break;
       }
--- a/layout/style/test/stylo-failures.md
+++ b/layout/style/test/stylo-failures.md
@@ -65,16 +65,17 @@ to mochitest command.
 * test_bug635286.html: :-moz-any pseudo-class bugs [3]
 * CSSOM support:
   * @import
     * test_bug221428.html [1]
     * test_css_eof_handling.html: also relies on \@-moz-document [1]
   * @keyframes
     * test_keyframes_rules.html [1]
     * test_rules_out_of_sheets.html [1]
+    * test_bug887741_at-rules_in_declaration_lists.html `rules[2]` [1]
   * @support
     * test_supports_rules.html [1]
 * test_box_size_keywords.html: moz-prefixed intrinsic size keyword value [64]
 * test_bug357614.html: case-insensitivity for old attrs in attr selector servo/servo#15006 [2]
 * mapped attribute not supported
   * test_html_attribute_computed_values.html: also list-style-type [8]
 * test_bug387615.html: servo/servo#15006 [1]
 * test_bug397427.html: @import issue bug 1331291 and CSSOM support of @import [1]
@@ -240,20 +241,18 @@ to mochitest command.
     * test_value_storage.html `image-orientation` [80]
   * flexbox / grid position properties servo/servo#15001
     * test_inherit_storage.html `align-` [3]
     * ... `justify-` [3]
     * test_initial_storage.html `align-` [6]
     * ... `justify-` [6]
     * test_value_storage.html `align-` [9]
     * ... `justify-` [14]
-* @page support
-  * test_bug887741_at-rules_in_declaration_lists.html [1]
-  * test_page_parser.html [30]
-  * test_rule_insertion.html `@page` [4]
+* @page should ignore properties with viewport units bug 1353191
+  * test_page_parser.html `2v` [8]
 * Stylesheet cloning is somehow busted bug 1348481
   * test_selectors.html `cloned correctly` [157]
   * ... `matched clone` [204]
 * Unsupported prefixed values
   * moz-prefixed gradient functions bug 1337655
     * test_value_storage.html `-moz-linear-gradient` [322]
     * ... `-moz-radial-gradient` [309]
     * ... `-moz-repeating-` [298]
@@ -394,16 +393,18 @@ to mochitest command.
     * ... ` 2 ` [26]
     * ... `: 5 ` [84]
     * ... `border-spacing: ` [6]
     * ... `rect(1, ` [2]
 * test_pseudoelement_parsing.html: support parsing some pseudo-classes on some pseudo-elements [5]
 * Unit should be preserved after parsing servo/servo#15346
   * test_units_length.html [5]
   * test_units_time.html [1]
+  * test_page_parser.html `192px` [8]
+  * test_bug887741_at-rules_in_declaration_lists.html `188.96666px` [1]
 * insertRule / deleteRule don't work bug 1336863
   * test_rule_insertion.html [5]
 * @-moz-document support
   * test_rule_serialization.html [2]
   * test_moz_document_rules.html [13]
 * getComputedStyle style doesn't contain custom properties bug 1336891
   * test_variable_serialization_computed.html [35]
   * test_variables.html `custom property name` [2]