Bug 1349059 - Replace XMLBaseAttributeWithStyledElement with XMLBaseAttributeForStyleAttr for a more accurate measurement. r=bz

MozReview-Commit-ID: DXILBM79r2Q

--HG--
extra : rebase_source : 526885b04879da7b244f76ff4ef9aa40305d1c81
This commit is contained in:
Xidorn Quan 2017-03-21 11:32:19 +11:00
Родитель 88b43cc612
Коммит 8b3894a4e8
3 изменённых файлов: 28 добавлений и 11 удалений

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

@ -390,9 +390,6 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
if (!baseAttrs.IsEmpty()) {
doc->WarnOnceAbout(nsIDocument::eXMLBaseAttribute);
if (IsHTMLElement() || IsSVGElement() || IsXULElement()) {
doc->WarnOnceAbout(nsIDocument::eXMLBaseAttributeWithStyledElement);
}
// Now resolve against all xml:base attrs
for (uint32_t i = baseAttrs.Length() - 1; i != uint32_t(-1); --i) {
nsCOMPtr<nsIURI> newBase;
@ -414,21 +411,38 @@ nsIContent::GetBaseURI(bool aTryUseXHRDocBaseURI) const
return base.forget();
}
already_AddRefed<nsIURI>
nsIContent::GetBaseURIForStyleAttr() const
nsIURI*
nsIContent::GetBaseURIWithoutXMLBase() const
{
if (!nsLayoutUtils::StyleAttrWithXMLBaseDisabled()) {
return GetBaseURI();
}
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
MOZ_ASSERT(bindingParent);
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
return do_AddRef(useElement->GetContentBaseURI());
return useElement->GetContentBaseURI();
}
// This also ignores the case that SVG inside XBL binding.
// But it is probably fine.
return do_AddRef(OwnerDoc()->GetDocBaseURI());
return OwnerDoc()->GetDocBaseURI();
}
already_AddRefed<nsIURI>
nsIContent::GetBaseURIForStyleAttr() const
{
nsIDocument* doc = OwnerDoc();
nsIURI* baseWithoutXMLBase = GetBaseURIWithoutXMLBase();
nsCOMPtr<nsIURI> base = GetBaseURI();
// If eXMLBaseAttribute is not triggered in GetBaseURI() call above,
// we don't need to count eXMLBaseAttributeForStyleAttr either.
if (doc->HasWarnedAbout(nsIDocument::eXMLBaseAttribute) &&
!doc->HasWarnedAbout(nsIDocument::eXMLBaseAttributeForStyleAttr)) {
bool isEqual = false;
base->Equals(baseWithoutXMLBase, &isEqual);
if (!isEqual) {
doc->WarnOnceAbout(nsIDocument::eXMLBaseAttributeForStyleAttr);
}
}
return nsLayoutUtils::StyleAttrWithXMLBaseDisabled()
? do_AddRef(baseWithoutXMLBase) : base.forget();
}
//----------------------------------------------------------------------

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

@ -52,4 +52,4 @@ DEPRECATED_OPERATION(FileLastModifiedDate)
DEPRECATED_OPERATION(ImageBitmapRenderingContext_TransferImageBitmap)
DEPRECATED_OPERATION(URLCreateObjectURL_MediaStream)
DEPRECATED_OPERATION(XMLBaseAttribute)
DEPRECATED_OPERATION(XMLBaseAttributeWithStyledElement)
DEPRECATED_OPERATION(XMLBaseAttributeForStyleAttr)

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

@ -975,6 +975,9 @@ protected:
*/
nsIAtom* DoGetID() const;
// Returns base URI without considering xml:base.
inline nsIURI* GetBaseURIWithoutXMLBase() const;
public:
#ifdef DEBUG
/**