| Differences between
and this patch
- a/Source/WebCore/ChangeLog +38 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2013-07-05  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
2
3
        [EFL] Enable CSS Image Orientation
4
        https://bugs.webkit.org/show_bug.cgi?id=118454
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        http://www.w3.org/TR/2012/CR-css3-images-20120417/#the-image-orientation
9
        The css3-images module is at candidate recommendation.
10
11
        No new tests; draft patch.
12
13
        * loader/cache/CachedImage.cpp:
14
        (WebCore::CachedImage::imageSizeForRenderer):
15
        * page/DragController.cpp:
16
        (WebCore::DragController::doImageDrag):
17
        * page/Frame.cpp:
18
        (WebCore::Frame::nodeImage):
19
        * platform/graphics/BitmapImage.cpp:
20
        (WebCore::BitmapImage::updateSize):
21
        (WebCore::BitmapImage::sizeRespectingOrientation):
22
        * platform/graphics/BitmapImage.h:
23
        (BitmapImage):
24
        * platform/graphics/GraphicsContext.cpp:
25
        (WebCore::GraphicsContext::drawImage):
26
        * platform/graphics/cg/ImageCG.cpp:
27
        (WebCore::BitmapImage::draw):
28
        * platform/graphics/cg/ImageSourceCG.cpp:
29
        (WebCore::ImageSource::frameSizeAtIndex):
30
        * platform/mac/DragImageMac.mm:
31
        (WebCore::createDragImageFromImage):
32
        * rendering/RenderImage.cpp:
33
        (WebCore::RenderImage::styleDidChange):
34
        (WebCore::RenderImage::paintReplaced):
35
        (WebCore::RenderImage::paintIntoRect):
36
        * rendering/style/RenderStyle.cpp:
37
        (WebCore::RenderStyle::diff):
38
1
2013-07-05  Tim Horton  <timothy_horton@apple.com>
39
2013-07-05  Tim Horton  <timothy_horton@apple.com>
2
40
3
        Tons of crashes on bots after r152425
41
        Tons of crashes on bots after r152425
- a/Source/WebCore/html/HTMLCanvasElement.cpp -1 / +1 lines
Lines 405-411 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r, boo a/Source/WebCore/html/HTMLCanvasElement.cpp_sec1
405
        ImageBuffer* imageBuffer = buffer();
405
        ImageBuffer* imageBuffer = buffer();
406
        if (imageBuffer) {
406
        if (imageBuffer) {
407
            if (m_presentedImage)
407
            if (m_presentedImage)
408
                context->drawImage(m_presentedImage.get(), ColorSpaceDeviceRGB, pixelSnappedIntRect(r), CompositeSourceOver, DoNotRespectImageOrientation, useLowQualityScale);
408
                context->drawImage(m_presentedImage.get(), ColorSpaceDeviceRGB, pixelSnappedIntRect(r), CompositeSourceOver, DefaultImageOrientation, DoNotRespectImageOrientation, useLowQualityScale);
409
            else
409
            else
410
                context->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, pixelSnappedIntRect(r), CompositeSourceOver, BlendModeNormal, useLowQualityScale);
410
                context->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, pixelSnappedIntRect(r), CompositeSourceOver, BlendModeNormal, useLowQualityScale);
411
        }
411
        }
