From ac4f44ca96a64758518357329f4dfdd1a81c610b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 10 Apr 2017 11:17:51 +0800 Subject: [PATCH] Bug 1325878: Don't use nsMediaList for loading imports. r=xidorn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MozReview-Commit-ID: HR23bqZcmcA Signed-off-by: Emilio Cobos Álvarez --- layout/style/ServoBindings.cpp | 18 ++++-------------- layout/style/ServoBindings.h | 3 +-- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index 12819fff8f14..d235784f75d7 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -39,6 +39,7 @@ #include "nsTArray.h" #include "nsTransitionManager.h" +#include "mozilla/DeclarationBlockInlines.h" #include "mozilla/EffectCompositor.h" #include "mozilla/EffectSet.h" #include "mozilla/EventStates.h" @@ -48,7 +49,7 @@ #include "mozilla/ServoRestyleManager.h" #include "mozilla/StyleAnimationValue.h" #include "mozilla/SystemGroup.h" -#include "mozilla/DeclarationBlockInlines.h" +#include "mozilla/ServoMediaList.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/ElementInlines.h" #include "mozilla/dom/HTMLTableCellElement.h" @@ -1697,25 +1698,14 @@ Gecko_LoadStyleSheet(css::Loader* aLoader, RawGeckoURLExtraData* aBaseURLData, const uint8_t* aURLString, uint32_t aURLStringLength, - const uint8_t* aMediaString, - uint32_t aMediaStringLength) + RawServoMediaListStrong aMediaList) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aLoader, "Should've catched this before"); MOZ_ASSERT(aParent, "Only used for @import, so parent should exist!"); MOZ_ASSERT(aURLString, "Invalid URLs shouldn't be loaded!"); MOZ_ASSERT(aBaseURLData, "Need base URL data"); - RefPtr media = new nsMediaList(); - if (aMediaStringLength) { - MOZ_ASSERT(aMediaString); - // TODO(emilio, bug 1325878): This is not great, though this is going away - // soon anyway, when we can have a Servo-backed nsMediaList. - nsDependentCSubstring medium(reinterpret_cast(aMediaString), - aMediaStringLength); - nsCSSParser mediumParser(aLoader); - mediumParser.ParseMediaList( - NS_ConvertUTF8toUTF16(medium), nullptr, 0, media); - } + RefPtr media = new ServoMediaList(aMediaList.Consume()); nsDependentCSubstring urlSpec(reinterpret_cast(aURLString), aURLStringLength); diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 0dab2ddc74ce..df195f59fcdf 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -131,8 +131,7 @@ void Gecko_LoadStyleSheet(mozilla::css::Loader* loader, RawGeckoURLExtraData* base_url_data, const uint8_t* url_bytes, uint32_t url_length, - const uint8_t* media_bytes, - uint32_t media_length); + RawServoMediaListStrong media_list); // By default, Servo walks the DOM by traversing the siblings of the DOM-view // first child. This generally works, but misses anonymous children, which we