summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/css/parser/MediaQueryBlockWatcher.cpp
blob: fdceea230d04eaa4a2f2a139aef017cf699d0810 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "config.h"
#include "core/css/parser/MediaQueryBlockWatcher.h"

#include "core/css/parser/MediaQueryToken.h"

namespace WebCore {

MediaQueryBlockWatcher::MediaQueryBlockWatcher()
    : m_blockLevel(0)
{
}

void MediaQueryBlockWatcher::handleToken(const MediaQueryToken& token)
{
    if (token.blockType() == MediaQueryToken::BlockStart) {
        ++m_blockLevel;
    } else if (token.blockType() == MediaQueryToken::BlockEnd) {
        ASSERT(m_blockLevel);
        --m_blockLevel;
    }
}

} // namespace