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

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

Issue 2624953002: Set width and height attributes for <img> if image is loaded from srcset (Closed)
Patch Set: Fix another typo Created 3 years, 11 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
Index: third_party/WebKit/Source/core/html/HTMLImageElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
index f08e63e1b00be59083f3051fba30d7db24fdc307..3ad649bfd29fec336a2761c99d88a11539c64eb8 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.cpp
@@ -451,10 +451,7 @@ unsigned HTMLImageElement::width() {
}
}
- LayoutBox* box = layoutBox();
- return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedWidth(),
- box)
- : 0;
+ return layoutBoxWidth();
}
unsigned HTMLImageElement::height() {
@@ -478,10 +475,7 @@ unsigned HTMLImageElement::height() {
}
}
- LayoutBox* box = layoutBox();
- return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedHeight(),
- box)
- : 0;
+ return layoutBoxHeight();
}
unsigned HTMLImageElement::naturalWidth() const {
@@ -510,6 +504,20 @@ unsigned HTMLImageElement::naturalHeight() const {
.toUnsigned();
}
+unsigned HTMLImageElement::layoutBoxWidth() const {
+ LayoutBox* box = layoutBox();
+ return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedWidth(),
+ box)
+ : 0;
+}
+
+unsigned HTMLImageElement::layoutBoxHeight() const {
+ LayoutBox* box = layoutBox();
+ return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedHeight(),
+ box)
+ : 0;
+}
+
const String& HTMLImageElement::currentSrc() const {
// http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#dom-img-currentsrc
// The currentSrc IDL attribute must return the img element's current
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLImageElement.h ('k') | third_party/WebKit/Source/web/WebFrameSerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698