1e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch/*
2e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Copyright (C) 2013 Google Inc. All rights reserved.
5e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch *
6e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * This library is free software; you can redistribute it and/or
7e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * modify it under the terms of the GNU Library General Public
8e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * License as published by the Free Software Foundation; either
9e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * version 2 of the License, or (at your option) any later version.
10e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch *
11e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * This library is distributed in the hope that it will be useful,
12e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * but WITHOUT ANY WARRANTY; without even the implied warranty of
13e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Library General Public License for more details.
15e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch *
16e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * You should have received a copy of the GNU Library General Public License
17e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * along with this library; see the file COPYING.LIB.  If not, write to
18e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch * Boston, MA 02110-1301, USA.
20e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch *
21e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch */
22e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
23e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#ifndef MediaQueryResult_h
24e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#define MediaQueryResult_h
25e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
26e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "core/css/MediaQueryExp.h"
27e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#include "wtf/Noncopyable.h"
2851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "wtf/RefCounted.h"
29e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
30c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
31e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
32d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)class MediaQueryResult : public RefCountedWillBeGarbageCollectedFinalized<MediaQueryResult> {
33d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
34e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdochpublic:
35e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    MediaQueryResult(const MediaQueryExp& expr, bool result)
36d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#if ENABLE(OILPAN)
37d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        : m_expression(&expr)
38d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#else
39e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch        : m_expression(expr)
40d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#endif
41e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch        , m_result(result)
42e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    {
43e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    }
44e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
45d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)    void trace(Visitor* visitor) { visitor->trace(m_expression); }
46d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)
47d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    const MediaQueryExp* expression() const
48d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    {
49d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#if ENABLE(OILPAN)
50d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        return m_expression;
51d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#else
52d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)        return &m_expression;
53d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#endif
54d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    }
55d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
56d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    bool result() const { return m_result; }
57d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
58d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)private:
59d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#if ENABLE(OILPAN)
60d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    Member<const MediaQueryExp> m_expression;
61d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#else
62e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    MediaQueryExp m_expression;
63d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)#endif
64e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch    bool m_result;
65e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch};
66e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
67e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch}
68e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch
69e69819bd8e388ea4ad1636a19aa6b2eed4952191Ben Murdoch#endif
70