1926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)/* Copyright (C) 2012 Motorola Mobility Inc. All rights reserved. 2926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 3926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * Redistribution and use in source and binary forms, with or without 4926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * modification, are permitted provided that the following conditions are 5926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * met: 6926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 7926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 1. Redistributions of source code must retain the above copyright 8926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * notice, this list of conditions and the following disclaimer. 9926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 2. Redistributions in binary form must reproduce the above 10926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer in 11926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * the documentation and/or other materials provided with the distribution. 12926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 3. Neither the name of Motorola Mobility Inc. nor the names of its 13926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * contributors may be used to endorse or promote products derived from this 14926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * software without specific prior written permission. 15926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * 16926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) */ 28926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 29926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#include "config.h" 3053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/css/CSSSupportsRule.h" 31926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 3253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/css/CSSRule.h" 3353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/css/StyleRule.h" 34591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch#include "wtf/text/StringBuilder.h" 35926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 36926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)namespace WebCore { 37926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 38926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)CSSSupportsRule::CSSSupportsRule(StyleRuleSupports* supportsRule, CSSStyleSheet* parent) 39926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) : CSSGroupingRule(supportsRule, parent) 40926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){ 41926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} 42926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 43926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)String CSSSupportsRule::cssText() const 44926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){ 45926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) StringBuilder result; 46926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 47926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) result.append("@supports "); 48926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) result.append(conditionText()); 49926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) result.append(" {\n"); 50926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) appendCssTextForItems(result); 51926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) result.append('}'); 52926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 53926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) return result.toString(); 54926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} 55926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 56926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)String CSSSupportsRule::conditionText() const 57926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){ 58926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) return toStyleRuleSupports(m_groupRule.get())->conditionText(); 59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} 60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 61926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} // namespace WebCore 62