- a/Source/WebCore/loader/cache/CachedImage.cpp -2 / +12 lines
Lines 254-261 LayoutSize CachedImage::imageSizeForRenderer(const RenderObject* renderer, float a/Source/WebCore/loader/cache/CachedImage.cpp_sec1
254
254
255
    LayoutSize imageSize;
255
    LayoutSize imageSize;
256
256
257
    if (m_image->isBitmapImage() && (renderer && renderer->shouldRespectImageOrientation() == RespectImageOrientation))
257
    ImageOrientationEnum orientation = OriginTopLeft;
258
        imageSize = static_cast<BitmapImage*>(m_image.get())->sizeRespectingOrientation();
258
    RespectImageOrientationEnum shouldRespectImageOrientation = DoNotRespectImageOrientation;
259
   if (renderer)
260
       shouldRespectImageOrientation = renderer->shouldRespectImageOrientation();
261
262
#if ENABLE(CSS_IMAGE_ORIENTATION)
263
   if (renderer && renderer->style())
264
       orientation = renderer->style()->imageOrientation();
265
#endif
266
267
    if (m_image->isBitmapImage() && (shouldRespectImageOrientation == RespectImageOrientation || orientation != OriginTopLeft))
268
        imageSize = static_cast<BitmapImage*>(m_image.get())->sizeRespectingOrientation(orientation, shouldRespectImageOrientation);
259
#if ENABLE(SVG)
269
#if ENABLE(SVG)
260
    else if (m_image->isSVGImage()) {
270
    else if (m_image->isSVGImage()) {
261
        imageSize = m_svgImageCache->imageSizeForRenderer(renderer);
271
        imageSize = m_svgImageCache->imageSizeForRenderer(renderer);
- a/Source/WebCore/page/DragController.cpp -1 / +6 lines
Lines 875-882 void DragController::doImageDrag(Element* element, const IntPoint& dragOrigin, c a/Source/WebCore/page/DragController.cpp_sec1
875
    IntPoint origin;
875
    IntPoint origin;
876
876
877
    Image* image = getImage(element);
877
    Image* image = getImage(element);
878
    ImageOrientationEnum orientation = OriginTopLeft;
879
#if ENABLE(CSS_IMAGE_ORIENTATION)
880
    if (element->renderer() && element->renderer()->style())
881
        orientation = element->renderer()->style()->imageOrientation();
882
#endif
878
    if (image && image->size().height() * image->size().width() <= MaxOriginalImageArea
883
    if (image && image->size().height() * image->size().width() <= MaxOriginalImageArea
879
        && (dragImage = createDragImageFromImage(image, element->renderer() ? element->renderer()->shouldRespectImageOrientation() : DoNotRespectImageOrientation))) {
884
        && (dragImage = createDragImageFromImage(image, orientation, element->renderer() ? element->renderer()->shouldRespectImageOrientation() : DoNotRespectImageOrientation))) {
880
        IntSize originalSize = rect.size();
885
        IntSize originalSize = rect.size();
881
        origin = rect.location();
886
        origin = rect.location();
882
887
- a/Source/WebCore/page/Frame.cpp -2 / +7 lines
Lines 1093-1099 DragImageRef Frame::nodeImage(Node* node) a/Source/WebCore/page/Frame.cpp_sec1
1093
    m_view->paintContents(buffer->context(), paintingRect);
1093
    m_view->paintContents(buffer->context(), paintingRect);
1094
1094
1095
    RefPtr<Image> image = buffer->copyImage();
1095
    RefPtr<Image> image = buffer->copyImage();
1096
    return createDragImageFromImage(image.get(), renderer->shouldRespectImageOrientation());
1096
    ImageOrientationEnum orientation = OriginTopLeft;
1097
#if ENABLE(CSS_IMAGE_ORIENTATION)
1098
    if (renderer->style())
1099
        orientation = renderer->style()->imageOrientation();
1100
#endif
1101
    return createDragImageFromImage(image.get(), orientation, renderer->shouldRespectImageOrientation());
1097
}
1102
}
1098
1103
1099
DragImageRef Frame::dragImageForSelection()
1104
DragImageRef Frame::dragImageForSelection()
Lines 1122-1128 DragImageRef Frame::dragImageForSelection() a/Source/WebCore/page/Frame.cpp_sec2
1122
    m_view->paintContents(buffer->context(), paintingRect);
1127
    m_view->paintContents(buffer->context(), paintingRect);
1123
1128
1124
    RefPtr<Image> image = buffer->copyImage();
1129
    RefPtr<Image> image = buffer->copyImage();
1125
    return createDragImageFromImage(image.get());
1130
    return createDragImageFromImage(image.get(), OriginTopLeft);
1126
}
1131
}
1127
1132
1128
#endif
1133
#endif
- a/Source/WebCore/platform/DragImage.h -1 / +1 lines
Lines 75-81 namespace WebCore { a/Source/WebCore/platform/DragImage.h_sec1
75
    DragImageRef scaleDragImage(DragImageRef, FloatSize scale);
75
    DragImageRef scaleDragImage(DragImageRef, FloatSize scale);
76
    DragImageRef dissolveDragImageToFraction(DragImageRef image, float delta);
76
    DragImageRef dissolveDragImageToFraction(DragImageRef image, float delta);
77
    
77
    
78
    DragImageRef createDragImageFromImage(Image*, RespectImageOrientationEnum = DoNotRespectImageOrientation);
78
    DragImageRef createDragImageFromImage(Image*, ImageOrientationEnum orientation, RespectImageOrientationEnum = DoNotRespectImageOrientation);
79
    DragImageRef createDragImageIconForCachedImageFilename(const String&);
79
    DragImageRef createDragImageIconForCachedImageFilename(const String&);
80
    DragImageRef createDragImageForLink(KURL&, const String& label, FontRenderingMode);
80
    DragImageRef createDragImageForLink(KURL&, const String& label, FontRenderingMode);
81
    void deleteDragImage(DragImageRef);
81
    void deleteDragImage(DragImageRef);
- a/Source/WebCore/platform/efl/DragImageEfl.cpp -1 / +1 lines
Lines 49-55 DragImageRef dissolveDragImageToFraction(DragImageRef image, float) a/Source/WebCore/platform/efl/DragImageEfl.cpp_sec1
49
    return image;
49
    return image;
50
}
50
}
51
51
52
DragImageRef createDragImageFromImage(Image*, RespectImageOrientationEnum)
52
DragImageRef createDragImageFromImage(Image*, ImageOrientationEnum orientation, RespectImageOrientationEnum)
53
{
53
{
54
    notImplemented();
54
    notImplemented();
55
    return 0;
55
    return 0;
- a/Source/WebCore/platform/graphics/BitmapImage.cpp -5 / +9 lines
Lines 179-191 void BitmapImage::didDecodeProperties() const a/Source/WebCore/platform/graphics/BitmapImage.cpp_sec1
179
        imageObserver()->decodedSizeChanged(this, deltaBytes);
179
        imageObserver()->decodedSizeChanged(this, deltaBytes);
180
}
180
}
181
181
182
void BitmapImage::updateSize() const
182
void BitmapImage::updateSize(ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation) const
183
{
183
{
184
    if (!m_sizeAvailable || m_haveSize)
184
    if (!m_sizeAvailable || (m_haveSize
185
        && orientation == static_cast<ImageOrientationEnum>(m_orientation)
186
        && shouldRespectImageOrientation == static_cast<RespectImageOrientationEnum>(m_shouldRespectImageOrientation)))
185
        return;
187
        return;
186
188
187
    m_size = m_source.size();
189
    m_size = m_source.size();
188
    m_sizeRespectingOrientation = m_source.size(RespectImageOrientation);
190
    m_sizeRespectingOrientation = m_source.size(orientation, shouldRespectImageOrientation);
191
    m_orientation = static_cast<unsigned>(orientation);
192
    m_shouldRespectImageOrientation = static_cast<unsigned>(shouldRespectImageOrientation);
189
    m_haveSize = true;
193
    m_haveSize = true;
190
    didDecodeProperties();
194
    didDecodeProperties();
191
}
195
}
Lines 196-204 IntSize BitmapImage::size() const a/Source/WebCore/platform/graphics/BitmapImage.cpp_sec2
196
    return m_size;
200
    return m_size;
197
}
201
}
198
202
199
IntSize BitmapImage::sizeRespectingOrientation() const
203
IntSize BitmapImage::sizeRespectingOrientation(ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation) const
200
{
204
{
201
    updateSize();
205
    updateSize(orientation, shouldRespectImageOrientation);
202
    return m_sizeRespectingOrientation;
206
    return m_sizeRespectingOrientation;
203
}
207
}
204
208
- a/Source/WebCore/platform/graphics/BitmapImage.h -2 / +4 lines
Lines 118-124 public: a/Source/WebCore/platform/graphics/BitmapImage.h_sec1
118
    virtual bool hasSingleSecurityOrigin() const;
