Bug 1341690 - stylo: Make URLs work in inline style; r=emilio

MozReview-Commit-ID: 6Tc0kBw4V8c
This commit is contained in:
Manish Goregaokar 2017-03-10 18:28:02 -08:00
Родитель 26912d5fca
Коммит 802cd7c207
10 изменённых файлов: 23 добавлений и 15 удалений

Просмотреть файл

@ -1725,7 +1725,8 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
RefPtr<DeclarationBlock> 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);

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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,

Просмотреть файл

@ -12,11 +12,15 @@
namespace mozilla {
/* static */ already_AddRefed<ServoDeclarationBlock>
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<RawServoDeclarationBlock>
raw = Servo_ParseStyleAttribute(&value).Consume();
raw = Servo_ParseStyleAttribute(&value, &baseString, &aExtraData).Consume();
RefPtr<ServoDeclarationBlock> decl = new ServoDeclarationBlock(raw.forget());
return decl.forget();
}

Просмотреть файл

@ -28,7 +28,8 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServoDeclarationBlock)
static already_AddRefed<ServoDeclarationBlock>
FromCssText(const nsAString& aCssText);
FromCssText(const nsAString& aCssText,
const GeckoParserExtraData& aExtraData);
RawServoDeclarationBlock* Raw() const { return mRaw; }
RawServoDeclarationBlock* const* RefRaw() const {

Просмотреть файл

@ -131,7 +131,8 @@ nsDOMCSSDeclaration::SetCssText(const nsAString& aCssText)
RefPtr<DeclarationBlock> newdecl;
if (olddecl->IsServo()) {
newdecl = ServoDeclarationBlock::FromCssText(aCssText);
GeckoParserExtraData data(env.mBaseURI, env.mSheetURI, env.mPrincipal);
newdecl = ServoDeclarationBlock::FromCssText(aCssText, data);
} else {
RefPtr<css::Declaration> decl(new css::Declaration());
decl->InitializeEmpty();

Просмотреть файл

@ -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]