Bug 1268290: stylo: Pass SheetParsingMode to Servo, r=bholley
authorEmilio Cobos Álvarez <me@emiliocobos.me>
Thu, 28 Apr 2016 01:15:56 +0200
changeset 357349 dc4b21ccd9c09735c23abe26850315ef3829eb26
parent 357348 763dfabc9784c0dd7414bffa99c60e384c4380da
child 357350 030b17d4947a2dd3d01e6f74710e92a372d290bd
push id16755
push useryura.zenevich@gmail.com
push dateThu, 28 Apr 2016 15:12:20 +0000
reviewersbholley
bugs1268290
milestone49.0a1
Bug 1268290: stylo: Pass SheetParsingMode to Servo, r=bholley
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/ServoStyleSheet.cpp
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -180,17 +180,18 @@ Gecko_Destroy_nsStyle##name(nsStyle##nam
 void
 Servo_DropNodeData(ServoNodeData* data)
 {
   MOZ_CRASH("stylo: shouldn't be calling Servo_DropNodeData in a "
             "non-MOZ_STYLO build");
 }
 
 RawServoStyleSheet*
-Servo_StylesheetFromUTF8Bytes(const uint8_t* bytes, uint32_t length)
+Servo_StylesheetFromUTF8Bytes(const uint8_t* bytes, uint32_t length,
+                              mozilla::css::SheetParsingMode mode);
 {
   MOZ_CRASH("stylo: shouldn't be calling Servo_StylesheetFromUTF8Bytes in a "
             "non-MOZ_STYLO build");
 }
 
 void
 Servo_AddRefStyleSheet(RawServoStyleSheet* sheet)
 {
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 #ifndef mozilla_ServoBindings_h
 #define mozilla_ServoBindings_h
 
 #include "stdint.h"
+#include "mozilla/css/SheetParsingMode.h"
 
 /*
  * API for Servo to access Gecko data structures. This file must compile as valid
  * C code in order for the binding generator to parse it.
  *
  * Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
  * Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
  */
@@ -60,17 +61,18 @@ bool Gecko_IsRootElement(RawGeckoElement
 ServoNodeData* Gecko_GetNodeData(RawGeckoNode* node);
 void Gecko_SetNodeData(RawGeckoNode* node, ServoNodeData* data);
 void Servo_DropNodeData(ServoNodeData* data);
 
 // Styleset and Stylesheet management.
 //
 // TODO: Make these return already_AddRefed and UniquePtr when the binding
 // generator is smart enough to handle them.
-RawServoStyleSheet* Servo_StylesheetFromUTF8Bytes(const uint8_t* bytes, uint32_t length);
+RawServoStyleSheet* Servo_StylesheetFromUTF8Bytes(const uint8_t* bytes, uint32_t length,
+                                                  mozilla::css::SheetParsingMode parsing_mode);
 void Servo_AddRefStyleSheet(RawServoStyleSheet* sheet);
 void Servo_ReleaseStyleSheet(RawServoStyleSheet* sheet);
 void Servo_AppendStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set);
 void Servo_PrependStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set);
 void Servo_RemoveStyleSheet(RawServoStyleSheet* sheet, RawServoStyleSet* set);
 bool Servo_StyleSheetHasRules(RawServoStyleSheet* sheet);
 RawServoStyleSet* Servo_InitStyleSet();
 void Servo_DropStyleSet(RawServoStyleSet* set);
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -74,17 +74,17 @@ ServoStyleSheet::ParseSheet(const nsAStr
                             nsIPrincipal* aSheetPrincipal,
                             uint32_t aLineNumber,
                             css::SheetParsingMode aParsingMode)
 {
   DropSheet();
 
   NS_ConvertUTF16toUTF8 input(aInput);
   mSheet = already_AddRefed<RawServoStyleSheet>(Servo_StylesheetFromUTF8Bytes(
-      reinterpret_cast<const uint8_t*>(input.get()), input.Length()));
+      reinterpret_cast<const uint8_t*>(input.get()), input.Length(), aParsingMode));
 }
 
 void
 ServoStyleSheet::DropSheet()
 {
   mSheet = nullptr;
 }