diff options
author | xidachen <xidachen@chromium.org> | 2015-11-16 13:52:15 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-16 21:53:07 +0000 |
commit | 22cab0b9cd354d97172bf604496b7faaf68d9a4c (patch) | |
tree | 17587ae201a12153cb64b7075faa2a32a167d636 | |
parent | 59db8b4f75526fcf7e9dc819aa375820bfd511bc (diff) | |
download | chromium_src-22cab0b9cd354d97172bf604496b7faaf68d9a4c.zip chromium_src-22cab0b9cd354d97172bf604496b7faaf68d9a4c.tar.gz chromium_src-22cab0b9cd354d97172bf604496b7faaf68d9a4c.tar.bz2 |
Change width&height of ImageBitmap to unsigned long
The current type of these two attributes are long, it should
be unsigned long instead, as specified in
https://html.spec.whatwg.org/#images.
BUG=555956
Review URL: https://codereview.chromium.org/1451703004
Cr-Commit-Position: refs/heads/master@{#359932}
-rw-r--r-- | third_party/WebKit/Source/core/frame/ImageBitmap.cpp | 24 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/frame/ImageBitmap.h | 6 | ||||
-rw-r--r-- | third_party/WebKit/Source/core/frame/ImageBitmap.idl | 5 |
3 files changed, 29 insertions, 6 deletions
diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp index 7e5b822..60f71c7 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.cpp +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.cpp @@ -152,6 +152,30 @@ PassRefPtr<SkImage> ImageBitmap::cropImage(PassRefPtr<SkImage> image, const IntR return adoptRef(surface->newImageSnapshot()); } +unsigned long ImageBitmap::width() const +{ + if (!m_image) + return 0; + ASSERT(m_image->width() > 0); + return m_image->width(); +} + +unsigned long ImageBitmap::height() const +{ + if (!m_image) + return 0; + ASSERT(m_image->height() > 0); + return m_image->height(); +} + +IntSize ImageBitmap::size() const +{ + if (!m_image) + return IntSize(); + ASSERT(m_image->width() > 0 && m_image->height() > 0); + return IntSize(m_image->width(), m_image->height()); +} + void ImageBitmap::notifyImageSourceChanged() { } diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.h b/third_party/WebKit/Source/core/frame/ImageBitmap.h index 71fd4a5..41f6ec4 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.h +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.h @@ -35,9 +35,9 @@ public: static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&); SkImage* skImage() const { return (m_image) ? m_image.get() : nullptr; } - int width() const { return (m_image) ? m_image->width(): 0; } - int height() const { return (m_image) ? m_image->height(): 0; } - IntSize size() const { return (m_image) ? IntSize(m_image->width(), m_image->height()) : IntSize(); } + unsigned long width() const; + unsigned long height() const; + IntSize size() const; ~ImageBitmap() override; diff --git a/third_party/WebKit/Source/core/frame/ImageBitmap.idl b/third_party/WebKit/Source/core/frame/ImageBitmap.idl index 5cb21c8..b066dd3 100644 --- a/third_party/WebKit/Source/core/frame/ImageBitmap.idl +++ b/third_party/WebKit/Source/core/frame/ImageBitmap.idl @@ -8,7 +8,6 @@ // TODO(philipj): Exposed=(Window,Worker) WillBeGarbageCollected, ] interface ImageBitmap { - // TODO(philipj): width/height should be unsigned long. - readonly attribute long width; - readonly attribute long height; + readonly attribute unsigned long width; + readonly attribute unsigned long height; }; |