From 802cd7c207ee6d3a9eb7ddf5bad97e9e532f01ac Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Fri, 10 Mar 2017 18:28:02 -0800 Subject: [PATCH] Bug 1341690 - stylo: Make URLs work in inline style; r=emilio MozReview-Commit-ID: 6Tc0kBw4V8c --- dom/base/nsAttrValue.cpp | 3 ++- layout/reftests/backgrounds/reftest-stylo.list | 2 +- layout/reftests/ogg-video/reftest-stylo.list | 4 ++-- layout/reftests/svg/svg-integration/reftest-stylo.list | 4 ++-- layout/reftests/webm-video/reftest-stylo.list | 4 ++-- layout/style/ServoBindingList.h | 4 +++- layout/style/ServoDeclarationBlock.cpp | 8 ++++++-- layout/style/ServoDeclarationBlock.h | 3 ++- layout/style/nsDOMCSSDeclaration.cpp | 3 ++- layout/style/test/stylo-failures.md | 3 +-- 10 files changed, 23 insertions(+), 15 deletions(-) diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index 71296f6850f2..826c3e31e8bc 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1725,7 +1725,8 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString, RefPtr decl; if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) { - decl = ServoDeclarationBlock::FromCssText(aString); + GeckoParserExtraData data(baseURI, docURI, aElement->NodePrincipal()); + decl = ServoDeclarationBlock::FromCssText(aString, data); } else { css::Loader* cssLoader = ownerDoc->CSSLoader(); nsCSSParser cssParser(cssLoader); diff --git a/layout/reftests/backgrounds/reftest-stylo.list b/layout/reftests/backgrounds/reftest-stylo.list index 881cb3ac2e28..61e47d4120c8 100644 --- a/layout/reftests/backgrounds/reftest-stylo.list +++ b/layout/reftests/backgrounds/reftest-stylo.list @@ -138,7 +138,7 @@ fuzzy(2,83) == fixed-bg-border-radius.html fixed-bg-border-radius.html fails HTTP == root-background-1.html root-background-1.html fails HTTP == root-background-1.html root-background-1.html -fails == really-big-background.html really-big-background.html # Bug 1341690 +== really-big-background.html really-big-background.html # Bug 1341690 fails == body-background.html body-background.html # Bug 1339711 fails == table-background.html table-background.html # Bug 1339711 fails == table-background-print.html table-background-print.html diff --git a/layout/reftests/ogg-video/reftest-stylo.list b/layout/reftests/ogg-video/reftest-stylo.list index d70d86b4b139..62863e793d3b 100644 --- a/layout/reftests/ogg-video/reftest-stylo.list +++ b/layout/reftests/ogg-video/reftest-stylo.list @@ -15,8 +15,8 @@ HTTP(..) == aspect-ratio-3b.xhtml aspect-ratio-3b.xhtml == empty-1a.html empty-1a.html == empty-1b.html empty-1b.html #these is skipped because we hang on the htmlparser tests when this is ran -fails == object-aspect-ratio-1a.xhtml object-aspect-ratio-1a.xhtml -fails == object-aspect-ratio-1b.xhtml object-aspect-ratio-1b.xhtml +== object-aspect-ratio-1a.xhtml object-aspect-ratio-1a.xhtml +== object-aspect-ratio-1b.xhtml object-aspect-ratio-1b.xhtml == offset-1.xhtml offset-1.xhtml random == object-aspect-ratio-2a.xhtml object-aspect-ratio-2a.xhtml random == object-aspect-ratio-2b.xhtml object-aspect-ratio-2b.xhtml diff --git a/layout/reftests/svg/svg-integration/reftest-stylo.list b/layout/reftests/svg/svg-integration/reftest-stylo.list index 1e0c5a01b680..ea97bb1df7b2 100644 --- a/layout/reftests/svg/svg-integration/reftest-stylo.list +++ b/layout/reftests/svg/svg-integration/reftest-stylo.list @@ -21,8 +21,8 @@ fails == clipPath-html-zoomed-01.xhtml clipPath-html-zoomed-01.xhtml == clipPath-transformed-html-02.xhtml clipPath-transformed-html-02.xhtml == conditions-outer-svg-01.xhtml conditions-outer-svg-01.xhtml == conditions-outer-svg-02.xhtml conditions-outer-svg-02.xhtml -fails == dynamic-conditions-outer-svg-01.xhtml dynamic-conditions-outer-svg-01.xhtml -fails == dynamic-conditions-outer-svg-02.xhtml dynamic-conditions-outer-svg-02.xhtml +== dynamic-conditions-outer-svg-01.xhtml dynamic-conditions-outer-svg-01.xhtml +== dynamic-conditions-outer-svg-02.xhtml dynamic-conditions-outer-svg-02.xhtml fails == dynamic-conditions-outer-svg-03.xhtml dynamic-conditions-outer-svg-03.xhtml == dynamic-conditions-outer-svg-04.xhtml dynamic-conditions-outer-svg-04.xhtml fails == filter-html-01.xhtml filter-html-01.xhtml diff --git a/layout/reftests/webm-video/reftest-stylo.list b/layout/reftests/webm-video/reftest-stylo.list index dfcd95c75949..24a7a98bc9fa 100644 --- a/layout/reftests/webm-video/reftest-stylo.list +++ b/layout/reftests/webm-video/reftest-stylo.list @@ -14,8 +14,8 @@ HTTP(..) == aspect-ratio-3b.xhtml aspect-ratio-3b.xhtml == empty-1a.html empty-1a.html == empty-1b.html empty-1b.html #these is skipped because we hang on the htmlparser tests when this is ran -fails == object-aspect-ratio-1a.xhtml object-aspect-ratio-1a.xhtml -fails == object-aspect-ratio-1b.xhtml object-aspect-ratio-1b.xhtml +== object-aspect-ratio-1a.xhtml object-aspect-ratio-1a.xhtml +== object-aspect-ratio-1b.xhtml object-aspect-ratio-1b.xhtml == offset-1.xhtml offset-1.xhtml random == object-aspect-ratio-2a.xhtml object-aspect-ratio-2a.xhtml random == object-aspect-ratio-2b.xhtml object-aspect-ratio-2b.xhtml diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index 98eeae2ff4f5..40d19f383720 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -135,7 +135,9 @@ SERVO_BINDING_FUNC(Servo_AnimationValue_DeepEqual, bool, // Style attribute SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong, - const nsACString* data) + const nsACString* data, + const nsACString* base, + const GeckoParserExtraData* extraData) SERVO_BINDING_FUNC(Servo_DeclarationBlock_CreateEmpty, RawServoDeclarationBlockStrong) SERVO_BINDING_FUNC(Servo_DeclarationBlock_Clone, RawServoDeclarationBlockStrong, diff --git a/layout/style/ServoDeclarationBlock.cpp b/layout/style/ServoDeclarationBlock.cpp index 7bba5b741fd1..3d0220329a72 100644 --- a/layout/style/ServoDeclarationBlock.cpp +++ b/layout/style/ServoDeclarationBlock.cpp @@ -12,11 +12,15 @@ namespace mozilla { /* static */ already_AddRefed -ServoDeclarationBlock::FromCssText(const nsAString& aCssText) +ServoDeclarationBlock::FromCssText(const nsAString& aCssText, + const GeckoParserExtraData& aExtraData) { NS_ConvertUTF16toUTF8 value(aCssText); + nsCString baseString; + // FIXME (bug 1343964): Figure out a better solution for sending the base uri to servo + aExtraData.mBaseURI->get()->GetSpec(baseString); RefPtr - raw = Servo_ParseStyleAttribute(&value).Consume(); + raw = Servo_ParseStyleAttribute(&value, &baseString, &aExtraData).Consume(); RefPtr decl = new ServoDeclarationBlock(raw.forget()); return decl.forget(); } diff --git a/layout/style/ServoDeclarationBlock.h b/layout/style/ServoDeclarationBlock.h index b51b9719fe84..b68170a4a5ec 100644 --- a/layout/style/ServoDeclarationBlock.h +++ b/layout/style/ServoDeclarationBlock.h @@ -28,7 +28,8 @@ public: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServoDeclarationBlock) static already_AddRefed - FromCssText(const nsAString& aCssText); + FromCssText(const nsAString& aCssText, + const GeckoParserExtraData& aExtraData); RawServoDeclarationBlock* Raw() const { return mRaw; } RawServoDeclarationBlock* const* RefRaw() const { diff --git a/layout/style/nsDOMCSSDeclaration.cpp b/layout/style/nsDOMCSSDeclaration.cpp index 7254b6932b50..9586215810b5 100644 --- a/layout/style/nsDOMCSSDeclaration.cpp +++ b/layout/style/nsDOMCSSDeclaration.cpp @@ -131,7 +131,8 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText) RefPtr newdecl; if (olddecl->IsServo()) { - newdecl = ServoDeclarationBlock::FromCssText(aCssText); + GeckoParserExtraData data(env.mBaseURI, env.mSheetURI, env.mPrincipal); + newdecl = ServoDeclarationBlock::FromCssText(aCssText, data); } else { RefPtr decl(new css::Declaration()); decl->InitializeEmpty(); diff --git a/layout/style/test/stylo-failures.md b/layout/style/test/stylo-failures.md index 28a6967b53f2..18c546651a0a 100644 --- a/layout/style/test/stylo-failures.md +++ b/layout/style/test/stylo-failures.md @@ -111,8 +111,7 @@ Any line which doesn't follow the format above would be ignored like comment. * test_computed_style.html `url` [11] * test_parse_url.html [4] * test_value_storage.html `url` [92] - * test_shorthand_property_getters.html `background shorthand` [1] - * ... `url` [3] + * test_shorthand_property_getters.html `url` [3] * test_computed_style.html `mask`: setting mask shorthand resets subproperties to non-initial value bug 1331516 [0] * auto value for min-{width,height} servo/servo#15045 * test_compute_data_with_start_struct.html `timing-function`: incorrectly computing keywords to bezier function servo/servo#15086 [2]