Skip to content

Commit

Permalink
Create a new local context class.
Browse files Browse the repository at this point in the history
CSSParserLocalContext represents local context for each property.
Currently it only has one boolean field (use_alias_parsing), but it
will be later extended to contain other info, such as whether the
property is a longhand of a shorthand.

BUG=668012

Review-Url: https://codereview.chromium.org/2901393002
Cr-Commit-Position: refs/heads/master@{#474897}
  • Loading branch information
jm318 authored and Commit bot committed May 26, 2017
1 parent 09743e5 commit b6460e2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions third_party/WebKit/Source/core/css/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,8 @@ blink_core_sources("css") {
"parser/CSSParserIdioms.h",
"parser/CSSParserImpl.cpp",
"parser/CSSParserImpl.h",
"parser/CSSParserLocalContext.cpp",
"parser/CSSParserLocalContext.h",
"parser/CSSParserMode.h",
"parser/CSSParserObserver.h",
"parser/CSSParserObserverWrapper.cpp",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2017 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 "core/css/parser/CSSParserLocalContext.h"

namespace blink {

CSSParserLocalContext::CSSParserLocalContext() : use_alias_parsing_(false) {}

CSSParserLocalContext::CSSParserLocalContext(bool use_alias_parsing)
: use_alias_parsing_(use_alias_parsing) {}

bool CSSParserLocalContext::GetUseAliasParsing() {
return use_alias_parsing_;
}

} // namespace blink
29 changes: 29 additions & 0 deletions third_party/WebKit/Source/core/css/parser/CSSParserLocalContext.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2017 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.

#ifndef CSSParserLocalContext_h
#define CSSParserLocalContext_h

#include "platform/wtf/Allocator.h"

namespace blink {

// A wrapper class containing all local context when parsing a property.
// TODO(jiameng): add info for shorthand properties into this class.

class CSSParserLocalContext {
STACK_ALLOCATED();

public:
CSSParserLocalContext();
explicit CSSParserLocalContext(bool use_alias_parsing);
bool GetUseAliasParsing();

private:
bool use_alias_parsing_;
};

} // namespace blink

#endif // CSSParserLocalContext_h

0 comments on commit b6460e2

Please sign in to comment.