153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)/*
253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * (C) 1999-2003 Lars Knoll (knoll@kde.org)
353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * Copyright (C) 2013 Intel Corporation. All rights reserved.
653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) *
753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * This library is free software; you can redistribute it and/or
853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * modify it under the terms of the GNU Library General Public
953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * License as published by the Free Software Foundation; either
1053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * version 2 of the License, or (at your option) any later version.
1153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) *
1253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * This library is distributed in the hope that it will be useful,
1353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * but WITHOUT ANY WARRANTY; without even the implied warranty of
1453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * Library General Public License for more details.
1653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) *
1753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * You should have received a copy of the GNU Library General Public License
1853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * along with this library; see the file COPYING.LIB.  If not, write to
1953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
2053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) * Boston, MA 02110-1301, USA.
2153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)*/
2253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
2353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#ifndef StylePropertySerializer_h
2453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#define StylePropertySerializer_h
2553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
2653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/css/CSSValueList.h"
2753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/css/StylePropertySet.h"
2853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
2953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)namespace WebCore {
3053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)class StylePropertySet;
3253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
3353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)class StylePropertySerializer {
3453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)public:
3553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    StylePropertySerializer(const StylePropertySet&);
3653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String asText() const;
3753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String getPropertyValue(CSSPropertyID) const;
3853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)private:
3953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String getCommonValue(const StylePropertyShorthand&) const;
4053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    enum CommonValueMode { OmitUncommonValues, ReturnNullOnUncommonValues };
4153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String borderPropertyValue(CommonValueMode) const;
4253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String getLayeredShorthandValue(const StylePropertyShorthand&) const;
4353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String get4Values(const StylePropertyShorthand&) const;
4453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String borderSpacingValue(const StylePropertyShorthand&) const;
4553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String getShorthandValue(const StylePropertyShorthand&) const;
4653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    String fontValue() const;
4753e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    void appendFontLonghandValueIfExplicit(CSSPropertyID, StringBuilder& result, String& value) const;
4853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
4953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)    const StylePropertySet& m_propertySet;
5053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)};
5153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
5253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)} // namespace WebCore
5353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)
5453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#endif
55