webengine/osswebengine/WebCore/platform/graphics/svg/SVGResource.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
       
     3  *
       
     4  * Redistribution and use in source and binary forms, with or without
       
     5  * modification, are permitted provided that the following conditions
       
     6  * are met:
       
     7  * 1. Redistributions of source code must retain the above copyright
       
     8  *    notice, this list of conditions and the following disclaimer.
       
     9  * 2. Redistributions in binary form must reproduce the above copyright
       
    10  *    notice, this list of conditions and the following disclaimer in the
       
    11  *    documentation and/or other materials provided with the distribution.
       
    12  *
       
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
       
    14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
       
    15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
       
    16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
       
    17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
       
    18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
       
    19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
       
    20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
       
    21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
       
    24  */
       
    25 
       
    26 #ifndef SVGResource_h
       
    27 #define SVGResource_h
       
    28 
       
    29 #if ENABLE(SVG)
       
    30 
       
    31 #include "PlatformString.h"
       
    32 #include "Shared.h"
       
    33 #include "StringHash.h"
       
    34 
       
    35 #include <wtf/HashMap.h>
       
    36 #include <wtf/HashSet.h>
       
    37 
       
    38 namespace WebCore {
       
    39 
       
    40     class AtomicString; 
       
    41     class Document;
       
    42     class RenderPath;
       
    43     class SVGDocumentExtensions;
       
    44     class SVGStyledElement;
       
    45     class TextStream;
       
    46 
       
    47     enum SVGResourceType {
       
    48         // Painting mode
       
    49         ClipperResourceType = 0,
       
    50         MarkerResourceType = 1,
       
    51         ImageResourceType = 2,
       
    52         FilterResourceType = 3,
       
    53         MaskerResourceType = 4
       
    54     };
       
    55 
       
    56     // The SVGResource file represent various graphics resources:
       
    57     // - Filter resource
       
    58     // - Clipper resource
       
    59     // - Masker resource
       
    60     // - Marker resource
       
    61     // - Pattern resource
       
    62     // - Linear/Radial gradient resource
       
    63     //
       
    64     // SVG creates/uses these resources.
       
    65 
       
    66     class SVGResource : public Shared<SVGResource> {
       
    67     public:
       
    68         SVGResource();
       
    69         virtual ~SVGResource();
       
    70       
       
    71         virtual void invalidate();
       
    72 
       
    73         void addClient(SVGStyledElement*);
       
    74 
       
    75         void repaintClients() const;
       
    76         static void repaintClients(HashSet<SVGStyledElement*>);
       
    77 
       
    78         virtual bool isPaintServer() const { return false; }
       
    79         virtual bool isFilter() const { return false; }
       
    80         virtual bool isClipper() const { return false; }
       
    81         virtual bool isMarker() const { return false; }
       
    82         virtual bool isMasker() const { return false; }
       
    83 
       
    84         virtual TextStream& externalRepresentation(TextStream&) const;
       
    85 
       
    86     private:
       
    87         HashSet<SVGStyledElement*> m_clients;
       
    88     };
       
    89 
       
    90     SVGResource* getResourceById(Document*, const AtomicString&);
       
    91 
       
    92     TextStream& operator<<(TextStream&, const SVGResource&);
       
    93 
       
    94 } // namespace WebCore
       
    95 
       
    96 #endif
       
    97 
       
    98 #endif // SVGResource_h