Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2011 Kyounga Ra (kyounga.ra@gmail.com) | |
| 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | |
| 4 * Copyright (C) 2016 Samsung Electronics. All rights reserved. | |
| 5 * | |
| 6 * This library is free software; you can redistribute it and/or | |
| 7 * modify it under the terms of the GNU Library General Public | |
| 8 * License as published by the Free Software Foundation; either | |
| 9 * version 2 of the License, or (at your option) any later version. | |
| 10 * | |
| 11 * This library is distributed in the hope that it will be useful, | |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 * Library General Public License for more details. | |
| 15 * | |
| 16 * You should have received a copy of the GNU Library General Public License | |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 19 * Boston, MA 02110-1301, USA. | |
| 20 * | |
| 21 */ | |
| 22 | |
| 23 #ifndef StyleNavigationValue_h | |
| 24 #define StyleNavigationValue_h | |
| 25 | |
| 26 #include "core/style/ComputedStyleConstants.h" | |
| 27 #include "wtf/text/WTFString.h" | |
| 28 | |
| 29 namespace blink { | |
| 30 | |
| 31 class StyleNavigationValue { | |
| 32 public: | |
| 33 StyleNavigationValue() | |
| 34 : m_auto(1) | |
|
fs
2016/05/18 15:55:06
1 -> true
| |
| 35 , m_navigationTarget(Current) | |
| 36 { } | |
| 37 | |
| 38 explicit StyleNavigationValue(const String& id, ENavigationTarget target = C urrent) | |
|
fs
2016/05/18 15:55:06
Maybe make this AtomicString and then cast/et.c as
| |
| 39 : m_auto(0) | |
|
fs
2016/05/18 15:55:06
0 -> false
| |
| 40 , m_navigationTarget(target) | |
| 41 , m_id(AtomicString(id)) | |
| 42 { } | |
| 43 | |
| 44 StyleNavigationValue(const String& id, const String& target) | |
| 45 : m_auto(0) | |
|
fs
2016/05/18 15:55:06
false
| |
| 46 , m_navigationTarget(TargetName) | |
| 47 , m_id(AtomicString(id)) | |
| 48 , m_targetName(AtomicString(target)) | |
| 49 { } | |
| 50 | |
| 51 bool operator==(const StyleNavigationValue& o) const | |
| 52 { | |
| 53 if (m_auto) | |
| 54 return o.m_auto; | |
| 55 if (m_id != o.m_id) | |
| 56 return false; | |
| 57 if (m_navigationTarget == TargetName && m_targetName != o.m_targetName) | |
| 58 return false; | |
| 59 return m_navigationTarget == o.m_navigationTarget; | |
| 60 } | |
| 61 | |
| 62 bool operator!=(const StyleNavigationValue& o) const | |
| 63 { | |
| 64 return !(*this == o); | |
| 65 } | |
| 66 | |
| 67 bool isAuto() const { return m_auto; } | |
| 68 const AtomicString& id() const { return m_id; } | |
| 69 ENavigationTarget navigationTarget() { return static_cast<ENavigationTarget> (m_navigationTarget); } | |
| 70 const AtomicString& targetName() const { return m_targetName; } | |
| 71 | |
| 72 private: | |
| 73 unsigned m_auto : 1; | |
| 74 unsigned m_navigationTarget : 2; // ENavigationTarget | |
| 75 AtomicString m_id; | |
| 76 AtomicString m_targetName; | |
| 77 }; | |
| 78 | |
| 79 } // namespace blink | |
| 80 | |
| 81 #endif // StyleNavigationValue_h | |
| OLD | NEW |