Chromium Code Reviews| Index: Source/core/html/HTMLImageElement.cpp |
| diff --git a/Source/core/html/HTMLImageElement.cpp b/Source/core/html/HTMLImageElement.cpp |
| index f6d39f0c885c1a734ffba8092e779063de159c56..a48db810238b28132773c30bdbff18c86a9e08dc 100644 |
| --- a/Source/core/html/HTMLImageElement.cpp |
| +++ b/Source/core/html/HTMLImageElement.cpp |
| @@ -399,8 +399,11 @@ void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) |
| HTMLElement::removedFrom(insertionPoint); |
| } |
| -int HTMLImageElement::width(bool ignorePendingStylesheets) |
| +int HTMLImageElement::width() |
| { |
| + if (inActiveDocument()) |
| + document().updateLayoutIgnorePendingStylesheets(); |
| + |
| if (!layoutObject()) { |
| // check the attribute first for an explicit pixel value |
| bool ok; |
| @@ -413,17 +416,15 @@ int HTMLImageElement::width(bool ignorePendingStylesheets) |
| return imageLoader().image()->imageSizeForLayoutObject(layoutObject(), 1.0f).width(); |
| } |
| - if (ignorePendingStylesheets) |
| - document().updateLayoutIgnorePendingStylesheets(); |
| - else |
| - document().updateLayout(); |
| - |
| LayoutBox* box = layoutBox(); |
| return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedWidth(), box) : 0; |
| } |
| -int HTMLImageElement::height(bool ignorePendingStylesheets) |
| +int HTMLImageElement::height() |
| { |
| + if (inActiveDocument()) |
|
pdr.
2015/08/15 02:09:26
The inActiveDocument check seems like a good idea.
|
| + document().updateLayoutIgnorePendingStylesheets(); |
| + |
| if (!layoutObject()) { |
| // check the attribute first for an explicit pixel value |
| bool ok; |
| @@ -436,11 +437,6 @@ int HTMLImageElement::height(bool ignorePendingStylesheets) |
| return imageLoader().image()->imageSizeForLayoutObject(layoutObject(), 1.0f).height(); |
| } |
| - if (ignorePendingStylesheets) |
| - document().updateLayoutIgnorePendingStylesheets(); |
| - else |
| - document().updateLayout(); |
| - |
| LayoutBox* box = layoutBox(); |
| return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedHeight(), box) : 0; |
| } |