118
    virtual bool hasSingleSecurityOrigin() const;
119
119
120
    virtual IntSize size() const;
120
    virtual IntSize size() const;
121
    IntSize sizeRespectingOrientation() const;
121
    IntSize sizeRespectingOrientation(ImageOrientationEnum, RespectImageOrientationEnum) const;
122
    IntSize currentFrameSize() const;
122
    IntSize currentFrameSize() const;
123
    virtual bool getHotSpot(IntPoint&) const;
123
    virtual bool getHotSpot(IntPoint&) const;
124
124
Lines 174-180 public: a/Source/WebCore/platform/graphics/BitmapImage.h_sec2
174
    bool canAnimate();
174
    bool canAnimate();
175
175
176
private:
176
private:
177
    void updateSize() const;
177
    void updateSize(ImageOrientationEnum = OriginTopLeft, RespectImageOrientationEnum = DoNotRespectImageOrientation) const;
178
178
179
protected:
179
protected:
180
    enum RepetitionCountStatus {
180
    enum RepetitionCountStatus {
Lines 265-270 protected: a/Source/WebCore/platform/graphics/BitmapImage.h_sec3
265
    ImageSource m_source;
265
    ImageSource m_source;
266
    mutable IntSize m_size; // The size to use for the overall image (will just be the size of the first image).
266
    mutable IntSize m_size; // The size to use for the overall image (will just be the size of the first image).
267
    mutable IntSize m_sizeRespectingOrientation;
267
    mutable IntSize m_sizeRespectingOrientation;
268
    mutable unsigned m_orientation : 4; // ImageOrientationEnum
269
    mutable unsigned m_shouldRespectImageOrientation : 1; // RespectImageOrientationEnum
268
    
270
    
269
    size_t m_currentFrame; // The index of the current frame of animation.
271
    size_t m_currentFrame; // The index of the current frame of animation.
270
    Vector<FrameData, 1> m_frames; // An array of the cached frames of the animation. We have to ref frames to pin them in the cache.
272
    Vector<FrameData, 1> m_frames; // An array of the cached frames of the animation. We have to ref frames to pin them in the cache.
- a/Source/WebCore/platform/graphics/GraphicsContext.cpp -11 / +11 lines
Lines 469-506 void GraphicsContext::drawHighlightForText(const Font& font, const TextRun& run, a/Source/WebCore/platform/graphics/GraphicsContext.cpp_sec1
469
    fillRect(font.selectionRectForText(run, point, h, from, to), backgroundColor, colorSpace);
469
    fillRect(font.selectionRectForText(run, point, h, from, to), backgroundColor, colorSpace);
470
}
470
}
471
471
472
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation)
472
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op, ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation)
473
{
473
{
474
    if (!image)
474
    if (!image)
475
        return;
475
        return;
476
    drawImage(image, styleColorSpace, FloatRect(IntRect(p, image->size())), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation);
476
    drawImage(image, styleColorSpace, FloatRect(IntRect(p, image->size())), FloatRect(FloatPoint(), FloatSize(image->size())), op, orientation, shouldRespectImageOrientation);
477
}
477
}
478
478
479
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
479
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
480
{
480
{
481
    if (!image)
481
    if (!image)
482
        return;
482
        return;
483
    drawImage(image, styleColorSpace, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation, useLowQualityScale);
483
    drawImage(image, styleColorSpace, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, orientation, shouldRespectImageOrientation, useLowQualityScale);
484
}
484
}
485
485
486
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation)
486
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation)
487
{
487
{
488
    drawImage(image, styleColorSpace, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, shouldRespectImageOrientation);
488
    drawImage(image, styleColorSpace, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, orientation, shouldRespectImageOrientation);
489
}
489
}
490
490
491
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
491
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
492
{
492
{
493
    drawImage(image, styleColorSpace, dest, src, op, BlendModeNormal, shouldRespectImageOrientation, useLowQualityScale);
493
    drawImage(image, styleColorSpace, dest, src, op, BlendModeNormal, orientation, shouldRespectImageOrientation, useLowQualityScale);
494
}
494
}
495
495
496
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest)
496
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, ImageOrientationEnum)
497
{
497
{
498
    if (!image)
498
    if (!image)
499
        return;
499
        return;
500
    drawImage(image, styleColorSpace, dest, FloatRect(IntRect(IntPoint(), image->size())));
500
    drawImage(image, styleColorSpace, dest, FloatRect(IntRect(IntPoint(), image->size())));
501
}
501
}
502
502
503
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, BlendMode blendMode, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
503
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, BlendMode blendMode, ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
504
{    if (paintingDisabled() || !image)
504
{    if (paintingDisabled() || !image)
505
        return;
505
        return;
506
506
Lines 540-546 void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, c a/Source/WebCore/platform/graphics/GraphicsContext.cpp_sec2
540
540
541
    if (hRule == Image::StretchTile && vRule == Image::StretchTile) {
541
    if (hRule == Image::StretchTile && vRule == Image::StretchTile) {
542
        // Just do a scale.
542
        // Just do a scale.
543
        drawImage(image, styleColorSpace, dest, srcRect, op);
543
        drawImage(image, styleColorSpace, dest, srcRect, op, DefaultImageOrientation, BlendModeNormal);
544
        return;
544
        return;
545
    }
545
    }
546
546
- a/Source/WebCore/platform/graphics/GraphicsContext.h -6 / +6 lines
Lines 287-298 namespace WebCore { a/Source/WebCore/platform/graphics/GraphicsContext.h_sec1
287
287
288
        void strokeRect(const FloatRect&, float lineWidth);
288
        void strokeRect(const FloatRect&, float lineWidth);
289
289
290
        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint&, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation);
290
        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint&, CompositeOperator = CompositeSourceOver, ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation);
291
        void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
291
        void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
292
        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation);
