2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2013 Google Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef ElementStyleResources_h
24 #define ElementStyleResources_h
26 #include "CSSPropertyNames.h"
27 #include "heap/Handle.h"
28 #include "platform/graphics/Color.h"
29 #include "wtf/HashMap.h"
30 #include "wtf/Noncopyable.h"
34 class CSSCursorImageValue;
36 class CSSImageGeneratorValue;
37 class CSSImageSetValue;
38 class CSSSVGDocumentValue;
40 class FilterOperation;
44 typedef WillBePersistentHeapHashMap<FilterOperation*, RefPtrWillBeMember<CSSSVGDocumentValue> > PendingSVGDocumentMap;
45 typedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap;
47 // Holds information about resources, requested by stylesheets.
48 // Lifetime: per-element style resolve.
49 class ElementStyleResources {
50 WTF_MAKE_NONCOPYABLE(ElementStyleResources);
52 ElementStyleResources();
54 PassRefPtr<StyleImage> styleImage(const TextLinkColors&, Color currentColor, CSSPropertyID, CSSValue*);
56 PassRefPtr<StyleImage> generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue*);
57 PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*);
58 PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue*);
59 PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*);
61 const PendingImagePropertyMap& pendingImageProperties() const { return m_pendingImageProperties; }
62 const PendingSVGDocumentMap& pendingSVGDocuments() const { return m_pendingSVGDocuments; }
64 float deviceScaleFactor() const { return m_deviceScaleFactor; }
65 void setDeviceScaleFactor(float deviceScaleFactor) { m_deviceScaleFactor = deviceScaleFactor; }
67 void addPendingSVGDocument(FilterOperation*, CSSSVGDocumentValue*);
70 PendingImagePropertyMap m_pendingImageProperties;
71 PendingSVGDocumentMap m_pendingSVGDocuments;
72 float m_deviceScaleFactor;
75 } // namespace WebCore
77 #endif // ElementStyleResources_h