mirror of
https://github.com/servo/servo.git
synced 2025-08-16 10:55:34 +01:00
Auto merge of #18365 - chenpighead:stylo-keyframe-location, r=upsuper,emilio
stylo: Store location information for keyframe rules. So far, we only store location info for the whole Keyframes block, not for each of the keyframe rule. Without this info, the devtool can't present the rules on the devtool panel properly. In this patch, we collect the source location info while parsing keyframe selector. The binding function, Servo_KeyframesRule_GetKeyframe, is also fixed (and renamed to Servo_KeyframesRule_GetKeyframeAt to match the fix) to accept line and column parameters from Gecko, so we can pass/set them with the source location from Servo. This is the servo part of [Bug 1394994](https://bugzilla.mozilla.org/show_bug.cgi?id=1394994). - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1394994](https://bugzilla.mozilla.org/show_bug.cgi?id=1394994) <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18365) <!-- Reviewable:end -->
This commit is contained in:
commit
f648e12935
6 changed files with 59 additions and 16 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use cssparser::SourceLocation;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, Importance};
|
||||
use style::properties::animated_properties::AnimatableLonghand;
|
||||
|
@ -29,10 +30,12 @@ fn test_empty_keyframe() {
|
|||
#[test]
|
||||
fn test_no_property_in_keyframe() {
|
||||
let shared_lock = SharedRwLock::new();
|
||||
let dummy_location = SourceLocation { line: 0, column: 0 };
|
||||
let keyframes = vec![
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(1.)]),
|
||||
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::new()))
|
||||
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::new())),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
];
|
||||
let animation = KeyframesAnimation::from_keyframes(&keyframes,
|
||||
|
@ -73,15 +76,18 @@ fn test_missing_property_in_initial_keyframe() {
|
|||
block
|
||||
}));
|
||||
|
||||
let dummy_location = SourceLocation { line: 0, column: 0 };
|
||||
let keyframes = vec![
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(0.)]),
|
||||
block: declarations_on_initial_keyframe.clone(),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(1.)]),
|
||||
block: declarations_on_final_keyframe.clone(),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
];
|
||||
let animation = KeyframesAnimation::from_keyframes(&keyframes,
|
||||
|
@ -133,15 +139,18 @@ fn test_missing_property_in_final_keyframe() {
|
|||
Importance::Normal,
|
||||
)));
|
||||
|
||||
let dummy_location = SourceLocation { line: 0, column: 0 };
|
||||
let keyframes = vec![
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(0.)]),
|
||||
block: declarations_on_initial_keyframe.clone(),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(1.)]),
|
||||
block: declarations_on_final_keyframe.clone(),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
];
|
||||
let animation = KeyframesAnimation::from_keyframes(&keyframes,
|
||||
|
@ -186,14 +195,17 @@ fn test_missing_keyframe_in_both_of_initial_and_final_keyframe() {
|
|||
block
|
||||
}));
|
||||
|
||||
let dummy_location = SourceLocation { line: 0, column: 0 };
|
||||
let keyframes = vec![
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(0.)]),
|
||||
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::new()))
|
||||
block: Arc::new(shared_lock.wrap(PropertyDeclarationBlock::new())),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
Arc::new(shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(vec![KeyframePercentage::new(0.5)]),
|
||||
block: declarations.clone(),
|
||||
source_location: dummy_location,
|
||||
})),
|
||||
];
|
||||
let animation = KeyframesAnimation::from_keyframes(&keyframes,
|
||||
|
|
|
@ -217,7 +217,11 @@ fn test_parse_stylesheet() {
|
|||
(PropertyDeclaration::Width(
|
||||
LengthOrPercentageOrAuto::Percentage(Percentage(0.))),
|
||||
Importance::Normal),
|
||||
])))
|
||||
]))),
|
||||
source_location: SourceLocation {
|
||||
line: 17,
|
||||
column: 13,
|
||||
},
|
||||
})),
|
||||
Arc::new(stylesheet.shared_lock.wrap(Keyframe {
|
||||
selector: KeyframeSelector::new_for_unit_testing(
|
||||
|
@ -231,6 +235,10 @@ fn test_parse_stylesheet() {
|
|||
vec![TimingFunction::ease()])),
|
||||
Importance::Normal),
|
||||
]))),
|
||||
source_location: SourceLocation {
|
||||
line: 18,
|
||||
column: 13,
|
||||
},
|
||||
})),
|
||||
],
|
||||
vendor_prefix: None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue