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