Bug 1380413 part 2. Remove nsIDOMHTMLImageElement.width/height. r=mccr8

This commit is contained in:
Boris Zbarsky 2017-07-13 23:46:12 -04:00
Родитель 4da062bf6f
Коммит 38dc3c65cd
3 изменённых файлов: 11 добавлений и 38 удалений

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

@ -230,38 +230,6 @@ HTMLImageElement::Y()
return GetXY().y;
}
NS_IMETHODIMP
HTMLImageElement::GetHeight(uint32_t* aHeight)
{
*aHeight = Height();
return NS_OK;
}
NS_IMETHODIMP
HTMLImageElement::SetHeight(uint32_t aHeight)
{
ErrorResult rv;
SetHeight(aHeight, rv);
return rv.StealNSResult();
}
NS_IMETHODIMP
HTMLImageElement::GetWidth(uint32_t* aWidth)
{
*aWidth = Width();
return NS_OK;
}
NS_IMETHODIMP
HTMLImageElement::SetWidth(uint32_t aWidth)
{
ErrorResult rv;
SetWidth(aWidth, rv);
return rv.StealNSResult();
}
bool
HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,

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

@ -366,10 +366,17 @@ ImageDocument::ShrinkToFit()
}
// Keep image content alive while changing the attributes.
nsCOMPtr<Element> imageContent = mImageContent;
nsCOMPtr<nsIDOMHTMLImageElement> image = do_QueryInterface(imageContent);
image->SetWidth(std::max(1, NSToCoordFloor(GetRatio() * mImageWidth)));
image->SetHeight(std::max(1, NSToCoordFloor(GetRatio() * mImageHeight)));
RefPtr<HTMLImageElement> image = HTMLImageElement::FromContent(mImageContent);
{
IgnoredErrorResult ignored;
image->SetWidth(std::max(1, NSToCoordFloor(GetRatio() * mImageWidth)),
ignored);
}
{
IgnoredErrorResult ignored;
image->SetHeight(std::max(1, NSToCoordFloor(GetRatio() * mImageHeight)),
ignored);
}
// The view might have been scrolled when zooming in, scroll back to the
// origin now that we're showing a shrunk-to-window version.

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

@ -19,6 +19,4 @@
[uuid(ec18e71c-4f5c-4cc3-aa36-5273168644dc)]
interface nsIDOMHTMLImageElement : nsISupports
{
attribute unsigned long width;
attribute unsigned long height;
};