Skip to content

Commit

Permalink
Auto merge of #19374 - heycam:compute-color, r=TYLin
Browse files Browse the repository at this point in the history
geckolib: Return from Servo_ComputeColor whether the value was currentcolor.

Servo part of https://bugzilla.mozilla.org/show_bug.cgi?id=1420026, reviewed there by TYLin.

<!-- 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/19374)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Nov 26, 2017
2 parents 3f0ccd0 + c0dc50d commit b8b5c53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/style/gecko/generated/bindings.rs
Expand Up @@ -1574,7 +1574,7 @@ extern "C" {
} extern "C" {
pub fn Servo_IsValidCSSColor ( value : * const nsAString , ) -> bool ;
} extern "C" {
pub fn Servo_ComputeColor ( set : RawServoStyleSetBorrowedOrNull , current_color : nscolor , value : * const nsAString , result_color : * mut nscolor , ) -> bool ;
pub fn Servo_ComputeColor ( set : RawServoStyleSetBorrowedOrNull , current_color : nscolor , value : * const nsAString , result_color : * mut nscolor , was_current_color : * mut bool , ) -> bool ;
} extern "C" {
pub fn Servo_ParseIntersectionObserverRootMargin ( value : * const nsAString , result : * mut nsCSSRect , ) -> bool ;
} extern "C" {
Expand All @@ -1587,4 +1587,4 @@ extern "C" {
pub fn Gecko_ContentList_AppendAll ( aContentList : * mut nsSimpleContentList , aElements : * mut * const RawGeckoElement , aLength : usize , ) ;
} extern "C" {
pub fn Gecko_GetElementsWithId ( aDocument : * const nsIDocument , aId : * mut nsAtom , ) -> * const nsTArray < * mut Element > ;
}
}
6 changes: 6 additions & 0 deletions ports/geckolib/glue.rs
Expand Up @@ -4559,6 +4559,7 @@ pub extern "C" fn Servo_ComputeColor(
current_color: structs::nscolor,
value: *const nsAString,
result_color: *mut structs::nscolor,
was_current_color: *mut bool,
) -> bool {
use style::gecko;

Expand Down Expand Up @@ -4593,6 +4594,11 @@ pub extern "C" fn Servo_ComputeColor(
Some(computed_color) => {
let rgba = computed_color.to_rgba(current_color);
*result_color = gecko::values::convert_rgba_to_nscolor(&rgba);
if !was_current_color.is_null() {
unsafe {
*was_current_color = computed_color.is_currentcolor();
}
}
true
}
None => false,
Expand Down

0 comments on commit b8b5c53

Please sign in to comment.