Chromium Code Reviews| Index: third_party/WebKit/Source/core/style/StyleNavigationValue.h |
| diff --git a/third_party/WebKit/Source/core/style/StyleNavigationValue.h b/third_party/WebKit/Source/core/style/StyleNavigationValue.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d33424f46b4c9294c8401ce6eba7c8e7370d627d |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/style/StyleNavigationValue.h |
| @@ -0,0 +1,81 @@ |
| +/* |
| + * Copyright (C) 2011 Kyounga Ra (kyounga.ra@gmail.com) |
| + * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| + * Copyright (C) 2016 Samsung Electronics. All rights reserved. |
| + * |
| + * This library is free software; you can redistribute it and/or |
| + * modify it under the terms of the GNU Library General Public |
| + * License as published by the Free Software Foundation; either |
| + * version 2 of the License, or (at your option) any later version. |
| + * |
| + * This library is distributed in the hope that it will be useful, |
| + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| + * Library General Public License for more details. |
| + * |
| + * You should have received a copy of the GNU Library General Public License |
| + * along with this library; see the file COPYING.LIB. If not, write to |
| + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| + * Boston, MA 02110-1301, USA. |
| + * |
| + */ |
| + |
| +#ifndef StyleNavigationValue_h |
| +#define StyleNavigationValue_h |
| + |
| +#include "core/style/ComputedStyleConstants.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +class StyleNavigationValue { |
| +public: |
| + StyleNavigationValue() |
| + : m_auto(1) |
|
fs
2016/05/18 15:55:06
1 -> true
|
| + , m_navigationTarget(Current) |
| + { } |
| + |
| + explicit StyleNavigationValue(const String& id, ENavigationTarget target = Current) |
|
fs
2016/05/18 15:55:06
Maybe make this AtomicString and then cast/et.c as
|
| + : m_auto(0) |
|
fs
2016/05/18 15:55:06
0 -> false
|
| + , m_navigationTarget(target) |
| + , m_id(AtomicString(id)) |
| + { } |
| + |
| + StyleNavigationValue(const String& id, const String& target) |
| + : m_auto(0) |
|
fs
2016/05/18 15:55:06
false
|
| + , m_navigationTarget(TargetName) |
| + , m_id(AtomicString(id)) |
| + , m_targetName(AtomicString(target)) |
| + { } |
| + |
| + bool operator==(const StyleNavigationValue& o) const |
| + { |
| + if (m_auto) |
| + return o.m_auto; |
| + if (m_id != o.m_id) |
| + return false; |
| + if (m_navigationTarget == TargetName && m_targetName != o.m_targetName) |
| + return false; |
| + return m_navigationTarget == o.m_navigationTarget; |
| + } |
| + |
| + bool operator!=(const StyleNavigationValue& o) const |
| + { |
| + return !(*this == o); |
| + } |
| + |
| + bool isAuto() const { return m_auto; } |
| + const AtomicString& id() const { return m_id; } |
| + ENavigationTarget navigationTarget() { return static_cast<ENavigationTarget>(m_navigationTarget); } |
| + const AtomicString& targetName() const { return m_targetName; } |
| + |
| +private: |
| + unsigned m_auto : 1; |
| + unsigned m_navigationTarget : 2; // ENavigationTarget |
| + AtomicString m_id; |
| + AtomicString m_targetName; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // StyleNavigationValue_h |