Auto merge of #16819 - canaltinova:quirk-mode, r=bholley,emilio

stylo: Propagate quirks mode information from Gecko to Servo

r=bholley in bugzilla

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1360488](https://bugzilla.mozilla.org/show_bug.cgi?id=1360488)

<!-- 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/16819)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-13 20:50:10 -05:00 committed by GitHub
commit 94ac822132
9 changed files with 48 additions and 14 deletions

View file

@ -9,6 +9,7 @@ use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use dom::OpaqueNode;
use gecko_bindings::bindings::RawServoStyleSet;
use gecko_bindings::structs::RawGeckoPresContextOwned;
use gecko_bindings::structs::nsIDocument;
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
use media_queries::Device;
use parking_lot::RwLock;
@ -56,11 +57,14 @@ impl PerDocumentStyleData {
/// Create a dummy `PerDocumentStyleData`.
pub fn new(pres_context: RawGeckoPresContextOwned) -> Self {
let device = Device::new(pres_context);
let quirks_mode = unsafe {
(*(*device.pres_context).mDocument.raw::<nsIDocument>()).mCompatMode
};
let (new_anims_sender, new_anims_receiver) = channel();
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
stylist: Stylist::new(device),
stylist: Stylist::new(device, quirks_mode.into()),
stylesheets: StylesheetSet::new(),
new_animations_sender: new_anims_sender,
new_animations_receiver: new_anims_receiver,

View file

@ -53,6 +53,7 @@ use gecko_bindings::structs::nsChangeHint;
use gecko_bindings::structs::nsCursorImage;
use gecko_bindings::structs::nsFont;
use gecko_bindings::structs::nsIAtom;
use gecko_bindings::structs::nsCompatibility;
use gecko_bindings::structs::nsMediaFeature;
use gecko_bindings::structs::nsRestyleHint;
use gecko_bindings::structs::nsStyleBackground;
@ -1966,7 +1967,8 @@ extern "C" {
}
extern "C" {
pub fn Servo_ParseStyleAttribute(data: *const nsACString,
extra_data: *mut RawGeckoURLExtraData)
extra_data: *mut RawGeckoURLExtraData,
quirks_mode: nsCompatibility)
-> RawServoDeclarationBlockStrong;
}
extern "C" {

View file

@ -336,8 +336,9 @@ impl<'le> fmt::Debug for GeckoElement<'le> {
impl<'le> GeckoElement<'le> {
/// Parse the style attribute of an element.
pub fn parse_style_attribute(value: &str,
url_data: &UrlExtraData) -> PropertyDeclarationBlock {
parse_style_attribute(value, url_data, &RustLogReporter, QuirksMode::NoQuirks)
url_data: &UrlExtraData,
quirks_mode: QuirksMode) -> PropertyDeclarationBlock {
parse_style_attribute(value, url_data, &RustLogReporter, quirks_mode)
}
fn flags(&self) -> u32 {