Skip to content

Commit

Permalink
Auto merge of #14168 - Manishearth:tmp-transform, r=heycam
Browse files Browse the repository at this point in the history
stylo: support transform

r=heycam from https://bugzilla.mozilla.org/show_bug.cgi?id=1314200

<!-- 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/14168)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Nov 11, 2016
2 parents 796fae4 + bb5f351 commit 75d3524
Show file tree
Hide file tree
Showing 12 changed files with 2,238 additions and 542 deletions.
4 changes: 2 additions & 2 deletions components/layout/display_list_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ impl FragmentDisplayListBuilding for Fragment {

fn transform_matrix(&self, stacking_relative_border_box: &Rect<Au>) -> Matrix4D<f32> {
let mut transform = Matrix4D::identity();
let operations = match self.style.get_effects().transform.0 {
let operations = match self.style.get_box().transform.0 {
None => return transform,
Some(ref operations) => operations,
};
Expand Down Expand Up @@ -2036,7 +2036,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
self.base.clip = self.base.clip.translate(&-stacking_relative_border_box.origin);

// Account for `transform`, if applicable.
if self.fragment.style.get_effects().transform.0.is_none() {
if self.fragment.style.get_box().transform.0.is_none() {
return
}
let transform = match self.fragment
Expand Down
4 changes: 2 additions & 2 deletions components/layout/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ impl Fragment {
if self.style().get_effects().mix_blend_mode != mix_blend_mode::T::normal {
return true
}
if self.style().get_effects().transform.0.is_some() {
if self.style().get_box().transform.0.is_some() {
return true
}

Expand Down Expand Up @@ -2638,7 +2638,7 @@ impl Fragment {
_ => return self.style().get_position().z_index.number_or_zero(),
}

if self.style().get_effects().transform.0.is_some() {
if self.style().get_box().transform.0.is_some() {
return self.style().get_position().z_index.number_or_zero();
}

Expand Down
24 changes: 21 additions & 3 deletions components/style/binding_tools/regen.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"nsBorderColors",
"nsChangeHint",
"nscolor",
"nsCSSKeyword",
"nsCSSPropertyID",
"nsCSSRect",
"nsCSSRect_heap",
Expand Down Expand Up @@ -271,7 +272,11 @@
"StyleBasicShape",
"StyleBasicShapeType",
"StyleClipPath",
"nscoord",
"nsCSSKeyword",
"nsCSSShadowArray",
"nsCSSValue",
"nsCSSValueSharedList",
"nsChangeHint",
"nsFont",
"nsIAtom",
Expand Down Expand Up @@ -335,6 +340,9 @@
"RawGeckoDocument",
"RawServoDeclarationBlockStrong",
],
"servo_borrow_types": [
"nsCSSValue",
],
"whitelist_functions": [
"Servo_.*",
"Gecko_.*"
Expand Down Expand Up @@ -544,16 +552,26 @@ def zero_size_type(ty, flags):
zero_size_type(ty, flags)

if "servo_immutable_borrow_types" in current_target:
for ty in current_target["servo_immutable_borrow_types"]:
for ty in current_target.get("servo_immutable_borrow_types", []) + current_target.get("servo_borrow_types", []):
flags.append("--blacklist-type")
flags.append("{}Borrowed".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}Borrowed<'a> = &'a {0};".format(ty))
flags.append("--blacklist-type")
flags.append("{}BorrowedOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedOrNull<'a> = \
Option<&'a {0}>;".format(ty))
flags.append("pub type {0}BorrowedOrNull<'a> = Option<&'a {0}>;".format(ty))
if "servo_borrow_types" in current_target:
for ty in current_target["servo_borrow_types"]:
flags.append("--blacklist-type")
flags.append("{}BorrowedMut".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedMut<'a> = &'a mut {0};".format(ty))
flags.append("--blacklist-type")
flags.append("{}BorrowedMutOrNull".format(ty))
flags.append("--raw-line")
flags.append("pub type {0}BorrowedMutOrNull<'a> = \
Option<&'a mut {0}>;".format(ty))
# Right now the only immutable borrow types are ones which we import
# from the |structs| module. As such, we don't need to create an opaque
# type with zero_size_type. If we ever introduce immutable borrow types
Expand Down
51 changes: 51 additions & 0 deletions components/style/gecko_bindings/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;
pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'a RawServoDeclarationBlockStrong;
pub type RawServoDeclarationBlockStrongBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlockStrong>;
pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue;
pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>;
pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue;
pub type nsCSSValueBorrowedMutOrNull<'a> = Option<&'a mut nsCSSValue>;
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
pub type RawServoStyleSetBorrowedMut<'a> = &'a mut RawServoStyleSet;
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
Expand All @@ -50,7 +54,11 @@ use gecko_bindings::structs::SheetParsingMode;
use gecko_bindings::structs::StyleBasicShape;
use gecko_bindings::structs::StyleBasicShapeType;
use gecko_bindings::structs::StyleClipPath;
use gecko_bindings::structs::nscoord;
use gecko_bindings::structs::nsCSSKeyword;
use gecko_bindings::structs::nsCSSShadowArray;
use gecko_bindings::structs::nsCSSValue;
use gecko_bindings::structs::nsCSSValueSharedList;
use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::nsFont;
use gecko_bindings::structs::nsIAtom;
Expand Down Expand Up @@ -612,6 +620,49 @@ extern "C" {
pub fn Gecko_ReleaseQuoteValuesArbitraryThread(aPtr:
*mut nsStyleQuoteValues);
}
extern "C" {
pub fn Gecko_NewCSSValueSharedList(len: u32) -> *mut nsCSSValueSharedList;
}
extern "C" {
pub fn Gecko_CSSValue_SetAbsoluteLength(css_value: nsCSSValueBorrowedMut,
len: nscoord);
}
extern "C" {
pub fn Gecko_CSSValue_SetNumber(css_value: nsCSSValueBorrowedMut,
number: f32);
}
extern "C" {
pub fn Gecko_CSSValue_SetKeyword(css_value: nsCSSValueBorrowedMut,
keyword: nsCSSKeyword);
}
extern "C" {
pub fn Gecko_CSSValue_SetPercentage(css_value: nsCSSValueBorrowedMut,
percent: f32);
}
extern "C" {
pub fn Gecko_CSSValue_SetAngle(css_value: nsCSSValueBorrowedMut,
radians: f32);
}
extern "C" {
pub fn Gecko_CSSValue_SetCalc(css_value: nsCSSValueBorrowedMut,
calc: nsStyleCoord_CalcValue);
}
extern "C" {
pub fn Gecko_CSSValue_SetFunction(css_value: nsCSSValueBorrowedMut,
len: i32);
}
extern "C" {
pub fn Gecko_CSSValue_GetArrayItem(css_value: nsCSSValueBorrowedMut,
index: i32) -> nsCSSValueBorrowedMut;
}
extern "C" {
pub fn Gecko_AddRefCSSValueSharedListArbitraryThread(aPtr:
*mut nsCSSValueSharedList);
}
extern "C" {
pub fn Gecko_ReleaseCSSValueSharedListArbitraryThread(aPtr:
*mut nsCSSValueSharedList);
}
extern "C" {
pub fn Gecko_Construct_nsStyleFont(ptr: *mut nsStyleFont);
}
Expand Down
Loading

0 comments on commit 75d3524

Please sign in to comment.