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

Side by Side Diff: Source/core/html/HTMLImageElement.cpp

Issue 422503002: HTMLImageElement.natural{Width,Height} should return intrinsic dimensions (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Two more spots... Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/HTMLImageElement/image-natural-width-height-svg-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 367
368 RenderBox* box = renderBox(); 368 RenderBox* box = renderBox();
369 return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedHeight( ), box) : 0; 369 return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedHeight( ), box) : 0;
370 } 370 }
371 371
372 int HTMLImageElement::naturalWidth() const 372 int HTMLImageElement::naturalWidth() const
373 { 373 {
374 if (!imageLoader().image()) 374 if (!imageLoader().image())
375 return 0; 375 return 0;
376 376
377 return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f).width() ; 377 return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f, ImageRe source::IntrinsicSize).width();
378 } 378 }
379 379
380 int HTMLImageElement::naturalHeight() const 380 int HTMLImageElement::naturalHeight() const
381 { 381 {
382 if (!imageLoader().image()) 382 if (!imageLoader().image())
383 return 0; 383 return 0;
384 384
385 return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f).height( ); 385 return imageLoader().image()->imageSizeForRenderer(renderer(), 1.0f, ImageRe source::IntrinsicSize).height();
386 } 386 }
387 387
388 const String& HTMLImageElement::currentSrc() const 388 const String& HTMLImageElement::currentSrc() const
389 { 389 {
390 // http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#do m-img-currentsrc 390 // http://www.whatwg.org/specs/web-apps/current-work/multipage/edits.html#do m-img-currentsrc
391 // The currentSrc IDL attribute must return the img element's current reques t's current URL. 391 // The currentSrc IDL attribute must return the img element's current reques t's current URL.
392 // Initially, the pending request turns into current request when it is eith er available or broken. 392 // Initially, the pending request turns into current request when it is eith er available or broken.
393 // We use the image's dimensions as a proxy to it being in any of these stat es. 393 // We use the image's dimensions as a proxy to it being in any of these stat es.
394 if (!imageLoader().image() || !imageLoader().image()->image() || !imageLoade r().image()->image()->width()) 394 if (!imageLoader().image() || !imageLoader().image()->image() || !imageLoade r().image()->image()->width())
395 return emptyAtom; 395 return emptyAtom;
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 } 577 }
578 imageLoader().updateFromElement(behavior); 578 imageLoader().updateFromElement(behavior);
579 } 579 }
580 580
581 const KURL& HTMLImageElement::sourceURL() const 581 const KURL& HTMLImageElement::sourceURL() const
582 { 582 {
583 return cachedImage()->response().url(); 583 return cachedImage()->response().url();
584 } 584 }
585 585
586 } 586 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/HTMLImageElement/image-natural-width-height-svg-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698