292
        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation);
293
        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect);
293
        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, ImageOrientationEnum = DefaultImageOrientation);
294
        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
294
        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
295
        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
295
        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
296
        
296
        
297
        void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
297
        void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
298
            CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, BlendMode = BlendModeNormal);
298
            CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false, BlendMode = BlendModeNormal);
- a/Source/WebCore/platform/graphics/ImageSource.cpp -3 / +3 lines
Lines 99-110 bool ImageSource::isSizeAvailable() a/Source/WebCore/platform/graphics/ImageSource.cpp_sec1
99
    return m_decoder && m_decoder->isSizeAvailable();
99
    return m_decoder && m_decoder->isSizeAvailable();
100
}
100
}
101
101
102
IntSize ImageSource::size(RespectImageOrientationEnum shouldRespectOrientation) const
102
IntSize ImageSource::size(ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectOrientation) const
103
{
103
{
104
    return frameSizeAtIndex(0, shouldRespectOrientation);
104
    return frameSizeAtIndex(0, DefaultImageOrientation, shouldRespectOrientation);
105
}
105
}
106
106
107
IntSize ImageSource::frameSizeAtIndex(size_t index, RespectImageOrientationEnum shouldRespectOrientation) const
107
IntSize ImageSource::frameSizeAtIndex(size_t index, ImageOrientationEnum, RespectImageOrientationEnum shouldRespectOrientation) const
108
{
108
{
109
    if (!m_decoder)
109
    if (!m_decoder)
110
        return IntSize();
110
        return IntSize();
- a/Source/WebCore/platform/graphics/ImageSource.h -2 / +2 lines
Lines 132-139 public: a/Source/WebCore/platform/graphics/ImageSource.h_sec1
132
    String filenameExtension() const;
132
    String filenameExtension() const;
133
133
134
    bool isSizeAvailable();
134
    bool isSizeAvailable();
135
    IntSize size(RespectImageOrientationEnum = DoNotRespectImageOrientation) const;
135
    IntSize size(ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation) const;
136
    IntSize frameSizeAtIndex(size_t, RespectImageOrientationEnum = DoNotRespectImageOrientation) const;
136
    IntSize frameSizeAtIndex(size_t, ImageOrientationEnum = DefaultImageOrientation, RespectImageOrientationEnum = DoNotRespectImageOrientation) const;
137
137
138
    bool getHotSpot(IntPoint&) const;
138
    bool getHotSpot(IntPoint&) const;
139
139
- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp -1 / +1 lines
Lines 147-153 void ImageBuffer::draw(GraphicsContext* destinationContext, ColorSpace styleColo a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp_sec1
147
{
147
{
148
    BackingStoreCopy copyMode = destinationContext == context() ? CopyBackingStore : DontCopyBackingStore;
148
    BackingStoreCopy copyMode = destinationContext == context() ? CopyBackingStore : DontCopyBackingStore;
149
    RefPtr<Image> image = copyImage(copyMode);
149
    RefPtr<Image> image = copyImage(copyMode);
150
    destinationContext->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, blendMode, DoNotRespectImageOrientation, useLowQualityScale);
150
    destinationContext->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DefaultImageOrientation, blendMode, DoNotRespectImageOrientation, useLowQualityScale);
151
}
151
}
152
152
153
void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
153
void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform,
- a/Source/WebCore/platform/mac/DragImageMac.mm -8 / +8 lines
Lines 77-95 RetainPtr<NSImage> dissolveDragImageToFraction(RetainPtr<NSImage> image, float d a/Source/WebCore/platform/mac/DragImageMac.mm_sec1
77
    return dissolvedImage;
77
    return dissolvedImage;
78
}
78
}
79
        
