| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1958 | 1958 |
| 1959 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) | 1959 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) |
| 1960 { | 1960 { |
| 1961 if (!a && b && !b->length()) | 1961 if (!a && b && !b->length()) |
| 1962 return true; | 1962 return true; |
| 1963 if (!b && a && !a->length()) | 1963 if (!b && a && !a->length()) |
| 1964 return true; | 1964 return true; |
| 1965 return equal(a, b); | 1965 return equal(a, b); |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 WTF::Unicode::Direction StringImpl::defaultWritingDirection(bool* hasStrongDirec
tionality) | |
| 1969 { | |
| 1970 for (unsigned i = 0; i < m_length; ++i) { | |
| 1971 WTF::Unicode::Direction charDirection = WTF::Unicode::direction(is8Bit()
? characters8()[i] : characters16()[i]); | |
| 1972 if (charDirection == WTF::Unicode::LeftToRight) { | |
| 1973 if (hasStrongDirectionality) | |
| 1974 *hasStrongDirectionality = true; | |
| 1975 return WTF::Unicode::LeftToRight; | |
| 1976 } | |
| 1977 if (charDirection == WTF::Unicode::RightToLeft || charDirection == WTF::
Unicode::RightToLeftArabic) { | |
| 1978 if (hasStrongDirectionality) | |
| 1979 *hasStrongDirectionality = true; | |
| 1980 return WTF::Unicode::RightToLeft; | |
| 1981 } | |
| 1982 } | |
| 1983 if (hasStrongDirectionality) | |
| 1984 *hasStrongDirectionality = false; | |
| 1985 return WTF::Unicode::LeftToRight; | |
| 1986 } | |
| 1987 | |
| 1988 size_t StringImpl::sizeInBytes() const | 1968 size_t StringImpl::sizeInBytes() const |
| 1989 { | 1969 { |
| 1990 size_t size = length(); | 1970 size_t size = length(); |
| 1991 if (!is8Bit()) | 1971 if (!is8Bit()) |
| 1992 size *= 2; | 1972 size *= 2; |
| 1993 return size + sizeof(*this); | 1973 return size + sizeof(*this); |
| 1994 } | 1974 } |
| 1995 | 1975 |
| 1996 } // namespace WTF | 1976 } // namespace WTF |
| OLD | NEW |