Bug 1296477 - Part 3: stylo: Support counter-increment and counter-reset; r?heycam
MozReview-Commit-ID: DnSd8xAkidM
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1022,16 +1022,54 @@ Gecko_CopyStyleContentsFrom(nsStyleConte
aContent->AllocateContents(count);
for (uint32_t i = 0; i < count; ++i) {
aContent->ContentAt(i) = aOther->ContentAt(i);
}
}
void
+Gecko_ClearAndResizeCounterIncrements(nsStyleContent* aContent, uint32_t aHowMany)
+{
+ aContent->AllocateCounterIncrements(aHowMany);
+}
+
+void
+Gecko_CopyCounterIncrementsFrom(nsStyleContent* aContent, const nsStyleContent* aOther)
+{
+ uint32_t count = aOther->CounterIncrementCount();
+
+ aContent->AllocateCounterIncrements(count);
+
+ for (uint32_t i = 0; i < count; ++i) {
+ const nsStyleCounterData& data = aOther->CounterIncrementAt(i);
+ aContent->SetCounterIncrementAt(i, data.mCounter, data.mValue);
+ }
+}
+
+void
+Gecko_ClearAndResizeCounterResets(nsStyleContent* aContent, uint32_t aHowMany)
+{
+ aContent->AllocateCounterResets(aHowMany);
+}
+
+void
+Gecko_CopyCounterResetsFrom(nsStyleContent* aContent, const nsStyleContent* aOther)
+{
+ uint32_t count = aOther->CounterResetCount();
+
+ aContent->AllocateCounterResets(count);
+
+ for (uint32_t i = 0; i < count; ++i) {
+ const nsStyleCounterData& data = aOther->CounterResetAt(i);
+ aContent->SetCounterResetAt(i, data.mCounter, data.mValue);
+ }
+}
+
+void
Gecko_EnsureImageLayersLength(nsStyleImageLayers* aLayers, size_t aLen,
nsStyleImageLayers::LayerType aLayerType)
{
size_t oldLength = aLayers->mLayers.Length();
aLayers->mLayers.EnsureLengthAtLeast(aLen);
for (size_t i = oldLength; i < aLen; ++i) {
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -273,22 +273,27 @@ void Gecko_DropElementSnapshot(ServoElem
void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size);
// Same here, `array` must be an nsTArray<T>, for some T.
//
// Important note: Only valid for POD types, since destructors won't be run
// otherwise. This is ensured with rust traits for the relevant structs.
void Gecko_ClearPODTArray(void* array, size_t elem_size, size_t elem_align);
-// Clear the mContents field in nsStyleContent. This is needed to run the
-// destructors, otherwise we'd leak the images (though we still don't support
-// those), strings, and whatnot.
+// Clear the mContents, mCounterIncrements, or mCounterResets field in nsStyleContent. This is
+// needed to run the destructors, otherwise we'd leak the images, strings, and whatnot.
void Gecko_ClearAndResizeStyleContents(nsStyleContent* content,
uint32_t how_many);
+void Gecko_ClearAndResizeCounterIncrements(nsStyleContent* content,
+ uint32_t how_many);
+void Gecko_ClearAndResizeCounterResets(nsStyleContent* content,
+ uint32_t how_many);
void Gecko_CopyStyleContentsFrom(nsStyleContent* content, const nsStyleContent* other);
+void Gecko_CopyCounterResetsFrom(nsStyleContent* content, const nsStyleContent* other);
+void Gecko_CopyCounterIncrementsFrom(nsStyleContent* content, const nsStyleContent* other);
void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len,
nsStyleImageLayers::LayerType layer_type);
void Gecko_EnsureStyleAnimationArrayLength(void* array, size_t len);
void Gecko_EnsureStyleTransitionArrayLength(void* array, size_t len);
mozilla::Keyframe* Gecko_AnimationAppendKeyframe(RawGeckoKeyframeListBorrowedMut keyframes,
--- a/layout/style/test/stylo-failures.md
+++ b/layout/style/test/stylo-failures.md
@@ -107,17 +107,16 @@ Any line which doesn't follow the format
* test_animations_event_order.html [11]
* test_bug798843_pref.html: conditional opentype svg support [7]
* test_computed_style.html `gradient`: -moz-prefixed radient value [9]
* url value in style attribute bug 1310886
* test_computed_style.html `url` [11]
* test_parse_url.html [4]
* test_value_storage.html `url` [92]
* test_shorthand_property_getters.html `url` [3]
-* test_computed_style.html `mask`: setting mask shorthand resets subproperties to non-initial value bug 1331516 [0]
* auto value for min-{width,height} servo/servo#15045
* test_compute_data_with_start_struct.html `timing-function`: incorrectly computing keywords to bezier function servo/servo#15086 [2]
* test_condition_text.html: @-moz-document, CSSOM support of @media, @support [7]
* @counter-style support:
* test_counter_descriptor_storage.html [1]
* test_counter_style.html [1]
* test_rule_insertion.html `@counter-style` [4]
* test_value_storage.html `symbols(` [30]
@@ -128,17 +127,17 @@ Any line which doesn't follow the format
* test_descriptor_storage.html [1]
* test_descriptor_syntax_errors.html [1]
* test_font_face_parser.html `@font-face` [447]
* test_redundant_font_download.html [3]
* @namespace support:
* test_namespace_rule.html [17]
* test_dont_use_document_colors.html: support of disabling document color [21]
* test_exposed_prop_accessors.html: mainly various unsupported properties [*]
-* test_extra_inherit_initial.html: CSS-wide keywords are accepted as part of value servo/servo#15054 [966]
+* test_extra_inherit_initial.html: CSS-wide keywords are accepted as part of value servo/servo#15054 [986]
* test_flexbox_flex_shorthand.html `flex-basis`: **need investigation** [12]
* test_flexbox_layout.html: **need investigation** [5]
* test_font_feature_values_parsing.html: @font-feature-values support [107]
* Grid support:
* test_grid_computed_values.html [4]
* test_grid_container_shorthands.html [65]
* test_grid_item_shorthands.html [23]
* test_grid_shorthand_serialization.html [28]
@@ -263,29 +262,18 @@ Any line which doesn't follow the format
* test_value_storage.html `touch-action` [14]
* Unimplemented SVG properties:
* stroke properties
* test_value_storage.html `on 'stroke` [6]
* test_compute_data_with_start_struct.html `initial and other values of stroke-dasharray are different` [2]
* Properties implemented but not in geckolib:
* counter-reset property:
* test_bug829816.html [8]
- * test_compute_data_with_start_struct.html `counter-reset` [2]
- * test_inherit_computation.html `counter-reset` [2]
- * test_inherit_storage.html `counter-reset` [2]
- * test_initial_computation.html `counter-reset` [4]
- * test_initial_storage.html `counter-reset` [4]
* test_value_storage.html `counter-reset` [30]
* counter-increment property:
- * test_parse_ident.html [133]
- * test_compute_data_with_start_struct.html `counter-increment` [2]
- * test_inherit_computation.html `counter-increment` [2]
- * test_inherit_storage.html `counter-increment` [2]
- * test_initial_computation.html `counter-increment` [4]
- * test_initial_storage.html `counter-increment` [4]
* test_value_storage.html `counter-increment` [30]
* clip property: servo/servo#15729
* test_value_storage.html `should be idempotent for 'clip` [4]
* font-feature-settings property
* test_compute_data_with_start_struct.html `font-feature-settings` [2]
* test_inherit_computation.html `font-feature-settings` [8]
* test_inherit_storage.html `font-feature-settings` [12]
* test_initial_computation.html `font-feature-settings` [4]