Changeset 167497 in webkit


Ignore:
Timestamp:
Apr 18, 2014 11:35:20 AM (10 years ago)
Author:
Simon Fraser
Message:

Remove some includes from image-related headers, and Document.h
https://bugs.webkit.org/show_bug.cgi?id=131797

Reviewed by Martin Robinson.

Remove some #includes from Document.h, DragImage.h, GradientImage.h,
Image.h, and ImageBuffer.h and deal with the fallout.

  • dom/ContainerNode.h:
  • dom/Document.cpp:

(WebCore::Document::setInputCursor):

  • dom/Document.h:

(WebCore::Document::inputCursor):

  • dom/MutationObserverRegistration.cpp:
  • html/canvas/WebGLRenderingContext.cpp:
  • page/FrameSnapshotting.cpp:
  • page/Page.cpp:
  • platform/DragImage.h:
  • platform/graphics/BitmapImage.cpp:
  • platform/graphics/GradientImage.cpp:

(WebCore::GradientImage::GradientImage):
(WebCore::GradientImage::~GradientImage):

  • platform/graphics/GradientImage.h:
  • platform/graphics/Image.h:
  • platform/graphics/ImageBuffer.cpp:
  • platform/graphics/ImageBuffer.h:

(WebCore::ImageBuffer::create):
(WebCore::ImageBuffer::internalSize):
(WebCore::ImageBuffer::logicalSize):
(WebCore::ImageBuffer::baseTransform):
(WebCore::ImageBuffer::spaceSize):
(WebCore::ImageBuffer::setSpaceSize):

  • rendering/RenderThemeMac.mm:
  • rendering/shapes/Shape.cpp:
  • rendering/svg/RenderSVGContainer.cpp:
  • svg/SVGURIReference.h:
