Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(985)

Unified Diff: Source/core/html/HTMLImageElement.cpp

Issue 1299563002: HTMLImageElement width/height should updateLayout first. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Check if we're in the document. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « Source/core/html/HTMLImageElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698