79
        
80
RetainPtr<NSImage> createDragImageFromImage(Image* image, RespectImageOrientationEnum shouldRespectImageOrientation)
80
RetainPtr<NSImage> createDragImageFromImage(Image* image, ImageOrientationEnum orientation, RespectImageOrientationEnum shouldRespectImageOrientation)
81
{
81
{
82
    IntSize size = image->size();
82
    IntSize size = image->size();
83
83
84
    if (image->isBitmapImage()) {
84
    if (image->isBitmapImage()) {
85
        ImageOrientation orientation = DefaultImageOrientation;
85
        ImageOrientation frameOrientation(orientation);
86
        BitmapImage* bitmapImage = static_cast<BitmapImage *>(image);
86
        BitmapImage* bitmapImage = static_cast<BitmapImage *>(image);
87
        IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation();
87
        IntSize sizeRespectingOrientation = bitmapImage->sizeRespectingOrientation(orientation, shouldRespectImageOrientation);
88
88
89
        if (shouldRespectImageOrientation == RespectImageOrientation)
89
        if (orientation == OriginTopLeft && shouldRespectImageOrientation == RespectImageOrientation)
90
            orientation = bitmapImage->currentFrameOrientation();
90
            frameOrientation = bitmapImage->currentFrameOrientation();
91
91
92
        if (orientation != DefaultImageOrientation) {
92
        if (frameOrientation != DefaultImageOrientation) {
93
            // Construct a correctly-rotated copy of the image to use as the drag image.
93
            // Construct a correctly-rotated copy of the image to use as the drag image.
94
            FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
94
            FloatRect destRect(FloatPoint(), sizeRespectingOrientation);
95
95
Lines 99-107 RetainPtr<NSImage> createDragImageFromImage(Image* image, RespectImageOrientatio a/Source/WebCore/platform/mac/DragImageMac.mm_sec2
99
            // ImageOrientation uses top-left coordinates, need to flip to bottom-left, apply...
99
            // ImageOrientation uses top-left coordinates, need to flip to bottom-left, apply...
100
            CGAffineTransform transform = CGAffineTransformMakeTranslation(0, destRect.height());
100
            CGAffineTransform transform = CGAffineTransformMakeTranslation(0, destRect.height());
101
            transform = CGAffineTransformScale(transform, 1, -1);
101
            transform = CGAffineTransformScale(transform, 1, -1);
102
            transform = CGAffineTransformConcat(orientation.transformFromDefault(sizeRespectingOrientation), transform);
102
            transform = CGAffineTransformConcat(frameOrientation.transformFromDefault(sizeRespectingOrientation), transform);
103
103
104
            if (orientation.usesWidthAsHeight())
104
            if (frameOrientation.usesWidthAsHeight())
105
                destRect = FloatRect(destRect.x(), destRect.y(), destRect.height(), destRect.width());
105
                destRect = FloatRect(destRect.x(), destRect.y(), destRect.height(), destRect.width());
106
106
107
            // ...and flip back.
107
            // ...and flip back.
- a/Source/WebCore/rendering/RenderImage.cpp -2 / +15 lines
Lines 146-151 void RenderImage::styleDidChange(StyleDifference diff, const RenderStyle* oldSty a/Source/WebCore/rendering/RenderImage.cpp_sec1
146
            imageDimensionsChanged(true /* imageSizeChanged */);
146
            imageDimensionsChanged(true /* imageSizeChanged */);
147
        m_needsToSetSizeForAltText = false;
147
        m_needsToSetSizeForAltText = false;
148
    }
148
    }
149
#if ENABLE(CSS_IMAGE_ORIENTATION)
150
    if (diff == StyleDifferenceLayout
151
        && oldStyle->imageOrientation() != style()->imageOrientation())
152
        return imageDimensionsChanged(true /* imageSizeChanged */);
153
#endif
149
#if ENABLE(CSS_IMAGE_RESOLUTION)
154
#if ENABLE(CSS_IMAGE_RESOLUTION)
150
    if (diff == StyleDifferenceLayout
155
    if (diff == StyleDifferenceLayout
151
        && (oldStyle->imageResolution() != style()->imageResolution()
156
        && (oldStyle->imageResolution() != style()->imageResolution()
Lines 353-359 void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOf a/Source/WebCore/rendering/RenderImage.cpp_sec2
353
                if (centerY < 0)
358
                if (centerY < 0)
354
                    centerY = 0;
359
                    centerY = 0;
355
                imageOffset = LayoutSize(leftBorder + leftPad + centerX + borderWidth, topBorder + topPad + centerY + borderWidth);
360
                imageOffset = LayoutSize(leftBorder + leftPad + centerX + borderWidth, topBorder + topPad + centerY + borderWidth);
356
                context->drawImage(image.get(), style()->colorSpace(), pixelSnappedIntRect(LayoutRect(paintOffset + imageOffset, imageSize)), CompositeSourceOver, shouldRespectImageOrientation());
361
                ImageOrientationEnum orientation = OriginTopLeft;
362
#if ENABLE(CSS_IMAGE_ORIENTATION)
363
                orientation = style()->imageOrientation();
364
#endif
365
                context->drawImage(image.get(), style()->colorSpace(), pixelSnappedIntRect(LayoutRect(paintOffset + imageOffset, imageSize)), CompositeSourceOver, sorientation, houldRespectImageOrientation());
357
                errorPictureDrawn = true;
366
                errorPictureDrawn = true;
358
            }
367
            }
359
368
Lines 475-481 void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect a/Source/WebCore/rendering/RenderImage.cpp_sec3
475
    CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
484
    CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
476
    Image* image = m_imageResource->image().get();
485
    Image* image = m_imageResource->image().get();
477
    bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size());
486
    bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size());
478
    context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style()->colorSpace(), alignedRect, compositeOperator, shouldRespectImageOrientation(), useLowQualityScaling);
487
#if ENABLE(CSS_IMAGE_ORIENTATION)
488
    ImageOrientationEnum orientation = OriginTopLeft;
489
    orientation = style()->imageOrientation();
490
#endif
491
    context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style()->colorSpace(), alignedRect, compositeOperator, orientation, shouldRespectImageOrientation(), useLowQualityScaling);
479
}
492
}
480
493
481
bool RenderImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const
494
bool RenderImage::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance bleedAvoidance, InlineFlowBox*) const
- a/Source/WebCore/rendering/style/RenderStyle.cpp +3 lines
Lines 493-498 bool RenderStyle::changeRequiresLayout(const RenderStyle* other, unsigned& chang a/Source/WebCore/rendering/style/RenderStyle.cpp_sec1
493
            || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
493
            || rareInheritedData->m_tabSize != other->rareInheritedData->m_tabSize
494
            || rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
494
            || rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain
495
            || rareInheritedData->m_lineGrid != other->rareInheritedData->m_lineGrid
495
            || rareInheritedData->m_lineGrid != other->rareInheritedData->m_lineGrid
496
#if ENABLE(CSS_IMAGE_ORIENTATION)
497
            || rareInheritedData->m_imageOrientation != other->rareInheritedData->m_imageOrientation
498
#endif
496
#if ENABLE(CSS_IMAGE_RESOLUTION)
499
#if ENABLE(CSS_IMAGE_RESOLUTION)
497
            || rareInheritedData->m_imageResolutionSource != other->rareInheritedData->m_imageResolutionSource
500
            || rareInheritedData->m_imageResolutionSource != other->rareInheritedData->m_imageResolutionSource
498
            || rareInheritedData->m_imageResolutionSnap != other->rareInheritedData->m_imageResolutionSnap
501
            || rareInheritedData->m_imageResolutionSnap != other->rareInheritedData->m_imageResolutionSnap
- a/Tools/Scripts/webkitperl/FeatureList.pm -1 / +1 lines
Lines 207-213 my @features = ( a/Tools/Scripts/webkitperl/FeatureList.pm_sec1
207
      define => "ENABLE_CSS_BOX_DECORATION_BREAK", default => 1, value => \$cssBoxDecorationBreakSupport },
207
      define => "ENABLE_CSS_BOX_DECORATION_BREAK", default => 1, value => \$cssBoxDecorationBreakSupport },
208
208
209
    { option => "css-image-orientation", desc => "Toggle CSS image-orientation support",
209
    { option => "css-image-orientation", desc => "Toggle CSS image-orientation support",
210
      define => "ENABLE_CSS_IMAGE_ORIENTATION", default => isGtk(), value => \$cssImageOrientationSupport },
210
      define => "ENABLE_CSS_IMAGE_ORIENTATION", default => (isEfl() || isGtk()), value => \$cssImageOrientationSupport },
211
211
212
    { option => "css-image-resolution", desc => "Toggle CSS image-resolution support",
212
    { option => "css-image-resolution", desc => "Toggle CSS image-resolution support",
213
      define => "ENABLE_CSS_IMAGE_RESOLUTION", default => (isBlackBerry() || isGtk()), value => \$cssImageResolutionSupport },
213
      define => "ENABLE_CSS_IMAGE_RESOLUTION", default => (isBlackBerry() || isGtk()), value => \$cssImageResolutionSupport },

Return to Bug 118454