WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
100164
Pass on exif orientation from ImageSource when using the open-source image decoders
https://bugs.webkit.org/show_bug.cgi?id=100164
Summary
Pass on exif orientation from ImageSource when using the open-source image de...
Nico Weber
Reported
2012-10-23 15:13:56 PDT
Pass on exif orientation from ImageSource when using the open-source image decoders
Attachments
Patch
(7.31 KB, patch)
2012-10-23 15:19 PDT
,
Nico Weber
no flags
Details
Formatted Diff
Diff
Patch
(7.32 KB, patch)
2012-10-24 09:18 PDT
,
Nico Weber
no flags
Details
Formatted Diff
Diff
Patch
(15.68 KB, patch)
2012-10-24 16:31 PDT
,
Nico Weber
no flags
Details
Formatted Diff
Diff
Patch
(7.36 KB, patch)
2012-10-24 16:37 PDT
,
Nico Weber
no flags
Details
Formatted Diff
Diff
Patch
(7.34 KB, patch)
2012-10-24 16:38 PDT
,
Nico Weber
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Nico Weber
Comment 1
2012-10-23 15:19:18 PDT
Created
attachment 170248
[details]
Patch
WebKit Review Bot
Comment 2
2012-10-23 15:23:44 PDT
Attachment 170248
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/rendering/RenderObject.cpp:2225: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Nico Weber
Comment 3
2012-10-23 19:49:24 PDT
+noel.gordon fyi
noel gordon
Comment 4
2012-10-24 09:02:07 PDT
Comment on
attachment 170248
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=170248&action=review
> Source/WebCore/ChangeLog:14 > + default). However, the feature needs port-specific modifications to > + GraphicsContext (without this, webcore will use the rotated bounds but > + draw the image as if it hadn't be rotated, resulting in squished > + pixels), and most ports don't implement these yet -- so put > + turning this on for image documents behind a port-specific #ifdef.
Were bugs filed about this? Chromium didn't have the port-specific modifications you mention, yet I don't recall any chromium bugs about squished pixels. Perhaps I'm not understanding.
> Source/WebCore/platform/graphics/ImageSource.cpp:110 > }
Good.
> Source/WebCore/platform/graphics/ImageSource.cpp:122 > + if (!m_decoder) > + return IntSize(); > + > + IntSize size = m_decoder->frameSizeAtIndex(index); > + if ((shouldRespectOrientation == RespectImageOrientation) && m_decoder->orientation().usesWidthAsHeight()) > + return IntSize(size.height(), size.width()); > > - return m_decoder ? m_decoder->frameSizeAtIndex(index) : IntSize(); > + return size; > }
m_decoder->frameSizeAtIndex(index) could return an empty IntSize, right? Maybe write this function body as: IntSize size = m_decoder ? m_decoder->frameSizeAtIndex(index) : IntSize(); if (shouldRespectOrientation == RespectImageOrientation && orientationAtIndex(index).usesWidthAsHeight()) return IntSize(size.height(), size.width()); return size;
> Source/WebCore/platform/graphics/ImageSource.cpp:184 > + return m_decoder ? m_decoder->orientation() : ImageOrientation();
return m_decoder ? m_decoder->orientation() : DefaultImageOrientation;
> Source/WebCore/platform/graphics/chromium/DeferredImageDecoder.cpp:156 > + return m_actualDecoder ? m_actualDecoder->orientation() : ImageOrientation();
return m_actualDecoder ? m_actualDecoder->orientation() : DefaultImageOrientation; You should prefix this statement with: // FIXME: Make this work with deferred image decoding.
> Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp:182 > + // The JPEG decoder looks at EXIF metadata. > + // TODO: Possibly implement XMP and IPTC support.
If you renamed the function to readExifOrientation, the first comment would be redundant :) The rename could happen in another patch. The second comment should be a FIXME, but I'm not sure this is a great place for it. Drop it, or file a bug about it.
> Source/WebCore/rendering/RenderObject.cpp:2226 > +#endif
Use an if statement to avoid the style nit @2225
Nico Weber
Comment 5
2012-10-24 09:18:39 PDT
Created
attachment 170414
[details]
Patch
Nico Weber
Comment 6
2012-10-24 09:19:20 PDT
View in context:
https://bugs.webkit.org/attachment.cgi?id=170248&action=review
>> Source/WebCore/ChangeLog:14 >> + turning this on for image documents behind a port-specific #ifdef. > > Were bugs filed about this? Chromium didn't have the port-specific modifications you mention, yet I don't recall any chromium bugs about squished pixels. Perhaps I'm not understanding.
Before this CL, orientation was never set on images, so the bug wasn't visible. This CL keeps it that way. If you want to see the squishing, patch in this CL to trunk webkit, remove the ifdef, and look at a exif-rotated jpeg.
>> Source/WebCore/platform/graphics/ImageSource.cpp:122 >> } > > m_decoder->frameSizeAtIndex(index) could return an empty IntSize, right? Maybe write this function body as: > > IntSize size = m_decoder ? m_decoder->frameSizeAtIndex(index) : IntSize(); > > if (shouldRespectOrientation == RespectImageOrientation && orientationAtIndex(index).usesWidthAsHeight()) > return IntSize(size.height(), size.width()); > > return size;
The current code is more similar to ImageSourceCG. Do you see a problem with the corrent code if frameSizeAtIndex() returns an empty size?
>> Source/WebCore/platform/graphics/ImageSource.cpp:184 >> + return m_decoder ? m_decoder->orientation() : ImageOrientation(); > > return m_decoder ? m_decoder->orientation() : DefaultImageOrientation;
Done.
>> Source/WebCore/platform/graphics/chromium/DeferredImageDecoder.cpp:156 >> + return m_actualDecoder ? m_actualDecoder->orientation() : ImageOrientation(); > > return m_actualDecoder ? m_actualDecoder->orientation() : DefaultImageOrientation; > > You should prefix this statement with: > > // FIXME: Make this work with deferred image decoding.
Done. Re FIXME: Does it not already work? Why not?
>> Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp:182 >> + // TODO: Possibly implement XMP and IPTC support. > > If you renamed the function to readExifOrientation, the first comment would be redundant :) The rename could happen in another patch. The second comment should be a FIXME, but I'm not sure this is a great place for it. Drop it, or file a bug about it.
Changed to FIXME
>> Source/WebCore/rendering/RenderObject.cpp:2226 >> +#endif > > Use an if statement to avoid the style nit @2225
I think the style nit isn't critical.
WebKit Review Bot
Comment 7
2012-10-24 09:20:47 PDT
Attachment 170414
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1 Source/WebCore/rendering/RenderObject.cpp:2225: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Total errors found: 1 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Eric Seidel (no email)
Comment 8
2012-10-24 14:37:03 PDT
Looks fine to me, but Noel may have further comments. I think SYD is asleep right now.
Eric Seidel (no email)
Comment 9
2012-10-24 14:42:14 PDT
Comment on
attachment 170414
[details]
Patch r=me. Please consult with Noel before landing.
Nico Weber
Comment 10
2012-10-24 16:31:56 PDT
Created
attachment 170506
[details]
Patch
Nico Weber
Comment 11
2012-10-24 16:37:32 PDT
Created
attachment 170510
[details]
Patch
Nico Weber
Comment 12
2012-10-24 16:38:50 PDT
Created
attachment 170511
[details]
Patch
noel gordon
Comment 13
2012-10-24 16:49:34 PDT
(In reply to
comment #6
)
> View in context:
https://bugs.webkit.org/attachment.cgi?id=170248&action=review
> > >> Source/WebCore/ChangeLog:14 > >> + turning this on for image documents behind a port-specific #ifdef. > > > > Were bugs filed about this? Chromium didn't have the port-specific modifications you mention, yet I don't recall any chromium bugs about squished pixels. Perhaps I'm not understanding. > > Before this CL, orientation was never set on images, so the bug wasn't visible. This CL keeps it that way. If you want to see the squishing, patch in this CL to trunk webkit, remove the ifdef, and look at a exif-rotated jpeg.
We need BitmapImage::draw modifications whichj we're fixing elsewhere.
> >> Source/WebCore/platform/graphics/ImageSource.cpp:122 > >> } > > > > m_decoder->frameSizeAtIndex(index) could return an empty IntSize, right? Maybe write this function body as: > > > > IntSize size = m_decoder ? m_decoder->frameSizeAtIndex(index) : IntSize(); > > > > if (shouldRespectOrientation == RespectImageOrientation && orientationAtIndex(index).usesWidthAsHeight()) > > return IntSize(size.height(), size.width()); > > > > return size; > > The current code is more similar to ImageSourceCG. Do you see a problem with the current code if frameSizeAtIndex() returns an empty size?
Nope.
> > // FIXME: Make this work with deferred image decoding. > > Done. > Re FIXME: Does it not already work? Why not?
Because m_actualDecoder becomes NULL when deferred decoding starts.
> >> Source/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp:182 > >> + // TODO: Possibly implement XMP and IPTC support. > > > > If you renamed the function to readExifOrientation, the first comment would be redundant :) The rename could happen in another patch. The second comment should be a FIXME, but I'm not sure this is a great place for it. Drop it, or file a bug about it. > > Changed to FIXME > > >> Source/WebCore/rendering/RenderObject.cpp:2226 > >> +#endif > > > > Use an if statement to avoid the style nit @2225 > > I think the style nit isn't critical.
Not critical but it makes noise for me and others. I'm fine with this patch though.
noel gordon
Comment 14
2012-10-24 16:51:15 PDT
Lots of mid-air collisions while trying to say the above :)
WebKit Review Bot
Comment 15
2012-10-24 17:43:05 PDT
Comment on
attachment 170511
[details]
Patch Clearing flags on attachment: 170511 Committed
r132433
: <
http://trac.webkit.org/changeset/132433
>
WebKit Review Bot
Comment 16
2012-10-24 17:43:09 PDT
All reviewed patches have been landed. Closing bug.
noel gordon
Comment 17
2012-10-24 19:06:09 PDT
(In reply to
comment #13
)
> (In reply to
comment #6
) > > View in context:
https://bugs.webkit.org/attachment.cgi?id=170248&action=review
> > > > >> Source/WebCore/ChangeLog:14 > > >> + turning this on for image documents behind a port-specific #ifdef. > > > > > > Were bugs filed about this? Chromium didn't have the port-specific modifications you mention, yet I don't recall any chromium bugs about squished pixels. Perhaps I'm not understanding. > > > > Before this CL, orientation was never set on images, so the bug wasn't visible. This CL keeps it that way. If you want to see the squishing, patch in this CL to trunk webkit, remove the ifdef, and look at a exif-rotated jpeg. > > We need BitmapImage::draw modifications which we're fixing elsewhere.
And to be precise, since ImageSource now returns orientation on all ports, those without the BitmapImage::draw modifications will squish. Hence the #ifdef. The #ifdef is missing an || PLATFORM(CHROMIUM) fyi, so imageDocument orientation is not yet working on chromium.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug