Bug 89728 - BitmapImage duplicates code to calculate size
Summary: BitmapImage duplicates code to calculate size
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-06-21 18:31 PDT by Dean Jackson
Modified: 2012-06-22 12:14 PDT (History)
2 users (show)

See Also:


Attachments
Patch (2.78 KB, patch)
2012-06-21 18:42 PDT, Dean Jackson
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2012-06-21 18:31:47 PDT
BitmapImage has some code duplication to ask the source for the size.
Comment 1 Radar WebKit Bug Importer 2012-06-21 18:32:24 PDT
<rdar://problem/11724321>
Comment 2 Dean Jackson 2012-06-21 18:42:39 PDT
Created attachment 148938 [details]
Patch
Comment 3 Darin Adler 2012-06-21 19:10:55 PDT
Comment on attachment 148938 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=148938&action=review

> Source/WebCore/ChangeLog:21
> +        * platform/graphics/BitmapImage.cpp:
> +        (WebCore::BitmapImage::updateSize):
> +        (WebCore):
> +        (WebCore::BitmapImage::size):
> +        (WebCore::BitmapImage::sizeRespectingOrientation):
> +        * platform/graphics/BitmapImage.h:
> +        (BitmapImage):

I really like per-function comments, and here they would be so easy to write!

> Source/WebCore/platform/graphics/BitmapImage.cpp:183
>      if (m_sizeAvailable && !m_haveSize) {

Might be nice to use early return since this function now is only about updating.

> Source/WebCore/platform/graphics/BitmapImage.h:267
> +    void updateSize() const;

This could be private rather than protected.
Comment 4 Dean Jackson 2012-06-22 12:14:34 PDT
Committed r121048: <http://trac.webkit.org/changeset/121048>