Location:
trunk/Source/WebCore
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167493 r167497  
     12014-04-18  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Remove some includes from image-related headers, and Document.h
     4        https://bugs.webkit.org/show_bug.cgi?id=131797
     5
     6        Reviewed by Martin Robinson.
     7
     8        Remove some #includes from Document.h, DragImage.h, GradientImage.h,
     9        Image.h, and ImageBuffer.h and deal with the fallout.
     10
     11        * dom/ContainerNode.h:
     12        * dom/Document.cpp:
     13        (WebCore::Document::setInputCursor):
     14        * dom/Document.h:
     15        (WebCore::Document::inputCursor):
     16        * dom/MutationObserverRegistration.cpp:
     17        * html/canvas/WebGLRenderingContext.cpp:
     18        * page/FrameSnapshotting.cpp:
     19        * page/Page.cpp:
     20        * platform/DragImage.h:
     21        * platform/graphics/BitmapImage.cpp:
     22        * platform/graphics/GradientImage.cpp:
     23        (WebCore::GradientImage::GradientImage):
     24        (WebCore::GradientImage::~GradientImage):
     25        * platform/graphics/GradientImage.h:
     26        * platform/graphics/Image.h:
     27        * platform/graphics/ImageBuffer.cpp:
     28        * platform/graphics/ImageBuffer.h:
     29        (WebCore::ImageBuffer::create):
     30        (WebCore::ImageBuffer::internalSize):
     31        (WebCore::ImageBuffer::logicalSize):
     32        (WebCore::ImageBuffer::baseTransform):
     33        (WebCore::ImageBuffer::spaceSize):
     34        (WebCore::ImageBuffer::setSpaceSize):
     35        * rendering/RenderThemeMac.mm:
     36        * rendering/shapes/Shape.cpp:
     37        * rendering/svg/RenderSVGContainer.cpp:
     38        * svg/SVGURIReference.h:
     39
    1402014-04-18  Gabor Rapcsanyi  <rgabor@webkit.org>
    241
  • trunk/Source/WebCore/dom/ContainerNode.h

    r166853 r167497  
    3434
    3535class FloatPoint;
     36class QualifiedName;
    3637class RenderElement;
    3738
  • trunk/Source/WebCore/dom/Document.cpp

    r167481 r167497  
    223223#include "WebReplayInputs.h"
    224224#include <replay/EmptyInputCursor.h>
     225#include <replay/InputCursor.h>
    225226#endif
    226227
     
    61896190}
    61906191
     6192#if ENABLE(WEB_REPLAY)
     6193void Document::setInputCursor(PassRefPtr<InputCursor> cursor)
     6194{
     6195    m_inputCursor = cursor;
     6196}
     6197#endif
     6198
    61916199} // namespace WebCore
  • trunk/Source/WebCore/dom/Document.h

    r166937 r167497  
    3636#include "DocumentTiming.h"
    3737#include "FocusDirection.h"
    38 #include "HitTestRequest.h"
    3938#include "IconURL.h"
    4039#include "MutationObserver.h"
    4140#include "PageVisibilityState.h"
    4241#include "PlatformScreen.h"
    43 #include "QualifiedName.h"
    4442#include "ReferrerPolicy.h"
    4543#include "RenderPtr.h"
     
    6058#include <wtf/WeakPtr.h>
    6159
     60namespace JSC {
     61class ExecState;
    6262#if ENABLE(WEB_REPLAY)
    63 #include <replay/InputCursor.h>
    64 #endif
     63class InputCursor;
     64#endif
     65}
    6566
    6667namespace WebCore {
     
    8990class DocumentParser;
    9091class DocumentSharedObjectPool;
    91 class DocumentStyleSheetCollection;
    9292class DocumentType;
    9393class Element;
     
    131131class PlatformMouseEvent;
    132132class ProcessingInstruction;
     133class QualifiedName;
    133134class Range;
    134135class RegisteredEventListener;
     
    480481
    481482#if ENABLE(WEB_REPLAY)
    482     InputCursor& inputCursor() const { return *m_inputCursor; }
    483     void setInputCursor(PassRefPtr<InputCursor> cursor) { m_inputCursor = cursor; }
     483    JSC::InputCursor& inputCursor() const { return *m_inputCursor; }
     484    void setInputCursor(PassRefPtr<JSC::InputCursor>);
    484485#endif
    485486
     
    16931694
    16941695#if ENABLE(WEB_REPLAY)
    1695     RefPtr<InputCursor> m_inputCursor;
     1696    RefPtr<JSC::InputCursor> m_inputCursor;
    16961697#endif
    16971698
  • trunk/Source/WebCore/dom/MutationObserverRegistration.cpp

    r164662 r167497  
    3434
    3535#include "Document.h"
     36#include "QualifiedName.h"
    3637
    3738namespace WebCore {
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r167196 r167497  
    4141#include "FrameLoaderClient.h"
    4242#include "FrameView.h"
     43#include "GraphicsContext.h"
    4344#include "HTMLCanvasElement.h"
    4445#include "HTMLImageElement.h"
  • trunk/Source/WebCore/page/FrameSnapshotting.cpp

    r163739 r167497  
    3636#include "FrameSelection.h"
    3737#include "FrameView.h"
     38#include "GraphicsContext.h"
    3839#include "ImageBuffer.h"
    3940#include "Page.h"
  • trunk/Source/WebCore/page/Page.cpp

    r167172 r167497  
    9696#if ENABLE(WEB_REPLAY)
    9797#include "ReplayController.h"
     98#include <replay/InputCursor.h>
    9899#endif
    99100
  • trunk/Source/WebCore/platform/DragImage.h

    r165676 r167497  
    2929#include "FloatSize.h"
    3030#include "FontRenderingMode.h"
    31 #include "FrameSnapshotting.h"
    3231#include "ImageOrientation.h"
    3332#include "IntSize.h"
  • trunk/Source/WebCore/platform/graphics/BitmapImage.cpp

    r167356 r167497  
    2929
    3030#include "FloatRect.h"
     31#include "GraphicsContext.h"
    3132#include "ImageBuffer.h"
    3233#include "ImageObserver.h"
  • trunk/Source/WebCore/platform/graphics/GradientImage.cpp

    r166582 r167497  
    2929#include "FloatRect.h"
    3030#include "GraphicsContext.h"
     31#include "ImageBuffer.h"
    3132#include "Length.h"
    3233
    3334namespace WebCore {
     35
     36GradientImage::GradientImage(PassRefPtr<Gradient> generator, const FloatSize& size)
     37    : m_gradient(generator)
     38{
     39    setContainerSize(size);
     40}
     41
     42GradientImage::~GradientImage()
     43{
     44}
    3445
    3546void GradientImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientationDescription)
  • trunk/Source/WebCore/platform/graphics/GradientImage.h

    r166582 r167497  
    3131#include "Gradient.h"
    3232#include "Image.h"
    33 #include "ImageBuffer.h"
    3433#include <wtf/RefPtr.h>
    3534
    3635namespace WebCore {
     36
     37class ImageBuffer;
    3738
    3839class GradientImage final : public GeneratedImage {
     
    4344    }
    4445
    45     virtual ~GradientImage() { }
     46    virtual ~GradientImage();
    4647
    4748protected:
     
    5051        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) override;
    5152
    52     GradientImage(PassRefPtr<Gradient> generator, const FloatSize& size)
    53         : m_gradient(generator)
    54     {
    55         setContainerSize(size);
    56     }
     53    GradientImage(PassRefPtr<Gradient>, const FloatSize&);
    5754
    5855private:
  • trunk/Source/WebCore/platform/graphics/Image.h

    r167356 r167497  
    3434#include "GraphicsTypes.h"
    3535#include "ImageOrientation.h"
    36 #include "IntRect.h"
    3736#include "NativeImagePtr.h"
    3837#include <wtf/PassRefPtr.h>
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.cpp

    r166582 r167497  
    2828#include "ImageBuffer.h"
    2929
     30#include "GraphicsContext.h"
    3031#include "IntRect.h"
    3132#include <wtf/MathExtras.h>
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.h

    r166582 r167497  
    3131#include "AffineTransform.h"
    3232#include "ColorSpace.h"
    33 #include "FloatRect.h"
    34 #include "GraphicsContext.h"
    3533#include "GraphicsTypes.h"
    3634#include "GraphicsTypes3D.h"
     
    3836#include "ImageBufferData.h"
    3937#include "PlatformLayer.h"
    40 #include <runtime/JSCInlines.h>
    41 #include <runtime/TypedArrayInlines.h>
    4238#include <runtime/Uint8ClampedArray.h>
    4339#include <wtf/Forward.h>
     
    4844namespace WebCore {
    4945
    50     class Image;
    51     class ImageData;
    52     class IntPoint;
    53     class IntRect;
    54     class GraphicsContext3D;
     46class FloatRect;
     47class GraphicsContext;
     48class GraphicsContext3D;
     49class Image;
     50class ImageData;
     51class IntPoint;
     52class IntRect;
    5553
    56     enum Multiply {
    57         Premultiplied,
    58         Unmultiplied
    59     };
     54enum Multiply {
     55    Premultiplied,
     56    Unmultiplied
     57};
    6058
    61     enum RenderingMode {
    62         Unaccelerated,
    63         UnacceleratedNonPlatformBuffer, // Use plain memory allocation rather than platform API to allocate backing store.
    64         Accelerated
    65     };
     59enum RenderingMode {
     60    Unaccelerated,
     61    UnacceleratedNonPlatformBuffer, // Use plain memory allocation rather than platform API to allocate backing store.
     62    Accelerated
     63};
     64
     65enum BackingStoreCopy {
     66    CopyBackingStore, // Guarantee subsequent draws don't affect the copy.
     67    DontCopyBackingStore // Subsequent draws may affect the copy.
     68};
     69
     70enum ScaleBehavior {
     71    Scaled,
     72    Unscaled
     73};
     74
     75class ImageBuffer {
     76    WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
     77public:
     78    // Will return a null pointer on allocation failure.
     79    static std::unique_ptr<ImageBuffer> create(const FloatSize& size, float resolutionScale = 1, ColorSpace colorSpace = ColorSpaceDeviceRGB, RenderingMode renderingMode = Unaccelerated)
     80    {
     81        bool success = false;
     82        std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, success));
     83        if (!success)
     84            return nullptr;
     85        return buffer;
     86    }
     87
     88    static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, float resolutionScale, ColorSpace, const GraphicsContext*, bool hasAlpha);
     89
     90    ~ImageBuffer();
     91
     92    // The actual resolution of the backing store
     93    const IntSize& internalSize() const { return m_size; }
     94    const IntSize& logicalSize() const { return m_logicalSize; }
     95
     96    GraphicsContext* context() const;
     97
     98    PassRefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavior = Scaled) const;
     99    // Give hints on the faster copyImage Mode, return DontCopyBackingStore if it supports the DontCopyBackingStore behavior
     100    // or return CopyBackingStore if it doesn't. 
     101    static BackingStoreCopy fastCopyImageMode();
     102
     103    enum CoordinateSystem { LogicalCoordinateSystem, BackingStoreCoordinateSystem };
     104
     105    PassRefPtr<Uint8ClampedArray> getUnmultipliedImageData(const IntRect&, CoordinateSystem = LogicalCoordinateSystem) const;
     106    PassRefPtr<Uint8ClampedArray> getPremultipliedImageData(const IntRect&, CoordinateSystem = LogicalCoordinateSystem) const;
     107
     108    void putByteArray(Multiply multiplied, Uint8ClampedArray*, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, CoordinateSystem = LogicalCoordinateSystem);
    66109   
    67     enum BackingStoreCopy {
    68         CopyBackingStore, // Guarantee subsequent draws don't affect the copy.
    69         DontCopyBackingStore // Subsequent draws may affect the copy.
    70     };
     110    void convertToLuminanceMask();
     111   
     112    String toDataURL(const String& mimeType, const double* quality = 0, CoordinateSystem = LogicalCoordinateSystem) const;
     113#if !USE(CG)
     114    AffineTransform baseTransform() const { return AffineTransform(); }
     115    void transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace);
     116    void platformTransformColorSpace(const Vector<int>&);
     117#else
     118    AffineTransform baseTransform() const { return AffineTransform(1, 0, 0, -1, 0, m_data.m_backingStoreSize.height()); }
     119#endif
     120    PlatformLayer* platformLayer() const;
    71121
    72     enum ScaleBehavior {
    73         Scaled,
    74         Unscaled
    75     };
     122    // FIXME: current implementations of this method have the restriction that they only work
     123    // with textures that are RGB or RGBA format, and UNSIGNED_BYTE type.
     124    bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool);
    76125
    77     class ImageBuffer {
    78         WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED;
    79     public:
    80         // Will return a null pointer on allocation failure.
    81         static std::unique_ptr<ImageBuffer> create(const FloatSize& size, float resolutionScale = 1, ColorSpace colorSpace = ColorSpaceDeviceRGB, RenderingMode renderingMode = Unaccelerated)
    82         {
    83             bool success = false;
    84             std::unique_ptr<ImageBuffer> buffer(new ImageBuffer(size, resolutionScale, colorSpace, renderingMode, success));
    85             if (!success)
    86                 return nullptr;
    87             return buffer;
    88         }
     126    FloatSize spaceSize() const { return m_space; }
     127    void setSpaceSize(const FloatSize& space)
     128    {
     129        m_space = space;
     130    }
    89131
    90         static std::unique_ptr<ImageBuffer> createCompatibleBuffer(const FloatSize&, float resolutionScale, ColorSpace, const GraphicsContext*, bool hasAlpha);
     132private:
     133#if USE(CG)
     134    // The returned image might be larger than the internalSize(). If you want the smaller
     135    // image, crop the result.
     136    RetainPtr<CGImageRef> copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
     137    void flushContext() const;
     138#endif
     139    void clip(GraphicsContext*, const FloatRect&) const;
    91140
    92         ~ImageBuffer();
     141    void draw(GraphicsContext*, ColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
     142    void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
    93143
    94         // The actual resolution of the backing store
    95         const IntSize& internalSize() const { return m_size; }
    96         const IntSize& logicalSize() const { return m_logicalSize; }
     144    inline void genericConvertToLuminanceMask();
    97145
    98         GraphicsContext* context() const;
     146    friend class GraphicsContext;
     147    friend class GeneratedImage;
     148    friend class CrossfadeGeneratedImage;
     149    friend class GradientImage;
    99150
    100         PassRefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, ScaleBehavior = Scaled) const;
    101         // Give hints on the faster copyImage Mode, return DontCopyBackingStore if it supports the DontCopyBackingStore behavior
    102         // or return CopyBackingStore if it doesn't. 
    103         static BackingStoreCopy fastCopyImageMode();
     151private:
     152    ImageBufferData m_data;
     153    IntSize m_size;
     154    IntSize m_logicalSize;
     155    float m_resolutionScale;
     156    OwnPtr<GraphicsContext> m_context;
     157    FloatSize m_space;
    104158
    105         enum CoordinateSystem { LogicalCoordinateSystem, BackingStoreCoordinateSystem };
    106 
    107         PassRefPtr<Uint8ClampedArray> getUnmultipliedImageData(const IntRect&, CoordinateSystem = LogicalCoordinateSystem) const;
    108         PassRefPtr<Uint8ClampedArray> getPremultipliedImageData(const IntRect&, CoordinateSystem = LogicalCoordinateSystem) const;
    109 
    110         void putByteArray(Multiply multiplied, Uint8ClampedArray*, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, CoordinateSystem = LogicalCoordinateSystem);
    111        
    112         void convertToLuminanceMask();
    113        
    114         String toDataURL(const String& mimeType, const double* quality = 0, CoordinateSystem = LogicalCoordinateSystem) const;
    115 #if !USE(CG)
    116         AffineTransform baseTransform() const { return AffineTransform(); }
    117         void transformColorSpace(ColorSpace srcColorSpace, ColorSpace dstColorSpace);
    118         void platformTransformColorSpace(const Vector<int>&);
    119 #else
    120         AffineTransform baseTransform() const { return AffineTransform(1, 0, 0, -1, 0, m_data.m_backingStoreSize.height()); }
    121 #endif
    122         PlatformLayer* platformLayer() const;
    123 
    124         // FIXME: current implementations of this method have the restriction that they only work
    125         // with textures that are RGB or RGBA format, and UNSIGNED_BYTE type.
    126         bool copyToPlatformTexture(GraphicsContext3D&, Platform3DObject, GC3Denum, bool, bool);
    127 
    128         FloatSize spaceSize() const { return m_space; }
    129         void setSpaceSize(const FloatSize& space)
    130         {
    131             m_space = space;
    132         }
    133 
    134     private:
    135 #if USE(CG)
    136         // The returned image might be larger than the internalSize(). If you want the smaller
    137         // image, crop the result.
    138         RetainPtr<CGImageRef> copyNativeImage(BackingStoreCopy = CopyBackingStore) const;
    139         void flushContext() const;
    140 #endif
    141         void clip(GraphicsContext*, const FloatRect&) const;
    142 
    143         void draw(GraphicsContext*, ColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
    144         void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
    145 
    146         inline void genericConvertToLuminanceMask();
    147 
    148         friend class GraphicsContext;
    149         friend class GeneratedImage;
    150         friend class CrossfadeGeneratedImage;
    151         friend class GradientImage;
    152 
    153     private:
    154         ImageBufferData m_data;
    155         IntSize m_size;
    156         IntSize m_logicalSize;
    157         float m_resolutionScale;
    158         OwnPtr<GraphicsContext> m_context;
    159         FloatSize m_space;
    160 
    161         // This constructor will place its success into the given out-variable
    162         // so that create() knows when it should return failure.
    163         ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, bool& success);
    164     };
     159    // This constructor will place its success into the given out-variable
     160    // so that create() knows when it should return failure.
     161    ImageBuffer(const FloatSize&, float resolutionScale, ColorSpace, RenderingMode, bool& success);
     162};
    165163
    166164#if USE(CG)
    167     String ImageDataToDataURL(const ImageData&, const String& mimeType, const double* quality);
     165String ImageDataToDataURL(const ImageData&, const String& mimeType, const double* quality);
    168166#endif
    169167
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r167145 r167497  
    6666#import <wtf/RetainPtr.h>
    6767#import <wtf/StdLibExtras.h>
     68#import <wtf/text/StringBuilder.h>
    6869#import <Carbon/Carbon.h>
    6970#import <Cocoa/Cocoa.h>
  • trunk/Source/WebCore/rendering/shapes/Shape.cpp

    r167395 r167497  
    3333#include "BasicShapeFunctions.h"
    3434#include "BoxShape.h"
     35#include "GraphicsContext.h"
    3536#include "ImageBuffer.h"
    3637#include "LengthFunctions.h"
  • trunk/Source/WebCore/rendering/svg/RenderSVGContainer.cpp

    r163440 r167497  
    2626
    2727#include "GraphicsContext.h"
     28#include "HitTestRequest.h"
    2829#include "LayoutRepainter.h"
    2930#include "RenderIterator.h"
  • trunk/Source/WebCore/svg/SVGURIReference.h

    r163440 r167497  
    2323
    2424#include "Document.h"
     25#include "QualifiedName.h"
    2526
    2627namespace WebCore {
Note: See TracChangeset for help on using the changeset viewer.