1591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch/* 2591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 4591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * Copyright (C) 2013 Google Inc. All rights reserved. 5591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * 6591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * This library is free software; you can redistribute it and/or 7591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * modify it under the terms of the GNU Library General Public 8591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * License as published by the Free Software Foundation; either 9591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * version 2 of the License, or (at your option) any later version. 10591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * 11591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * This library is distributed in the hope that it will be useful, 12591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * but WITHOUT ANY WARRANTY; without even the implied warranty of 13591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * Library General Public License for more details. 15591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * 16591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * You should have received a copy of the GNU Library General Public License 17591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * along with this library; see the file COPYING.LIB. If not, write to 18591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * Boston, MA 02110-1301, USA. 20591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch * 21591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch */ 22591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 23591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#ifndef ElementStyleResources_h 24591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#define ElementStyleResources_h 25591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 26591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#include "CSSPropertyNames.h" 27e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "core/platform/graphics/Color.h" 28591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#include "wtf/HashMap.h" 29e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "wtf/Noncopyable.h" 30591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 31591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochnamespace WebCore { 32591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 33e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass CSSCursorImageValue; 34e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass CSSImageValue; 35e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass CSSImageGeneratorValue; 36e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass CSSImageSetValue; 37e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass CSSSVGDocumentValue; 38e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass CSSValue; 39591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochclass FilterOperation; 40e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass StyleImage; 41e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochclass TextLinkColors; 42591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 43591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochtypedef HashMap<FilterOperation*, RefPtr<CSSSVGDocumentValue> > PendingSVGDocumentMap; 44591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochtypedef HashMap<CSSPropertyID, RefPtr<CSSValue> > PendingImagePropertyMap; 45591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 46591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch// Holds information about resources, requested by stylesheets. 47591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch// Lifetime: per-element style resolve. 48591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch// FIXME: At least for the moment, the lifetime actually matches that of StyleResolverState, 49591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch// but all data is cleared for each element resolve. We must investigate performance 50591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch// implications of matching effective and intended lifetime. 51591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochclass ElementStyleResources { 52591b958dee2cf159d33a0b931e6231072eaf38d5Ben MurdochWTF_MAKE_NONCOPYABLE(ElementStyleResources); 53591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochpublic: 54591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch ElementStyleResources(); 55591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 5683750176c3ee2cea66c8a9751271026a5901be3aBen Murdoch PassRefPtr<StyleImage> styleImage(const TextLinkColors&, CSSPropertyID, CSSValue*); 57e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 58e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch PassRefPtr<StyleImage> generatedOrPendingFromValue(CSSPropertyID, CSSImageGeneratorValue*); 59e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch PassRefPtr<StyleImage> cachedOrPendingFromValue(CSSPropertyID, CSSImageValue*); 60e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch PassRefPtr<StyleImage> setOrPendingFromValue(CSSPropertyID, CSSImageSetValue*); 61e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch PassRefPtr<StyleImage> cursorOrPendingFromValue(CSSPropertyID, CSSCursorImageValue*); 62e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch 63591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch const PendingImagePropertyMap& pendingImageProperties() const { return m_pendingImageProperties; } 64591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch const PendingSVGDocumentMap& pendingSVGDocuments() const { return m_pendingSVGDocuments; } 65591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 66591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch void setHasPendingShaders(bool hasPendingShaders) { m_hasPendingShaders = hasPendingShaders; } 67591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch bool hasPendingShaders() const { return m_hasPendingShaders; } 68591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 69591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch float deviceScaleFactor() const { return m_deviceScaleFactor; } 70591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch void setDeviceScaleFactor(float deviceScaleFactor) { m_deviceScaleFactor = deviceScaleFactor; } 71591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 72591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch void addPendingSVGDocument(FilterOperation*, CSSSVGDocumentValue*); 73591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 74591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch void clear(); 75591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 76591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdochprivate: 77591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch PendingImagePropertyMap m_pendingImageProperties; 78591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch PendingSVGDocumentMap m_pendingSVGDocuments; 79591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch bool m_hasPendingShaders; 80591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch float m_deviceScaleFactor; 81591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch}; 82591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 83591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch} // namespace WebCore 84591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch 85591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#endif // ElementStyleResources_h 86