+2007-01-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12174
+ improve Unicode use (less WTF::Unicode:: prefix, centralized character names)
+
+ * wtf/unicode/icu/UnicodeIcu.h: Change parameter and return types
+ to UChar32 and UChar. Removed unneeded type casts and added some
+ const to functions that lacked it. Removed WTF::Unicode::memcmp.
+ (WTF::Unicode::umemcasecmp): Renamed from strcasecmp since this
+ doesn't work on 0-terminated strings as the str functions do.
+ * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+ - got rid of namespace prefixes from most uses of WTF::Unicode
+
+ * kjs/function.cpp:
+ (KJS::isStrWhiteSpace):
+ (KJS::escapeStringForPrettyPrinting):
+ * kjs/lexer.cpp:
+ (KJS::Lexer::isWhiteSpace):
+ (KJS::Lexer::isIdentStart):
+ (KJS::Lexer::isIdentPart):
+ * kjs/string_object.cpp:
+ (KJS::StringProtoFunc::callAsFunction):
+
2007-01-07 David Kilzer <ddkilzer@webkit.org>
Reviewed by Darin.
#include <wtf/unicode/Unicode.h>
+using namespace WTF;
+using namespace Unicode;
+
namespace KJS {
// ----------------------------- FunctionImp ----------------------------------
case 0x2029:
return true;
default:
- return WTF::Unicode::isSeparatorSpace(c);
+ return isSeparatorSpace(c);
}
}
escapedString += "\\\\";
break;
default:
- if (c < 128 && WTF::Unicode::isPrintableChar(c))
+ if (c < 128 && isPrintableChar(c))
escapedString.append(c);
else {
char hexValue[7];
#include "nodes.h"
#include <wtf/unicode/Unicode.h>
-static bool isDecimalDigit(int);
+using namespace WTF;
+using namespace Unicode;
// we can't specify the namespace in yacc's C output, so do it here
using namespace KJS;
-static Lexer *currLexer = 0;
-
#ifndef KDE_USE_FINAL
#include "grammar.h"
#endif
return Lexer::curr()->lex();
}
+namespace KJS {
+
+static Lexer* currLexer = 0;
+
+static bool isDecimalDigit(int);
+
Lexer::Lexer()
: yylineno(1),
size8(128), size16(128), restrKeyword(false),
bool Lexer::isWhiteSpace() const
{
- return current == '\t' || current == 0x0b || current == 0x0c || WTF::Unicode::isSeparatorSpace(current);
+ return current == '\t' || current == 0x0b || current == 0x0c || isSeparatorSpace(current);
}
bool Lexer::isLineTerminator()
bool Lexer::isIdentStart(int c)
{
- return (WTF::Unicode::category(c) & (WTF::Unicode::Letter_Uppercase
- | WTF::Unicode::Letter_Lowercase
- | WTF::Unicode::Letter_Titlecase
- | WTF::Unicode::Letter_Modifier
- | WTF::Unicode::Letter_Other))
+ return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other))
|| c == '$' || c == '_';
}
bool Lexer::isIdentPart(int c)
{
- return (WTF::Unicode::category(c) & (WTF::Unicode::Letter_Uppercase
- | WTF::Unicode::Letter_Lowercase
- | WTF::Unicode::Letter_Titlecase
- | WTF::Unicode::Letter_Modifier
- | WTF::Unicode::Letter_Other
- | WTF::Unicode::Mark_NonSpacing
- | WTF::Unicode::Mark_SpacingCombining
- | WTF::Unicode::Number_DecimalDigit
- | WTF::Unicode::Punctuation_Connector))
+ return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
+ | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector))
|| c == '$' || c == '_';
}
strings[numStrings++] = string;
return string;
}
+
+}
#include <windows.h>
#endif
-using namespace KJS;
+using namespace WTF;
+
+namespace KJS {
// ------------------------------ StringInstance ----------------------------
uint16_t* dataPtr = reinterpret_cast<uint16_t*>(u.rep()->data());
uint16_t* destIfNeeded;
- int len = WTF::Unicode::toLower(dataPtr, u.size(), destIfNeeded);
+ int len = Unicode::toLower(dataPtr, u.size(), destIfNeeded);
if (len >= 0)
result = jsString(UString(reinterpret_cast<UChar *>(destIfNeeded ? destIfNeeded : dataPtr), len));
else
uint16_t* dataPtr = reinterpret_cast<uint16_t*>(u.rep()->data());
uint16_t* destIfNeeded;
- int len = WTF::Unicode::toUpper(dataPtr, u.size(), destIfNeeded);
+ int len = Unicode::toUpper(dataPtr, u.size(), destIfNeeded);
if (len >= 0)
result = jsString(UString(reinterpret_cast<UChar *>(destIfNeeded ? destIfNeeded : dataPtr), len));
else
return jsString(s);
}
+
+}
* This file is part of the KDE libraries
* Copyright (C) 2006 George Staikos <staikos@kde.org>
* Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007 Apple Computer, Inc. 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
Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION)
};
- inline uint32_t foldCase(uint32_t c)
+ inline UChar32 foldCase(UChar32 c)
{
return u_foldCase(c, U_FOLD_CASE_DEFAULT);
}
- inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
+ inline int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
{
UErrorCode status = U_ZERO_ERROR;
- int32_t realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
+ int realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
*error = !U_SUCCESS(status);
return realLength;
}
- inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+ inline int toLower(UChar* str, int strLength, UChar*& destIfNeeded)
{
UErrorCode err = U_ZERO_ERROR;
int resultLength;
destIfNeeded = 0;
- resultLength = u_strToLower(0, 0, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+ resultLength = u_strToLower(0, 0, str, strLength, "", &err);
if (resultLength <= strLength) {
err = U_ZERO_ERROR;
- u_strToLower(reinterpret_cast< ::UChar*>(str), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+ u_strToLower(str, resultLength, str, strLength, "", &err);
} else {
err = U_ZERO_ERROR;
- destIfNeeded = (uint16_t*)malloc(resultLength * sizeof(uint16_t));
- u_strToLower(reinterpret_cast< ::UChar*>(destIfNeeded), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+ destIfNeeded = static_cast<UChar*>(malloc(resultLength * sizeof(UChar)));
+ u_strToLower(destIfNeeded, resultLength, str, strLength, "", &err);
}
return U_FAILURE(err) ? -1 : resultLength;
}
- inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
+ inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
{
UErrorCode status = U_ZERO_ERROR;
- int32_t realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
+ int realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
*error = !!U_FAILURE(status);
return realLength;
}
- inline int32_t toLower(int32_t c)
+ inline UChar32 toLower(UChar32 c)
{
return u_tolower(c);
}
- inline int32_t toUpper(int32_t c)
+ inline UChar32 toUpper(UChar32 c)
{
return u_toupper(c);
}
- inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+ inline int toUpper(UChar* str, int strLength, UChar*& destIfNeeded)
{
UErrorCode err = U_ZERO_ERROR;
int resultLength;
destIfNeeded = 0;
- resultLength = u_strToUpper(0, 0, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+ resultLength = u_strToUpper(0, 0, str, strLength, "", &err);
if (resultLength <= strLength) {
err = U_ZERO_ERROR;
- u_strToUpper(reinterpret_cast< ::UChar*>(str), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+ u_strToUpper(str, resultLength, str, strLength, "", &err);
} else {
err = U_ZERO_ERROR;
- destIfNeeded = (uint16_t*)malloc(resultLength * sizeof(uint16_t));
- u_strToUpper(reinterpret_cast< ::UChar*>(destIfNeeded), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+ destIfNeeded = (UChar*)malloc(resultLength * sizeof(UChar));
+ u_strToUpper(destIfNeeded, resultLength, str, strLength, "", &err);
}
return U_FAILURE(err) ? -1 : resultLength;
}
- inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
+ inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
{
UErrorCode status = U_ZERO_ERROR;
- int32_t realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
+ int realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
*error = !!U_FAILURE(status);
return realLength;
}
- inline int toTitleCase (uint32_t c)
+ inline UChar32 toTitleCase(UChar32 c)
{
return u_totitle(c);
}
- inline bool isFormatChar(int32_t c)
+ inline bool isFormatChar(UChar32 c)
{
return u_charType(c) == U_FORMAT_CHAR;
}
- inline bool isSeparatorSpace(int32_t c)
+ inline bool isSeparatorSpace(UChar32 c)
{
return u_charType(c) == U_SPACE_SEPARATOR;
}
- inline bool isPrintableChar(int32_t c)
+ inline bool isPrintableChar(UChar32 c)
{
return !!u_isprint(c);
}
- inline bool isDigit(int32_t c)
+ inline bool isDigit(UChar32 c)
{
return !!u_isdigit(c);
}
- inline bool isPunct(int32_t c)
+ inline bool isPunct(UChar32 c)
{
return !!u_ispunct(c);
}
- inline int32_t mirroredChar(int32_t c)
+ inline UChar32 mirroredChar(UChar32 c)
{
return u_charMirror(c);
}
- inline CharCategory category(int32_t c)
+ inline CharCategory category(UChar32 c)
{
return static_cast<CharCategory>(U_GET_GC_MASK(c));
}
- inline Direction direction(int c) {
- return (Direction)u_charDirection(c);
+ inline Direction direction(UChar32 c)
+ {
+ return static_cast<Direction>(u_charDirection(c));
}
- inline bool isLower(int32_t c)
+ inline bool isLower(UChar32 c)
{
return !!u_islower(c);
}
- inline bool isUpper(int32_t c)
+ inline bool isUpper(UChar32 c)
{
return !!u_isUUppercase(c);
}
- inline int digitValue(int32_t c)
+ inline int digitValue(UChar32 c)
{
return u_charDigitValue(c);
}
return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
}
- inline int strcasecmp(const UChar *a, const UChar *b, int len)
+ inline int umemcasecmp(const UChar* a, const UChar* b, int len)
{
return u_memcasecmp(a, b, len, U_FOLD_CASE_DEFAULT);
}
- inline void memset(UChar* dest, UChar ch, int32_t count)
- {
- u_memset(dest, ch, count);
- }
}
}
Symbol_Other = U_MASK(QChar::Symbol_Other),
};
- inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+ inline int toLower(UChar* str, int strLength, UChar*& destIfNeeded)
{
destIfNeeded = 0;
return strLength;
}
- inline uint16_t toLower(uint16_t ch)
+ inline UChar32 toLower(UChar32 ch)
{
- return QChar(ch).toLower().unicode();
+ if (ch > 0xffff)
+ return ch;
+ return QChar((unsigned short)ch).toLower().unicode();
}
- inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
+ inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
{
*error = false;
if (resultLength < srcLength) {
result[i] = QChar(src[i]).toLower().unicode();
}
- inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+ inline int toUpper(UChar* str, int strLength, UChar*& destIfNeeded)
{
destIfNeeded = 0;
return strLength;
}
- inline uint16_t toUpper(uint16_t ch)
+ inline UChar32 toUpper(UChar32 ch)
{
- return QChar(ch).toUpper().unicode();
+ if (ch > 0xffff)
+ return ch;
+ return QChar((unsigned short)ch).toUpper().unicode();
}
inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
result[i] = QChar(src[i]).toUpper().unicode();
}
- inline int toTitleCase (uint32_t c)
+ inline int toTitleCase(UChar32 c)
{
if (c > 0xffff)
return c;
- return QChar(c).toUpper().unicode();
+ return QChar((unsigned short)c).toUpper().unicode();
}
- inline uint32_t foldCase(uint32_t c)
+ inline UChar32 foldCase(UChar32 c)
{
if (c > 0xffff)
return c;
- return QChar(c).toLower().unicode();
+ return QChar((unsigned short)c).toLower().unicode();
}
inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength, bool* error)
return toLower(result, resultLength, src, srcLength, error);
}
- inline bool isFormatChar(int32_t c)
+ inline bool isFormatChar(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Other_Format;
}
- inline bool isPrintableChar(int32_t c)
+ inline bool isPrintableChar(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint();
}
- inline bool isSeparatorSpace(int32_t c)
+ inline bool isSeparatorSpace(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Separator_Space;
}
- inline bool isPunct(int32_t c)
+ inline bool isPunct(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPunct();
}
- inline bool isDigit(int32_t c)
+ inline bool isDigit(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isDigit();
}
- inline bool isLower(int32_t c)
+ inline bool isLower(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Lowercase;
}
- inline bool isUpper(int32_t c)
+ inline bool isUpper(UChar32 c)
{
return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Uppercase;
}
- inline int digitValue(int32_t c)
+ inline int digitValue(UChar32 c)
{
if (c > 0xffff)
return 0;
return QChar(c).digitValue();
}
- inline uint16_t mirroredChar(uint16_t c)
+ inline UChar32 mirroredChar(UChar32 c)
{
+ if (c > 0xffff)
+ return c;
return QChar(c).mirroredChar().unicode();
}
return (DecompositionType)QChar(c).decompositionTag();
}
-
- inline int strcasecmp(const UChar *a, const UChar *b, int len)
+ inline int umemcasecmp(const UChar* a, const UChar* b, int len)
{
for (int i = 0; i < len; ++i) {
QChar c1 = QChar(a[i]).toLower();
return 0;
}
- inline void memset(UChar* dest, UChar ch, int32_t count)
- {
- UChar *end = dest + count;
- while (dest < end)
- *dest++ = ch;
- }
-
- inline Direction direction(int c) {
+ inline Direction direction(UChar32 c) {
if (c > 0xffff)
return LeftToRight;
return (Direction)QChar(c).direction();
}
- inline CharCategory category(int c) {
+ inline CharCategory category(UChar32 c) {
if (c > 0xffff)
return (CharCategory) U_MASK(QChar::Letter_Other);
return (CharCategory) U_MASK(QChar(c).category());
}
+
}
}
+2007-01-09 Darin Adler <darin@apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugs.webkit.org/show_bug.cgi?id=12174
+ improve Unicode use (less WTF::Unicode:: prefix, centralized character names)
+
+ - got rid of namespace prefixes from most uses of WTF::Unicode
+
+ - updated for removal of WTF::Unicode::memcmp
+ - updated for renaming of WTF::Unicode::strcasecmp to umemcasecmp.
+
+ - unified constants for special Unicode characters in a new
+ CharacterNames.h header
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/cssparser.cpp:
+ (WebCore::ParseString::lower):
+ * dom/Document.cpp:
+ (WebCore::isValidNameStart):
+ (WebCore::isValidNamePart):
+ * dom/Position.cpp:
+ (WebCore::Position::leadingWhitespacePosition):
+ (WebCore::Position::trailingWhitespacePosition):
+ * editing/CompositeEditCommand.cpp:
+ (WebCore::isWhitespace):
+ * editing/HTMLInterchange.cpp:
+ * editing/TextIterator.cpp:
+ (WebCore::CircularSearchBuffer::CircularSearchBuffer):
+ (WebCore::CircularSearchBuffer::append):
+ * editing/htmlediting.cpp:
+ (WebCore::stringWithRebalancedWhitespace):
+ (WebCore::nonBreakingSpaceString):
+ * editing/htmlediting.h:
+ * html/HTMLFontElement.cpp:
+ (WebCore::parseFontSizeNumber):
+ * html/HTMLParser.cpp:
+ (WebCore::HTMLParser::handleError):
+ * html/HTMLSelectElement.cpp:
+ (WebCore::stripLeadingWhiteSpace):
+ * platform/Font.cpp:
+ (WebCore::WidthIterator::advance):
+ (WebCore::WidthIterator::normalizeVoicingMarks):
+ * platform/GlyphMap.cpp:
+ (WebCore::GlyphMap::locatePage):
+ * platform/MimeTypeRegistry.h:
+ * platform/StringHash.h:
+ * platform/StringImpl.cpp:
+ (WebCore::isSpace):
+ (WebCore::StringImpl::append):
+ (WebCore::StringImpl::insert):
+ (WebCore::StringImpl::truncate):
+ (WebCore::StringImpl::remove):
+ (WebCore::parseLength):
+ (WebCore::StringImpl::isLower):
+ (WebCore::StringImpl::lower):
+ (WebCore::StringImpl::upper):
+ (WebCore::StringImpl::secure):
+ (WebCore::StringImpl::foldCase):
+ (WebCore::StringImpl::capitalize):t
+ (WebCore::StringImpl::toInt):
+ (WebCore::equalIgnoringCase):
+ (WebCore::StringImpl::find):
+ * platform/TextBoundaries.h:
+ * platform/TextCodec.h:
+ * platform/TextCodecLatin1.cpp:
+ * platform/TextEncoding.h:
+ * platform/TextEncodingRegistry.h:
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::writeSelection):
+ * platform/mac/TextCodecMac.cpp:
+ (WebCore::TextCodecMac::decode):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::updateFirstLetter):
+ * rendering/RenderListMarker.cpp:
+ (WebCore::listMarkerText):
+ (WebCore::RenderListMarker::paint):
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::widthFromCache):
+ (WebCore::isSpaceAccordingToStyle):
+ (WebCore::RenderText::setInternalString):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::quoteAndEscapeNonPrintables):
+ (WebCore::operator<<):
+ * rendering/bidi.cpp:
+ (WebCore::BidiState::BidiState):
+ (WebCore::BidiContext::BidiContext):
+ (WebCore::bidiNext):
+ (WebCore::bidiFirst):
+ (WebCore::BidiIterator::direction):
+ (WebCore::appendRun):
+ (WebCore::embed):
+ (WebCore::RenderBlock::bidiReorderLine):
+ (WebCore::RenderBlock::layoutInlineChildren):
+ (WebCore::skipNonBreakingSpace):
+ (WebCore::RenderBlock::findNextLineBreak):
+ * rendering/break_lines.cpp:
+ (WebCore::nextBreakablePosition):
+ * rendering/break_lines.h:
+ * xml/XPathParser.cpp:
+ (WebCore::XPath::charCat):
+
2007-01-09 Dex Deacon <occupant4@gmail.com>
Reviewed by Darin.
93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */; };
93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C09A800B064F00005ABD4D /* EventHandler.cpp */; };
93C09C860B0657AA005ABD4D /* ScrollTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C09C850B0657AA005ABD4D /* ScrollTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 93C7B5F40B52D89100B5477E /* CharacterNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C7B5F30B52D89100B5477E /* CharacterNames.h */; };
93C841F809CE855C00DFF5E5 /* DOMImplementationFront.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */; };
93C841FF09CE858300DFF5E5 /* DOMImplementationFront.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */; };
93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CCF0260AF6C52900018E89 /* NavigationAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventHandlerMac.mm; sourceTree = "<group>"; };
93C09A800B064F00005ABD4D /* EventHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventHandler.cpp; sourceTree = "<group>"; };
93C09C850B0657AA005ABD4D /* ScrollTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollTypes.h; sourceTree = "<group>"; };
+ 93C7B5F30B52D89100B5477E /* CharacterNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterNames.h; sourceTree = "<group>"; };
93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMImplementationFront.h; sourceTree = "<group>"; };
93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMImplementationFront.cpp; sourceTree = "<group>"; };
93CA4C9909DF93FA00DF8677 /* html4.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = html4.css; sourceTree = "<group>"; };
E11D51910B2E7A5F0056C188 /* Base64.h */,
E11D51920B2E7A5F0056C188 /* Base64.cpp */,
65F5382009B2B55700F3DC4A /* character-sets.txt */,
+ 93C7B5F30B52D89100B5477E /* CharacterNames.h */,
9326DC0A09DAD5BE00AFC847 /* CharsetData.h */,
BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */,
93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */,
1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */,
AA882B300B4EF5EB006D26D1 /* PointerEventsHitRules.h in Headers */,
+ 93C7B5F40B52D89100B5477E /* CharacterNames.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
extern int cssyyparse(void* parser);
using namespace std;
+using namespace WTF;
namespace WebCore {
ored |= characters[i];
if (ored & ~0x7F)
for (int i = 0; i < length; i++)
- characters[i] = WTF::Unicode::toLower(characters[i]);
+ characters[i] = Unicode::toLower(characters[i]);
else
for (int i = 0; i < length; i++)
characters[i] = tolower(characters[i]);
#endif
using namespace std;
+using namespace WTF;
+using namespace Unicode;
namespace WebCore {
// This amount of time must have elapsed before we will even consider scheduling a layout without a delay.
// FIXME: For faster machines this value can really be lowered to 200. 250 is adequate, but a little high
// for dual G5s. :)
-const int cLayoutScheduleThreshold = 250;
+static const int cLayoutScheduleThreshold = 250;
// Use 1 to represent the document's default form.
-HTMLFormElement* const defaultForm = (HTMLFormElement*) 1;
+static HTMLFormElement* const defaultForm = reinterpret_cast<HTMLFormElement*>(1);
// Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
static const unsigned PHI = 0x9e3779b9U;
return true;
// rules (a) and (f) above
- const uint32_t nameStartMask = WTF::Unicode::Letter_Lowercase |
- WTF::Unicode::Letter_Uppercase |
- WTF::Unicode::Letter_Other |
- WTF::Unicode::Letter_Titlecase |
- WTF::Unicode::Number_Letter;
- if (!(WTF::Unicode::category(c) & nameStartMask))
+ const uint32_t nameStartMask = Letter_Lowercase | Letter_Uppercase | Letter_Other | Letter_Titlecase | Number_Letter;
+ if (!(Unicode::category(c) & nameStartMask))
return false;
// rule (c) above
return false;
// rule (d) above
- WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c);
- if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat)
+ DecompositionType decompType = decompositionType(c);
+ if (decompType == DecompositionFont || decompType == DecompositionCompat)
return false;
return true;
return true;
// rules (b) and (f) above
- const uint32_t otherNamePartMask = WTF::Unicode::Mark_NonSpacing |
- WTF::Unicode::Mark_Enclosing |
- WTF::Unicode::Mark_SpacingCombining |
- WTF::Unicode::Letter_Modifier |
- WTF::Unicode::Number_DecimalDigit;
- if (!(WTF::Unicode::category(c) & otherNamePartMask))
+ const uint32_t otherNamePartMask = Mark_NonSpacing | Mark_Enclosing | Mark_SpacingCombining | Letter_Modifier | Number_DecimalDigit;
+ if (!(Unicode::category(c) & otherNamePartMask))
return false;
// rule (c) above
return false;
// rule (d) above
- WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c);
- if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat)
+ DecompositionType decompType = decompositionType(c);
+ if (decompType == DecompositionFont || decompType == DecompositionCompat)
return false;
return true;
#include "config.h"
#include "Position.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "Element.h"
#include "Logging.h"
using namespace HTMLNames;
-const UChar nonBreakingSpace = 0xa0;
-
static Node *nextRenderedEditable(Node *node)
{
while (1) {
if (prev != *this && prev.node()->inSameContainingBlockFlowElement(node()) && prev.node()->isTextNode()) {
String string = static_cast<Text *>(prev.node())->data();
UChar c = string[prev.offset()];
- if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == nonBreakingSpace) : isCollapsibleWhitespace(c))
+ if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == noBreakSpace) : isCollapsibleWhitespace(c))
return prev;
}
if (offset() < (int)textNode->length()) {
String string = textNode->data();
UChar c = string[offset()];
- if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == nonBreakingSpace) : isCollapsibleWhitespace(c))
+ if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == noBreakSpace) : isCollapsibleWhitespace(c))
return *this;
return Position();
}
if (next != *this && next.node()->inSameContainingBlockFlowElement(node()) && next.node()->isTextNode()) {
String string = static_cast<Text*>(next.node())->data();
UChar c = string[0];
- if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == nonBreakingSpace) : isCollapsibleWhitespace(c))
+ if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == noBreakSpace) : isCollapsibleWhitespace(c))
return next;
}
#include "ApplyStyleCommand.h"
#include "CSSComputedStyleDeclaration.h"
#include "CSSMutableStyleDeclaration.h"
+#include "CharacterNames.h"
#include "DeleteFromTextNodeCommand.h"
#include "DeleteSelectionCommand.h"
#include "Document.h"
#include "InsertParagraphSeparatorCommand.h"
#include "InsertTextCommand.h"
#include "JoinTextNodesCommand.h"
-#include "markup.h"
#include "MergeIdenticalElementsCommand.h"
#include "Range.h"
#include "RemoveCSSPropertyCommand.h"
#include "TextIterator.h"
#include "WrapContentsInDummySpanCommand.h"
#include "htmlediting.h"
+#include "markup.h"
#include "visible_units.h"
using namespace std;
static inline bool isWhitespace(UChar c)
{
- return c == NON_BREAKING_SPACE || c == ' ' || c == '\n' || c == '\t';
+ return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
}
// FIXME: Doesn't go into text nodes that contribute adjacent text (siblings, cousins, etc).
#include "config.h"
#include "HTMLInterchange.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "TextIterator.h"
convertedSpaceString = "<span class=\"";
convertedSpaceString += AppleConvertedSpace;
convertedSpaceString += "\">";
- convertedSpaceString += DeprecatedChar(0xa0);
+ convertedSpaceString += DeprecatedChar(noBreakSpace);
convertedSpaceString += "</span>";
}
return convertedSpaceString;
#include "config.h"
#include "TextIterator.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "Element.h"
#include "HTMLNames.h"
#include "RenderTableRow.h"
using namespace std;
+using namespace WTF::Unicode;
namespace WebCore {
using namespace HTMLNames;
-const UChar nonBreakingSpace = 0xA0;
-
// Buffer that knows how to compare with a search target.
// Keeps enough of the previous text to be able to search in the future,
// but no more.
if (!isCaseSensitive)
m_target = s.foldCase();
- m_target.replace(nonBreakingSpace, ' ');
+ m_target.replace(noBreakSpace, ' ');
m_isCaseSensitive = isCaseSensitive;
m_buffer = static_cast<UChar*>(fastMalloc(s.length() * sizeof(UChar)));
void CircularSearchBuffer::append(UChar c)
{
if (m_isCaseSensitive)
- *m_cursor++ = c == nonBreakingSpace ? ' ' : c;
+ *m_cursor++ = c == noBreakSpace ? ' ' : c;
else
- *m_cursor++ = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c);
+ *m_cursor++ = c == noBreakSpace ? ' ' : foldCase(c);
if (m_cursor == m_buffer + length()) {
m_cursor = m_buffer;
m_bufferFull = true;
if (m_isCaseSensitive) {
for (int i = 0; i != count; ++i) {
UChar c = characters[i];
- m_cursor[i] = c == nonBreakingSpace ? ' ' : c;
+ m_cursor[i] = c == noBreakSpace ? ' ' : c;
}
} else {
for (int i = 0; i != count; ++i) {
UChar c = characters[i];
- m_cursor[i] = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c);
+ m_cursor[i] = c == noBreakSpace ? ' ' : foldCase(c);
}
}
if (count < tailSpace)
#include "config.h"
#include "htmlediting.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "EditingText.h"
#include "HTMLElement.h"
DeprecatedString rebalancedString = string.copy().deprecatedString();
- rebalancedString.replace(NON_BREAKING_SPACE, ' ');
+ rebalancedString.replace(noBreakSpace, ' ');
rebalancedString.replace('\n', ' ');
rebalancedString.replace('\t', ' ');
const String& nonBreakingSpaceString()
{
- static String nonBreakingSpaceString = DeprecatedString(DeprecatedChar(NON_BREAKING_SPACE));
+ static String nonBreakingSpaceString = String(&noBreakSpace, 1);
return nonBreakingSpaceString;
}
class String;
class VisiblePosition;
-const UChar NON_BREAKING_SPACE = 0xa0;
-
Position rangeCompliantEquivalent(const Position&);
Position rangeCompliantEquivalent(const VisiblePosition&);
int maxDeepOffset(const Node*);
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
+
#include "config.h"
#include "HTMLFontElement.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
+using namespace WTF;
+
namespace WebCore {
using namespace HTMLNames;
}
// Parse a single digit.
- if (!WTF::Unicode::isDigit(s[pos]))
+ if (!Unicode::isDigit(s[pos]))
return false;
- int num = WTF::Unicode::digitValue(s[pos++]);
+ int num = Unicode::digitValue(s[pos++]);
// Check for an additional digit.
- if (WTF::Unicode::isDigit(s[pos]))
+ if (Unicode::isDigit(s[pos]))
num = 10;
if (sawPlus) {
#include "config.h"
#include "HTMLParser.h"
+#include "CharacterNames.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "Comment.h"
using namespace HTMLNames;
-const UChar nonBreakingSpace = 0xa0;
-
/**
* @internal
*/
return false;
StringImpl *i = t->string();
unsigned int pos = 0;
- while (pos < i->length() && ((*i)[pos] == ' ' || (*i)[pos] == nonBreakingSpace))
+ while (pos < i->length() && ((*i)[pos] == ' ' || (*i)[pos] == noBreakSpace))
pos++;
if (pos == i->length())
possiblyMoveStrayContent = false;
#include "config.h"
#include "HTMLSelectElement.h"
+#include "CharacterNames.h"
#include "CSSPropertyNames.h"
#include "Document.h"
#include "Event.h"
#endif
using namespace std;
+using namespace WTF;
+using namespace Unicode;
namespace WebCore {
using namespace EventNames;
using namespace HTMLNames;
+const DOMTimeStamp typeAheadTimeout = 1000;
+
HTMLSelectElement::HTMLSelectElement(Document* doc, HTMLFormElement* f)
: HTMLGenericFormElement(selectTag, doc, f)
, m_minwidth(0)
static String stripLeadingWhiteSpace(const String& string)
{
- const UChar nonBreakingSpace = 0xA0;
-
int length = string.length();
int i;
for (i = 0; i < length; ++i)
- if (string[i] != nonBreakingSpace &&
- (string[i] <= 0x7F ? !isspace(string[i]) : (WTF::Unicode::direction(string[i]) != WTF::Unicode::WhiteSpaceNeutral)))
+ if (string[i] != noBreakSpace &&
+ (string[i] <= 0x7F ? !isspace(string[i]) : (direction(string[i]) != WhiteSpaceNeutral)))
break;
return string.substring(i, length - i);
}
-const DOMTimeStamp typeAheadTimeout = 1000;
void HTMLSelectElement::typeAheadFind(KeyboardEvent* event)
{
if (event->timeStamp() < m_lastCharTime)
--- /dev/null
+/*
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CharacterNames_h
+#define CharacterNames_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+ // Names here are taken from the Unicode standard.
+
+ // Note, these are UChar constants, not UChar32, which makes them
+ // more convenient for our code that mostly uses UTF-16.
+
+ const UChar ideographicSpace = 0x3000;
+ const UChar noBreakSpace = 0x00A0;
+ const UChar bullet = 0x2022;
+ const UChar blackSquare = 0x25A0;
+ const UChar whiteBullet = 0x25E6;
+ const UChar softHyphen = 0x00AD;
+ const UChar zeroWidthSpace = 0x200B;
+
+}
+
+#endif // CharacterNames_h
#include "TextStyle.h"
#include <wtf/unicode/Unicode.h>
#include <wtf/MathExtras.h>
+
#if USE(ICU_UNICODE)
#include <unicode/unorm.h>
#endif
+using namespace WTF;
+using namespace Unicode;
+
namespace WebCore {
// According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values
if (needCharTransform) {
if (rtl)
- c = WTF::Unicode::mirroredChar(c);
+ c = mirroredChar(c);
// If small-caps, convert lowercase to upper.
- if (m_font->isSmallCaps() && !WTF::Unicode::isUpper(c)) {
- UChar32 upperC = WTF::Unicode::toUpper(c);
+ if (m_font->isSmallCaps() && !Unicode::isUpper(c)) {
+ UChar32 upperC = Unicode::toUpper(c);
if (upperC != c) {
c = upperC;
fontData = fontData->smallCapsFontData(m_font->fontDescription());
UChar32 WidthIterator::normalizeVoicingMarks(int currentCharacter)
{
if (currentCharacter + 1 < m_end) {
- if (WTF::Unicode::combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
+ if (combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
#if USE(ICU_UNICODE)
// Normalize into composed form using 3.2 rules.
UChar normalizedCharacters[2] = { 0, 0 };
#include "config.h"
#include "GlyphMap.h"
+#include "CharacterNames.h"
#include "FontData.h"
#include <wtf/unicode/Unicode.h>
namespace WebCore {
-const UChar nonBreakingSpace = 0x00A0;
-const UChar zeroWidthSpace = 0x200B;
-
GlyphData GlyphMap::glyphDataForCharacter(UChar32 c, const FontData* fontData)
{
unsigned pageNumber = (c / GlyphPage::size);
// \n, \t, and nonbreaking space must render as a space.
buffer[(int)'\n'] = ' ';
buffer[(int)'\t'] = ' ';
- buffer[nonBreakingSpace] = ' ';
+ buffer[noBreakSpace] = ' ';
}
} else {
bufferLength = GlyphPage::size * 2;
#define MimeTypeRegistry_h
#include "PlatformString.h"
-#include "wtf/HashSet.h"
#include "StringHash.h"
+#include <wtf/HashSet.h>
-namespace WebCore
-{
+namespace WebCore {
class MimeTypeRegistry {
public:
- static String getMIMETypeForExtension(const String &ext);
+ static String getMIMETypeForExtension(const String& ext);
// Check to see if a mime type is suitable for being loaded inline as an
// image (e.g., <img> tags).
- static bool isSupportedImageMIMEType(const String &mimeType);
+ static bool isSupportedImageMIMEType(const String& mimeType);
// Check to see if a mime type is suitable for being loaded as an image
// document in a frame.
- static bool isSupportedImageResourceMIMEType(const String &mimeType);
+ static bool isSupportedImageResourceMIMEType(const String& mimeType);
// Check to see if a non-image mime type is suitable for being loaded as a
// document in a frame.
- static bool isSupportedNonImageMIMEType(const String &mimeType);
+ static bool isSupportedNonImageMIMEType(const String& mimeType);
- static const HashSet<String> &getSupportedImageMIMETypes();
- static const HashSet<String> &getSupportedImageResourceMIMETypes();
- static const HashSet<String> &getSupportedNonImageMIMETypes();
+ static const HashSet<String>& getSupportedImageMIMETypes();
+ static const HashSet<String>& getSupportedImageResourceMIMETypes();
+ static const HashSet<String>& getSupportedNonImageMIMETypes();
};
}
unsigned length = a->length();
if (length != b->length())
return false;
- return WTF::Unicode::strcasecmp(a->characters(), b->characters(), length) == 0;
+ return WTF::Unicode::umemcasecmp(a->characters(), b->characters(), length) == 0;
}
};
#include "AtomicString.h"
#include "CString.h"
+#include "CharacterNames.h"
#include "DeprecatedString.h"
#include "Length.h"
#include "StringHash.h"
-#include "TextEncoding.h"
#include "TextBreakIterator.h"
+#include "TextEncoding.h"
#include <kjs/dtoa.h>
#include <kjs/identifier.h>
#include <wtf/Assertions.h>
#include <wtf/unicode/Unicode.h>
-#include <assert.h>
using namespace WTF;
+using namespace Unicode;
using KJS::Identifier;
using KJS::UString;
namespace WebCore {
-const UChar nonBreakingSpace = 0xA0;
-
static inline bool isSpace(UChar c)
{
// Use isspace() for basic Latin-1.
// This will include newlines, which aren't included in unicode DirWS.
- return c <= 0x7F ? isspace(c) : Unicode::direction(c) == Unicode::WhiteSpaceNeutral;
+ return c <= 0x7F ? isspace(c) : direction(c) == WhiteSpaceNeutral;
}
static inline UChar* newUCharVector(unsigned n)
void StringImpl::append(UChar c)
{
- assert(!m_inTable);
+ ASSERT(!m_inTable);
UChar* nc = newUCharVector(m_length + 1);
memcpy(nc, m_data, m_length * sizeof(UChar));
nc[m_length] = c;
void StringImpl::insert(const UChar* str, unsigned length, unsigned pos)
{
- assert(!m_inTable);
+ ASSERT(!m_inTable);
if (pos >= m_length) {
append(str, length);
return;
void StringImpl::truncate(int len)
{
- assert(!m_inTable);
+ ASSERT(!m_inTable);
if (len >= (int)m_length)
return;
int nl = len < 1 ? 1 : len;
void StringImpl::remove(unsigned pos, int len)
{
- assert(!m_inTable);
+ ASSERT(!m_inTable);
if (len <= 0)
return;
if (pos >= m_length)
++i;
if (i < m_length && (m_data[i] == '+' || m_data[i] == '-'))
++i;
- while (i < m_length && WTF::Unicode::isDigit(m_data[i]))
+ while (i < m_length && Unicode::isDigit(m_data[i]))
++i;
bool ok;
int r = DeprecatedConstString(reinterpret_cast<const DeprecatedChar*>(m_data), i).string().toInt(&ok);
/* Skip over any remaining digits, we are not that accurate (5.5% => 5%) */
- while (i < m_length && (WTF::Unicode::isDigit(m_data[i]) || m_data[i] == '.'))
+ while (i < m_length && (Unicode::isDigit(m_data[i]) || m_data[i] == '.'))
++i;
/* IE Quirk: Skip any whitespace (20 % => 20%) */
// Do a slower check for the other cases.
bool allLower2 = true;
for (unsigned i = 0; i < m_length; i++)
- allLower2 &= WTF::Unicode::isLower(m_data[i]);
+ allLower2 &= Unicode::isLower(m_data[i]);
return allLower2;
}
return c;
bool error;
- int32_t realLength = WTF::Unicode::toLower(data, length, m_data, m_length, &error);
+ int32_t realLength = Unicode::toLower(data, length, m_data, m_length, &error);
if (!error && realLength == length)
return c;
c->m_data = data;
c->m_length = length;
- WTF::Unicode::toLower(data, length, m_data, m_length, &error);
+ Unicode::toLower(data, length, m_data, m_length, &error);
if (error) {
c->ref();
c->deref();
if (!m_length)
return c;
bool error;
- int32_t length = WTF::Unicode::toUpper(0, 0, m_data, m_length, &error);
+ int32_t length = Unicode::toUpper(0, 0, m_data, m_length, &error);
c->m_data = newUCharVector(length);
c->m_length = length;
- WTF::Unicode::toUpper(c->m_data, length, m_data, m_length, &error);
+ Unicode::toUpper(c->m_data, length, m_data, m_length, &error);
if (error) {
c->ref();
c->deref();
StringImpl* StringImpl::secure(UChar aChar) const
{
- StringImpl* c= new StringImpl;
- c->m_data = newUCharVector(c->m_length= m_length);
-
- WTF::Unicode::memset(c->m_data, aChar, m_length);
-
+ int length = m_length;
+ UChar* data = newUCharVector(length);
+ for (int i = 0; i < length; ++i)
+ data[i] = aChar;
+
+ StringImpl* c = new StringImpl;
+ c->m_data = data;
+ c->m_length = length;
return c;
}
if (!m_length)
return c;
bool error;
- int32_t length = WTF::Unicode::foldCase(0, 0, m_data, m_length, &error);
+ int32_t length = Unicode::foldCase(0, 0, m_data, m_length, &error);
c->m_data = newUCharVector(length);
c->m_length = length;
- WTF::Unicode::foldCase(c->m_data, length, m_data, m_length, &error);
+ Unicode::foldCase(c->m_data, length, m_data, m_length, &error);
if (error) {
c->ref();
c->deref();
return capitalizedString;
UChar* stringWithPrevious = newUCharVector(m_length + 1);
- stringWithPrevious[0] = previous == nonBreakingSpace ? ' ' : previous;
+ stringWithPrevious[0] = previous == noBreakSpace ? ' ' : previous;
for (unsigned i = 1; i < m_length + 1; i++) {
// Replace   with a real space since ICU no longer treats   as a word separator.
- if (m_data[i - 1] == nonBreakingSpace)
+ if (m_data[i - 1] == noBreakSpace)
stringWithPrevious[i] = ' ';
else
stringWithPrevious[i] = m_data[i - 1];
int32_t startOfWord = textBreakFirst(boundary);
for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) {
if (startOfWord != 0) // Ignore first char of previous string
- capitalizedString->m_data[startOfWord - 1] = m_data[startOfWord - 1] == nonBreakingSpace ? nonBreakingSpace : WTF::Unicode::toTitleCase(stringWithPrevious[startOfWord]);
+ capitalizedString->m_data[startOfWord - 1] = m_data[startOfWord - 1] == noBreakSpace ? noBreakSpace : toTitleCase(stringWithPrevious[startOfWord]);
for (int i = startOfWord + 1; i < endOfWord; i++)
capitalizedString->m_data[i - 1] = m_data[i - 1];
}
// Allow digits.
for (; i != m_length; ++i)
- if (!WTF::Unicode::isDigit(m_data[i]))
+ if (!Unicode::isDigit(m_data[i]))
break;
return DeprecatedConstString(reinterpret_cast<const DeprecatedChar*>(m_data), i).string().toInt(ok);
ASSERT(length >= 0);
while (length--) {
unsigned char bc = *b++;
- if (WTF::Unicode::foldCase(*a++) != WTF::Unicode::foldCase(bc))
+ if (foldCase(*a++) != foldCase(bc))
return false;
}
return true;
static inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
{
ASSERT(length >= 0);
- return WTF::Unicode::strcasecmp(a, b, length) == 0;
+ return umemcasecmp(a, b, length) == 0;
}
// This function should be as fast as possible, every little bit helps.
return m_length - chsLength - n + 1;
} while (--n);
} else {
- UChar lc = WTF::Unicode::foldCase(*chs);
+ UChar lc = Unicode::foldCase(*chs);
do {
- if (WTF::Unicode::foldCase(*++ptr) == lc
- && equalIgnoringCase(ptr + 1, chsPlusOne, chsLengthMinusOne))
+ if (Unicode::foldCase(*++ptr) == lc && equalIgnoringCase(ptr + 1, chsPlusOne, chsLengthMinusOne))
return m_length - chsLength - n + 1;
} while (--n);
}
equal = true;
for (unsigned i = 0; i != length; ++i) {
unsigned char bc = b[i];
- equal &= WTF::Unicode::foldCase(as[i]) == WTF::Unicode::foldCase(bc);
+ equal &= foldCase(as[i]) == foldCase(bc);
}
}
#ifndef TextBoundaries_h
#define TextBoundaries_h
-#include "wtf/unicode/Unicode.h"
+#include <wtf/unicode/Unicode.h>
namespace WebCore {
#ifndef TextCodec_h
#define TextCodec_h
-#include "wtf/unicode/Unicode.h"
#include <memory>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
namespace WebCore {
#include "CString.h"
#include "PlatformString.h"
-#include "wtf/unicode/Unicode.h"
using std::auto_ptr;
#ifndef TextEncoding_h
#define TextEncoding_h
-#include "wtf/unicode/Unicode.h"
+#include <wtf/unicode/Unicode.h>
namespace WebCore {
#ifndef TextEncodingRegistry_h
#define TextEncodingRegistry_h
-#include "wtf/unicode/Unicode.h"
#include <memory>
+#include <wtf/unicode/Unicode.h>
namespace WebCore {
#import "config.h"
#import "Pasteboard.h"
+#import "CharacterNames.h"
#import "DOMRangeInternal.h"
#import "DocumentFragment.h"
#import "Editor.h"
text.replace('\\', frame->backslashAsCurrencySymbol());
NSMutableString *s = [[[(NSString*)text copy] autorelease] mutableCopy];
- const unichar NonBreakingSpaceCharacter = 0xA0;
- NSString *NonBreakingSpaceString = [NSString stringWithCharacters:&NonBreakingSpaceCharacter length:1];
+ NSString *NonBreakingSpaceString = [NSString stringWithCharacters:&noBreakSpace length:1];
[s replaceOccurrencesOfString:NonBreakingSpaceString withString:@" " options:0 range:NSMakeRange(0, [s length])];
[m_pasteboard setString:s forType:NSStringPboardType];
[s release];
#include "config.h"
#include "TextCodecMac.h"
-#include "CharsetData.h"
#include "CString.h"
+#include "CharacterNames.h"
+#include "CharsetData.h"
#include "PlatformString.h"
#include <wtf/Assertions.h>
// But GB18030 decodes it to U+E5E5, which is correct in theory but not in practice.
// To work around, just change all occurences of U+E5E5 to U+3000 (ideographic space).
if (m_encoding == kCFStringEncodingGB_18030_2000)
- resultString.replace(0xE5E5, 0x3000);
+ resultString.replace(0xE5E5, ideographicSpace);
return resultString;
}
#include "TextStream.h"
using namespace std;
+using namespace WTF;
+using namespace Unicode;
namespace WebCore {
unsigned int length = 0;
// account for leading spaces and punctuation
- while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || WTF::Unicode::isPunct((*oldText)[length])))
+ while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || Unicode::isPunct((*oldText)[length])))
length++;
// account for first letter
#include "RenderListMarker.h"
#include "CachedImage.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "GraphicsContext.h"
#include "ListMarkerBox.h"
#include "RenderView.h"
using namespace std;
-namespace Unicode = WTF::Unicode;
+using namespace WTF;
+using namespace Unicode;
namespace WebCore {
// We use the same characters for text security.
// See RenderText::setInternalString.
- case CIRCLE: {
- const UChar whiteBullet = 0x25E6;
+ case CIRCLE:
return String(&whiteBullet, 1);
- }
- case DISC: {
- const UChar bullet = 0x2022;
+ case DISC:
return String(&bullet, 1);
- }
- case SQUARE: {
+ case SQUARE:
// The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE
// instead, but I think this looks better.
- const UChar blackSquare = 0x25A0;
return String(&blackSquare, 1);
- }
case LDECIMAL:
return String::number(value);
// Text is not arbitrary. We can judge whether it's RTL from the first character,
// and we only need to handle the direction RightToLeft for now.
- bool textNeedsReversing = Unicode::direction(m_text[0]) == Unicode::RightToLeft;
+ bool textNeedsReversing = direction(m_text[0]) == RightToLeft;
Vector<UChar> reversedText;
if (textNeedsReversing) {
int length = m_text.length();
#include "config.h"
#include "RenderText.h"
+#include "CharacterNames.h"
#include "InlineTextBox.h"
#include "Range.h"
#include "RenderArena.h"
#include <wtf/AlwaysInline.h>
using namespace std;
+using namespace WTF;
+using namespace Unicode;
namespace WebCore {
int w = 0;
for (i = start; i < start + len; i++) {
UChar c = (*m_str)[i];
- WTF::Unicode::Direction dir = WTF::Unicode::direction(c);
- if (dir != WTF::Unicode::NonSpacingMark && dir != WTF::Unicode::BoundaryNeutral) {
+ Direction dir = direction(c);
+ if (dir != NonSpacingMark && dir != BoundaryNeutral) {
if (c == '\t' && tabWidth)
w += tabWidth - ((xPos + w) % tabWidth);
else
inline bool isSpaceAccordingToStyle(UChar c, RenderStyle* style)
{
- return c == ' ' || (c == 0xa0 && style->nbspMode() == SPACE);
+ return c == ' ' || (c == noBreakSpace && style->nbspMode() == SPACE);
}
void RenderText::calcMinMaxWidth(int leadWidth)
switch (style()->textSecurity()) {
case TSNONE:
break;
- case TSCIRCLE: {
- const UChar whiteBullet = 0x25E6;
+ case TSCIRCLE:
m_str = m_str->secure(whiteBullet);
break;
- }
- case TSDISC: {
- const UChar bullet = 0x2022;
+ case TSDISC:
m_str = m_str->secure(bullet);
break;
- }
- case TSSQUARE: {
- const UChar blackSquare = 0x25A0;
+ case TSSQUARE:
m_str = m_str->secure(blackSquare);
- break;
- }
}
}
}
#include "config.h"
#include "RenderTreeAsText.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "Frame.h"
#include "FrameView.h"
} else if (c == '"') {
result.append('\\');
result.append('"');
- } else if (c == '\n' || c == 0x00A0)
+ } else if (c == '\n' || c == noBreakSpace)
result.append(' ');
else {
if (c >= 0x20 && c < 0x7F)
text = quoteAndEscapeNonPrintables(text);
else {
switch (text[0]) {
- case 0x2022:
+ case bullet:
text = "bullet";
break;
- case 0x25A0:
+ case blackSquare:
text = "black square";
break;
- case 0x25E6:
+ case whiteBullet:
text = "white bullet";
break;
default:
#include "config.h"
#include "bidi.h"
+#include "CharacterNames.h"
#include "Document.h"
#include "Element.h"
#include "FrameView.h"
#include <wtf/Vector.h>
using namespace std;
+using namespace WTF;
+using namespace Unicode;
namespace WebCore {
bool atEnd() const;
UChar current() const;
- WTF::Unicode::Direction direction() const;
+ Direction direction() const;
RenderBlock* block;
RenderObject* obj;
};
struct BidiState {
- BidiState() : context(0), dir(WTF::Unicode::OtherNeutral), adjustEmbedding(false), reachedEndOfLine(false) {}
+ BidiState() : context(0), dir(OtherNeutral), adjustEmbedding(false), reachedEndOfLine(false) {}
BidiIterator sor;
BidiIterator eor;
BidiIterator current;
RefPtr<BidiContext> context;
BidiStatus status;
- WTF::Unicode::Direction dir;
+ Direction dir;
bool adjustEmbedding;
BidiIterator endOfLine;
bool reachedEndOfLine;
static bool emptyRun = true;
static int numSpaces;
-static void embed(WTF::Unicode::Direction, BidiState&);
+static void embed(Direction, BidiState&);
static void appendRun(BidiState&);
static int getBPMWidth(int childValue, Length cssUnit)
Each line of text caches the embedding level at the start of the line for faster
relayouting
*/
-BidiContext::BidiContext(unsigned char l, WTF::Unicode::Direction e, BidiContext *p, bool o)
+BidiContext::BidiContext(unsigned char l, Direction e, BidiContext *p, bool o)
: level(l), override(o), m_dir(e)
{
parent = p;
EUnicodeBidi ub = next->style()->unicodeBidi();
if (ub != UBNormal) {
TextDirection dir = next->style()->direction();
- WTF::Unicode::Direction d = (ub == Embed
- ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
- : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+ Direction d = (ub == Embed
+ ? (dir == RTL ? RightToLeftEmbedding : LeftToRightEmbedding)
+ : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
embed(d, bidi);
}
}
while (current && current != block) {
if (bidi.adjustEmbedding && current->isInlineFlow() && current->style()->unicodeBidi() != UBNormal)
- embed(WTF::Unicode::PopDirectionalFormat, bidi);
+ embed(PopDirectionalFormat, bidi);
next = current->nextSibling();
if (next) {
EUnicodeBidi ub = next->style()->unicodeBidi();
if (ub != UBNormal) {
TextDirection dir = next->style()->direction();
- WTF::Unicode::Direction d = (ub == Embed
- ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding: WTF::Unicode::LeftToRightEmbedding)
- : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+ Direction d = (ub == Embed
+ ? (dir == RTL ? RightToLeftEmbedding: LeftToRightEmbedding)
+ : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
embed(d, bidi);
}
}
EUnicodeBidi ub = o->style()->unicodeBidi();
if (ub != UBNormal) {
TextDirection dir = o->style()->direction();
- WTF::Unicode::Direction d = (ub == Embed
- ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
- : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+ Direction d = (ub == Embed
+ ? (dir == RTL ? RightToLeftEmbedding : LeftToRightEmbedding)
+ : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
embed(d, bidi);
}
}
return text->text()[pos];
}
-ALWAYS_INLINE WTF::Unicode::Direction BidiIterator::direction() const
+ALWAYS_INLINE Direction BidiIterator::direction() const
{
if (!obj)
- return WTF::Unicode::OtherNeutral;
+ return OtherNeutral;
if (obj->isListMarker())
- return obj->style()->direction() == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
+ return obj->style()->direction() == LTR ? LeftToRight : RightToLeft;
if (!obj->isText())
- return WTF::Unicode::OtherNeutral;
+ return OtherNeutral;
RenderText* renderTxt = static_cast<RenderText*>(obj);
if (pos >= renderTxt->stringLength())
- return WTF::Unicode::OtherNeutral;
- return WTF::Unicode::direction(renderTxt->text()[pos]);
+ return OtherNeutral;
+ return Unicode::direction(renderTxt->text()[pos]);
}
// -------------------------------------------------------------------------------------------------
bidi.eor.increment(bidi);
bidi.sor = bidi.eor;
- bidi.dir = WTF::Unicode::OtherNeutral;
- bidi.status.eor = WTF::Unicode::OtherNeutral;
+ bidi.dir = OtherNeutral;
+ bidi.status.eor = OtherNeutral;
bidi.adjustEmbedding = b;
}
-static void embed(WTF::Unicode::Direction d, BidiState& bidi)
+static void embed(Direction d, BidiState& bidi)
{
bool b = bidi.adjustEmbedding;
bidi.adjustEmbedding = false;
- if (d == WTF::Unicode::PopDirectionalFormat) {
+ if (d == PopDirectionalFormat) {
BidiContext *c = bidi.context->parent;
if (c) {
if (!emptyRun && bidi.eor != bidi.last) {
- assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
+ assert(bidi.status.eor != OtherNeutral);
// bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
- assert(bidi.status.last == WTF::Unicode::EuropeanNumberSeparator
- || bidi.status.last == WTF::Unicode::EuropeanNumberTerminator
- || bidi.status.last == WTF::Unicode::CommonNumberSeparator
- || bidi.status.last == WTF::Unicode::BoundaryNeutral
- || bidi.status.last == WTF::Unicode::BlockSeparator
- || bidi.status.last == WTF::Unicode::SegmentSeparator
- || bidi.status.last == WTF::Unicode::WhiteSpaceNeutral
- || bidi.status.last == WTF::Unicode::OtherNeutral);
- if (bidi.dir == WTF::Unicode::OtherNeutral)
+ assert(bidi.status.last == EuropeanNumberSeparator
+ || bidi.status.last == EuropeanNumberTerminator
+ || bidi.status.last == CommonNumberSeparator
+ || bidi.status.last == BoundaryNeutral
+ || bidi.status.last == BlockSeparator
+ || bidi.status.last == SegmentSeparator
+ || bidi.status.last == WhiteSpaceNeutral
+ || bidi.status.last == OtherNeutral);
+ if (bidi.dir == OtherNeutral)
bidi.dir = bidi.context->dir();
- if (bidi.context->dir() == WTF::Unicode::LeftToRight) {
+ if (bidi.context->dir() == LeftToRight) {
// bidi.sor ... bidi.eor ... bidi.last L
- if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
- if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
- bidi.dir = WTF::Unicode::EuropeanNumber;
+ if (bidi.status.eor == EuropeanNumber) {
+ if (bidi.status.lastStrong != LeftToRight) {
+ bidi.dir = EuropeanNumber;
appendRun(bidi);
}
- } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
- bidi.dir = WTF::Unicode::ArabicNumber;
+ } else if (bidi.status.eor == ArabicNumber) {
+ bidi.dir = ArabicNumber;
appendRun(bidi);
- } else if (bidi.status.eor != WTF::Unicode::LeftToRight)
+ } else if (bidi.status.eor != LeftToRight)
appendRun(bidi);
- } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic)
+ } else if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic)
appendRun(bidi);
bidi.eor = bidi.last;
}
bidi.eor.obj = 0;
}
} else {
- WTF::Unicode::Direction runDir;
- if (d == WTF::Unicode::RightToLeftEmbedding || d == WTF::Unicode::RightToLeftOverride)
- runDir = WTF::Unicode::RightToLeft;
+ Direction runDir;
+ if (d == RightToLeftEmbedding || d == RightToLeftOverride)
+ runDir = RightToLeft;
else
- runDir = WTF::Unicode::LeftToRight;
- bool override = d == WTF::Unicode::LeftToRightOverride || d == WTF::Unicode::RightToLeftOverride;
+ runDir = LeftToRight;
+ bool override = d == LeftToRightOverride || d == RightToLeftOverride;
unsigned char level = bidi.context->level;
- if (runDir == WTF::Unicode::RightToLeft) {
+ if (runDir == RightToLeft) {
if (level%2) // we have an odd level
level += 2;
else
if (level < 61) {
if (!emptyRun && bidi.eor != bidi.last) {
- assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
+ assert(bidi.status.eor != OtherNeutral);
// bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
- assert(bidi.status.last == WTF::Unicode::EuropeanNumberSeparator
- || bidi.status.last == WTF::Unicode::EuropeanNumberTerminator
- || bidi.status.last == WTF::Unicode::CommonNumberSeparator
- || bidi.status.last == WTF::Unicode::BoundaryNeutral
- || bidi.status.last == WTF::Unicode::BlockSeparator
- || bidi.status.last == WTF::Unicode::SegmentSeparator
- || bidi.status.last == WTF::Unicode::WhiteSpaceNeutral
- || bidi.status.last == WTF::Unicode::OtherNeutral);
- if (bidi.dir == WTF::Unicode::OtherNeutral)
+ assert(bidi.status.last == EuropeanNumberSeparator
+ || bidi.status.last == EuropeanNumberTerminator
+ || bidi.status.last == CommonNumberSeparator
+ || bidi.status.last == BoundaryNeutral
+ || bidi.status.last == BlockSeparator
+ || bidi.status.last == SegmentSeparator
+ || bidi.status.last == WhiteSpaceNeutral
+ || bidi.status.last == OtherNeutral);
+ if (bidi.dir == OtherNeutral)
bidi.dir = runDir;
- if (runDir == WTF::Unicode::LeftToRight) {
+ if (runDir == LeftToRight) {
// bidi.sor ... bidi.eor ... bidi.last L
- if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
- if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
- bidi.dir = WTF::Unicode::EuropeanNumber;
+ if (bidi.status.eor == EuropeanNumber) {
+ if (bidi.status.lastStrong != LeftToRight) {
+ bidi.dir = EuropeanNumber;
appendRun(bidi);
- if (bidi.context->dir() != WTF::Unicode::LeftToRight)
- bidi.dir = WTF::Unicode::RightToLeft;
+ if (bidi.context->dir() != LeftToRight)
+ bidi.dir = RightToLeft;
}
- } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
- bidi.dir = WTF::Unicode::ArabicNumber;
+ } else if (bidi.status.eor == ArabicNumber) {
+ bidi.dir = ArabicNumber;
appendRun(bidi);
- if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
+ if (bidi.context->dir() != LeftToRight) {
bidi.eor = bidi.last;
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
appendRun(bidi);
}
- } else if (bidi.status.eor != WTF::Unicode::LeftToRight) {
- if (bidi.context->dir() == WTF::Unicode::LeftToRight || bidi.status.lastStrong == WTF::Unicode::LeftToRight)
+ } else if (bidi.status.eor != LeftToRight) {
+ if (bidi.context->dir() == LeftToRight || bidi.status.lastStrong == LeftToRight)
appendRun(bidi);
else
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
}
- } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
+ } else if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic) {
// bidi.sor ... bidi.eor ... bidi.last R; bidi.eor=L/EN/AN; EN,AN behave like R (rule N1)
- if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic)
+ if (bidi.context->dir() == RightToLeft || bidi.status.lastStrong == RightToLeft || bidi.status.lastStrong == RightToLeftArabic)
appendRun(bidi);
else
- bidi.dir = WTF::Unicode::LeftToRight;
+ bidi.dir = LeftToRight;
}
bidi.eor = bidi.last;
}
sLastBidiRun = 0;
sBidiRunCount = 0;
- assert(bidi.dir == WTF::Unicode::OtherNeutral);
+ assert(bidi.dir == OtherNeutral);
emptyRun = true;
BidiState stateAtEnd;
while (true) {
- WTF::Unicode::Direction dirCurrent;
+ Direction dirCurrent;
if (pastEnd && (previousLineBrokeCleanly || bidi.current.atEnd())) {
BidiContext *c = bidi.context.get();
while (c->parent)
} else {
dirCurrent = bidi.current.direction();
if (bidi.context->override
- && dirCurrent != WTF::Unicode::RightToLeftEmbedding
- && dirCurrent != WTF::Unicode::LeftToRightEmbedding
- && dirCurrent != WTF::Unicode::RightToLeftOverride
- && dirCurrent != WTF::Unicode::LeftToRightOverride
- && dirCurrent != WTF::Unicode::PopDirectionalFormat)
+ && dirCurrent != RightToLeftEmbedding
+ && dirCurrent != LeftToRightEmbedding
+ && dirCurrent != RightToLeftOverride
+ && dirCurrent != LeftToRightOverride
+ && dirCurrent != PopDirectionalFormat)
dirCurrent = bidi.context->dir();
- else if (dirCurrent == WTF::Unicode::NonSpacingMark)
+ else if (dirCurrent == NonSpacingMark)
dirCurrent = bidi.status.last;
}
- assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
+ assert(bidi.status.eor != OtherNeutral);
switch (dirCurrent) {
// embedding and overrides (X1-X9 in the Bidi specs)
- case WTF::Unicode::RightToLeftEmbedding:
- case WTF::Unicode::LeftToRightEmbedding:
- case WTF::Unicode::RightToLeftOverride:
- case WTF::Unicode::LeftToRightOverride:
- case WTF::Unicode::PopDirectionalFormat:
+ case RightToLeftEmbedding:
+ case LeftToRightEmbedding:
+ case RightToLeftOverride:
+ case LeftToRightOverride:
+ case PopDirectionalFormat:
embed(dirCurrent, bidi);
break;
// strong types
- case WTF::Unicode::LeftToRight:
+ case LeftToRight:
switch(bidi.status.last) {
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::RightToLeftArabic:
- case WTF::Unicode::EuropeanNumber:
- case WTF::Unicode::ArabicNumber:
- if (bidi.status.last != WTF::Unicode::EuropeanNumber || bidi.status.lastStrong != WTF::Unicode::LeftToRight)
+ case RightToLeft:
+ case RightToLeftArabic:
+ case EuropeanNumber:
+ case ArabicNumber:
+ if (bidi.status.last != EuropeanNumber || bidi.status.lastStrong != LeftToRight)
appendRun(bidi);
break;
- case WTF::Unicode::LeftToRight:
+ case LeftToRight:
break;
- case WTF::Unicode::EuropeanNumberSeparator:
- case WTF::Unicode::EuropeanNumberTerminator:
- case WTF::Unicode::CommonNumberSeparator:
- case WTF::Unicode::BoundaryNeutral:
- case WTF::Unicode::BlockSeparator:
- case WTF::Unicode::SegmentSeparator:
- case WTF::Unicode::WhiteSpaceNeutral:
- case WTF::Unicode::OtherNeutral:
- if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
- if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
+ case EuropeanNumberSeparator:
+ case EuropeanNumberTerminator:
+ case CommonNumberSeparator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (bidi.status.eor == EuropeanNumber) {
+ if (bidi.status.lastStrong != LeftToRight) {
// the numbers need to be on a higher embedding level, so let's close that run
- bidi.dir = WTF::Unicode::EuropeanNumber;
+ bidi.dir = EuropeanNumber;
appendRun(bidi);
- if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
+ if (bidi.context->dir() != LeftToRight) {
// the neutrals take the embedding direction, which is R
bidi.eor = bidi.last;
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
appendRun(bidi);
}
}
- } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
+ } else if (bidi.status.eor == ArabicNumber) {
// Arabic numbers are always on a higher embedding level, so let's close that run
- bidi.dir = WTF::Unicode::ArabicNumber;
+ bidi.dir = ArabicNumber;
appendRun(bidi);
- if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
+ if (bidi.context->dir() != LeftToRight) {
// the neutrals take the embedding direction, which is R
bidi.eor = bidi.last;
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
appendRun(bidi);
}
- } else if(bidi.status.eor != WTF::Unicode::LeftToRight) {
+ } else if(bidi.status.eor != LeftToRight) {
//last stuff takes embedding dir
- if (bidi.context->dir() != WTF::Unicode::LeftToRight && bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
+ if (bidi.context->dir() != LeftToRight && bidi.status.lastStrong != LeftToRight) {
bidi.eor = bidi.last;
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
}
appendRun(bidi);
}
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = WTF::Unicode::LeftToRight;
- bidi.status.lastStrong = WTF::Unicode::LeftToRight;
- bidi.dir = WTF::Unicode::LeftToRight;
+ bidi.status.eor = LeftToRight;
+ bidi.status.lastStrong = LeftToRight;
+ bidi.dir = LeftToRight;
break;
- case WTF::Unicode::RightToLeftArabic:
- case WTF::Unicode::RightToLeft:
+ case RightToLeftArabic:
+ case RightToLeft:
switch (bidi.status.last) {
- case WTF::Unicode::LeftToRight:
- case WTF::Unicode::EuropeanNumber:
- case WTF::Unicode::ArabicNumber:
+ case LeftToRight:
+ case EuropeanNumber:
+ case ArabicNumber:
appendRun(bidi);
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::RightToLeftArabic:
+ case RightToLeft:
+ case RightToLeftArabic:
break;
- case WTF::Unicode::EuropeanNumberSeparator:
- case WTF::Unicode::EuropeanNumberTerminator:
- case WTF::Unicode::CommonNumberSeparator:
- case WTF::Unicode::BoundaryNeutral:
- case WTF::Unicode::BlockSeparator:
- case WTF::Unicode::SegmentSeparator:
- case WTF::Unicode::WhiteSpaceNeutral:
- case WTF::Unicode::OtherNeutral:
- if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
+ case EuropeanNumberSeparator:
+ case EuropeanNumberTerminator:
+ case CommonNumberSeparator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic) {
//last stuff takes embedding dir
- if (bidi.context->dir() != WTF::Unicode::RightToLeft && bidi.status.lastStrong != WTF::Unicode::RightToLeft
- && bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) {
+ if (bidi.context->dir() != RightToLeft && bidi.status.lastStrong != RightToLeft
+ && bidi.status.lastStrong != RightToLeftArabic) {
bidi.eor = bidi.last;
- bidi.dir = WTF::Unicode::LeftToRight;
+ bidi.dir = LeftToRight;
}
appendRun(bidi);
}
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = WTF::Unicode::RightToLeft;
+ bidi.status.eor = RightToLeft;
bidi.status.lastStrong = dirCurrent;
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
break;
// weak types:
- case WTF::Unicode::EuropeanNumber:
- if (bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) {
+ case EuropeanNumber:
+ if (bidi.status.lastStrong != RightToLeftArabic) {
// if last strong was AL change EN to AN
switch (bidi.status.last) {
- case WTF::Unicode::EuropeanNumber:
- case WTF::Unicode::LeftToRight:
+ case EuropeanNumber:
+ case LeftToRight:
break;
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::RightToLeftArabic:
- case WTF::Unicode::ArabicNumber:
+ case RightToLeft:
+ case RightToLeftArabic:
+ case ArabicNumber:
bidi.eor = bidi.last;
appendRun(bidi);
- bidi.dir = WTF::Unicode::EuropeanNumber;
+ bidi.dir = EuropeanNumber;
break;
- case WTF::Unicode::EuropeanNumberSeparator:
- case WTF::Unicode::CommonNumberSeparator:
- if (bidi.status.eor == WTF::Unicode::EuropeanNumber)
+ case EuropeanNumberSeparator:
+ case CommonNumberSeparator:
+ if (bidi.status.eor == EuropeanNumber)
break;
- case WTF::Unicode::EuropeanNumberTerminator:
- case WTF::Unicode::BoundaryNeutral:
- case WTF::Unicode::BlockSeparator:
- case WTF::Unicode::SegmentSeparator:
- case WTF::Unicode::WhiteSpaceNeutral:
- case WTF::Unicode::OtherNeutral:
- if (bidi.status.eor == WTF::Unicode::RightToLeft) {
+ case EuropeanNumberTerminator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (bidi.status.eor == RightToLeft) {
// neutrals go to R
- bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
+ bidi.eor = bidi.status.last == EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
appendRun(bidi);
- bidi.dir = WTF::Unicode::EuropeanNumber;
- } else if (bidi.status.eor != WTF::Unicode::LeftToRight &&
- (bidi.status.eor != WTF::Unicode::EuropeanNumber || bidi.status.lastStrong != WTF::Unicode::LeftToRight) &&
- bidi.dir != WTF::Unicode::LeftToRight) {
+ bidi.dir = EuropeanNumber;
+ } else if (bidi.status.eor != LeftToRight &&
+ (bidi.status.eor != EuropeanNumber || bidi.status.lastStrong != LeftToRight) &&
+ bidi.dir != LeftToRight) {
// numbers on both sides, neutrals get right to left direction
appendRun(bidi);
- bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.eor = bidi.status.last == EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
+ bidi.dir = RightToLeft;
appendRun(bidi);
- bidi.dir = WTF::Unicode::EuropeanNumber;
+ bidi.dir = EuropeanNumber;
}
default:
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = WTF::Unicode::EuropeanNumber;
- if (bidi.dir == WTF::Unicode::OtherNeutral)
- bidi.dir = WTF::Unicode::LeftToRight;
+ bidi.status.eor = EuropeanNumber;
+ if (bidi.dir == OtherNeutral)
+ bidi.dir = LeftToRight;
break;
}
- case WTF::Unicode::ArabicNumber:
- dirCurrent = WTF::Unicode::ArabicNumber;
+ case ArabicNumber:
+ dirCurrent = ArabicNumber;
switch (bidi.status.last) {
- case WTF::Unicode::LeftToRight:
- if (bidi.context->dir() == WTF::Unicode::LeftToRight)
+ case LeftToRight:
+ if (bidi.context->dir() == LeftToRight)
appendRun(bidi);
break;
- case WTF::Unicode::ArabicNumber:
+ case ArabicNumber:
break;
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::RightToLeftArabic:
- case WTF::Unicode::EuropeanNumber:
+ case RightToLeft:
+ case RightToLeftArabic:
+ case EuropeanNumber:
bidi.eor = bidi.last;
appendRun(bidi);
break;
- case WTF::Unicode::CommonNumberSeparator:
- if (bidi.status.eor == WTF::Unicode::ArabicNumber)
+ case CommonNumberSeparator:
+ if (bidi.status.eor == ArabicNumber)
break;
- case WTF::Unicode::EuropeanNumberSeparator:
- case WTF::Unicode::EuropeanNumberTerminator:
- case WTF::Unicode::BoundaryNeutral:
- case WTF::Unicode::BlockSeparator:
- case WTF::Unicode::SegmentSeparator:
- case WTF::Unicode::WhiteSpaceNeutral:
- case WTF::Unicode::OtherNeutral:
- if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
+ case EuropeanNumberSeparator:
+ case EuropeanNumberTerminator:
+ case BoundaryNeutral:
+ case BlockSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
+ if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic) {
// run of L before neutrals, neutrals take embedding dir (N2)
- if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft
- || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic) {
+ if (bidi.context->dir() == RightToLeft || bidi.status.lastStrong == RightToLeft
+ || bidi.status.lastStrong == RightToLeftArabic) {
// the embedding direction is R
// close the L run
appendRun(bidi);
// neutrals become an R run
- bidi.dir = WTF::Unicode::RightToLeft;
+ bidi.dir = RightToLeft;
} else {
// the embedding direction is L
// append neutrals to the L run and close it
- bidi.dir = WTF::Unicode::LeftToRight;
+ bidi.dir = LeftToRight;
}
}
bidi.eor = bidi.last;
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = WTF::Unicode::ArabicNumber;
- if (bidi.dir == WTF::Unicode::OtherNeutral)
- bidi.dir = WTF::Unicode::ArabicNumber;
+ bidi.status.eor = ArabicNumber;
+ if (bidi.dir == OtherNeutral)
+ bidi.dir = ArabicNumber;
break;
- case WTF::Unicode::EuropeanNumberSeparator:
- case WTF::Unicode::CommonNumberSeparator:
+ case EuropeanNumberSeparator:
+ case CommonNumberSeparator:
break;
- case WTF::Unicode::EuropeanNumberTerminator:
- if (bidi.status.last == WTF::Unicode::EuropeanNumber) {
- dirCurrent = WTF::Unicode::EuropeanNumber;
+ case EuropeanNumberTerminator:
+ if (bidi.status.last == EuropeanNumber) {
+ dirCurrent = EuropeanNumber;
bidi.eor = bidi.current;
bidi.status.eor = dirCurrent;
- } else if (bidi.status.last != WTF::Unicode::EuropeanNumberTerminator)
+ } else if (bidi.status.last != EuropeanNumberTerminator)
bidi.lastBeforeET = emptyRun ? bidi.eor : bidi.last;
break;
// boundary neutrals should be ignored
- case WTF::Unicode::BoundaryNeutral:
+ case BoundaryNeutral:
if (bidi.eor == bidi.last)
bidi.eor = bidi.current;
break;
// neutrals
- case WTF::Unicode::BlockSeparator:
+ case BlockSeparator:
// ### what do we do with newline and paragraph seperators that come to here?
break;
- case WTF::Unicode::SegmentSeparator:
+ case SegmentSeparator:
// ### implement rule L1
break;
- case WTF::Unicode::WhiteSpaceNeutral:
+ case WhiteSpaceNeutral:
break;
- case WTF::Unicode::OtherNeutral:
+ case OtherNeutral:
break;
default:
break;
if (!bidi.reachedEndOfLine) {
bidi.eor = bidi.endOfLine;
switch (bidi.status.eor) {
- case WTF::Unicode::LeftToRight:
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::ArabicNumber:
+ case LeftToRight:
+ case RightToLeft:
+ case ArabicNumber:
bidi.dir = bidi.status.eor;
break;
- case WTF::Unicode::EuropeanNumber:
- bidi.dir = bidi.status.lastStrong == WTF::Unicode::LeftToRight ? WTF::Unicode::LeftToRight : WTF::Unicode::EuropeanNumber;
+ case EuropeanNumber:
+ bidi.dir = bidi.status.lastStrong == LeftToRight ? LeftToRight : EuropeanNumber;
break;
default:
assert(false);
appendRun(bidi);
}
bidi = stateAtEnd;
- bidi.dir = WTF::Unicode::OtherNeutral;
+ bidi.dir = OtherNeutral;
break;
}
}
// set status.last as needed.
switch (dirCurrent) {
- case WTF::Unicode::EuropeanNumberTerminator:
- if (bidi.status.last != WTF::Unicode::EuropeanNumber)
- bidi.status.last = WTF::Unicode::EuropeanNumberTerminator;
+ case EuropeanNumberTerminator:
+ if (bidi.status.last != EuropeanNumber)
+ bidi.status.last = EuropeanNumberTerminator;
break;
- case WTF::Unicode::EuropeanNumberSeparator:
- case WTF::Unicode::CommonNumberSeparator:
- case WTF::Unicode::SegmentSeparator:
- case WTF::Unicode::WhiteSpaceNeutral:
- case WTF::Unicode::OtherNeutral:
+ case EuropeanNumberSeparator:
+ case CommonNumberSeparator:
+ case SegmentSeparator:
+ case WhiteSpaceNeutral:
+ case OtherNeutral:
switch(bidi.status.last) {
- case WTF::Unicode::LeftToRight:
- case WTF::Unicode::RightToLeft:
- case WTF::Unicode::RightToLeftArabic:
- case WTF::Unicode::EuropeanNumber:
- case WTF::Unicode::ArabicNumber:
+ case LeftToRight:
+ case RightToLeft:
+ case RightToLeftArabic:
+ case EuropeanNumber:
+ case ArabicNumber:
bidi.status.last = dirCurrent;
break;
default:
- bidi.status.last = WTF::Unicode::OtherNeutral;
+ bidi.status.last = OtherNeutral;
}
break;
- case WTF::Unicode::NonSpacingMark:
- case WTF::Unicode::BoundaryNeutral:
- case WTF::Unicode::RightToLeftEmbedding:
- case WTF::Unicode::LeftToRightEmbedding:
- case WTF::Unicode::RightToLeftOverride:
- case WTF::Unicode::LeftToRightOverride:
- case WTF::Unicode::PopDirectionalFormat:
+ case NonSpacingMark:
+ case BoundaryNeutral:
+ case RightToLeftEmbedding:
+ case LeftToRightEmbedding:
+ case RightToLeftOverride:
+ case LeftToRightOverride:
+ case PopDirectionalFormat:
// ignore these
break;
- case WTF::Unicode::EuropeanNumber:
+ case EuropeanNumber:
// fall through
default:
bidi.status.last = dirCurrent;
bidi.last = bidi.current;
- if (emptyRun && !(dirCurrent == WTF::Unicode::RightToLeftEmbedding
- || dirCurrent == WTF::Unicode::LeftToRightEmbedding
- || dirCurrent == WTF::Unicode::RightToLeftOverride
- || dirCurrent == WTF::Unicode::LeftToRightOverride
- || dirCurrent == WTF::Unicode::PopDirectionalFormat)) {
+ if (emptyRun && !(dirCurrent == RightToLeftEmbedding
+ || dirCurrent == LeftToRightEmbedding
+ || dirCurrent == RightToLeftOverride
+ || dirCurrent == LeftToRightOverride
+ || dirCurrent == PopDirectionalFormat)) {
bidi.sor = bidi.current;
emptyRun = false;
}
bidi.adjustEmbedding = true;
bidi.current.increment(bidi);
bidi.adjustEmbedding = false;
- if (emptyRun && (dirCurrent == WTF::Unicode::RightToLeftEmbedding
- || dirCurrent == WTF::Unicode::LeftToRightEmbedding
- || dirCurrent == WTF::Unicode::RightToLeftOverride
- || dirCurrent == WTF::Unicode::LeftToRightOverride
- || dirCurrent == WTF::Unicode::PopDirectionalFormat)) {
+ if (emptyRun && (dirCurrent == RightToLeftEmbedding
+ || dirCurrent == LeftToRightEmbedding
+ || dirCurrent == RightToLeftOverride
+ || dirCurrent == LeftToRightOverride
+ || dirCurrent == PopDirectionalFormat)) {
// exclude the embedding char itself from the new run so that ATSUI will never see it
bidi.eor.obj = 0;
bidi.last = bidi.current;
BidiContext *startEmbed;
if (style()->direction() == LTR) {
- startEmbed = new BidiContext( 0, WTF::Unicode::LeftToRight, NULL, style()->unicodeBidi() == Override );
- bidi.status.eor = WTF::Unicode::LeftToRight;
+ startEmbed = new BidiContext(0, LeftToRight, NULL, style()->unicodeBidi() == Override);
+ bidi.status.eor = LeftToRight;
} else {
- startEmbed = new BidiContext( 1, WTF::Unicode::RightToLeft, NULL, style()->unicodeBidi() == Override );
- bidi.status.eor = WTF::Unicode::RightToLeft;
+ startEmbed = new BidiContext(1, RightToLeft, NULL, style()->unicodeBidi() == Override);
+ bidi.status.eor = RightToLeft;
}
bidi.status.lastStrong = startEmbed->dir();
bidi.status.last = startEmbed->dir();
bidi.status.eor = startEmbed->dir();
bidi.context = startEmbed;
- bidi.dir = WTF::Unicode::OtherNeutral;
+ bidi.dir = OtherNeutral;
if (!smidpoints)
smidpoints = new Vector<BidiIterator>();
return false;
}
-static const unsigned short nonBreakingSpace = 0xa0;
-
static inline bool skipNonBreakingSpace(BidiIterator &it)
{
- if (it.obj->style()->nbspMode() != SPACE || it.current() != nonBreakingSpace)
+ if (it.obj->style()->nbspMode() != SPACE || it.current() != noBreakSpace)
return false;
// FIXME: This is bad. It makes nbsp inconsistent with space and won't work correctly
// FIXME: This check looks suspicious. Why does w have to be 0?
bool breakWords = o->style()->wordWrap() == BREAK_WORD && ((allowBreak && w == 0) || o->style()->whiteSpace() == PRE);
- currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == nonBreakingSpace);
+ currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
if (breakWords)
wrapW += t->width(pos, 1, f, w+wrapW);
#include "config.h"
#include "break_lines.h"
+#include "CharacterNames.h"
#include "TextBreakIterator.h"
#if PLATFORM(MAC)
namespace WebCore {
-const UChar noBreakSpace = 0x00A0;
-const UChar softHyphen = 0x00AD;
-
static inline bool isBreakableSpace(UChar ch, bool treatNoBreakSpaceAsBreak)
{
switch (ch) {
#ifndef break_lines_h
#define break_lines_h
-#include "wtf/unicode/Unicode.h"
+#include <wtf/unicode/Unicode.h>
namespace WebCore {
int xpathyyparse(void*);
+using namespace WTF;
+using namespace Unicode;
+
namespace WebCore {
namespace XPath {
if (aChar == '.' || aChar == '-')
return NameCont;
- unsigned category = WTF::Unicode::category(aChar);
- if (category & (WTF::Unicode::Letter_Uppercase|
- WTF::Unicode::Letter_Lowercase|
- WTF::Unicode::Letter_Other|
- WTF::Unicode::Letter_Titlecase|
- WTF::Unicode::Number_Letter))
+ CharCategory category = Unicode::category(aChar);
+ if (category & (Letter_Uppercase | Letter_Lowercase | Letter_Other | Letter_Titlecase | Number_Letter))
return NameStart;
- if (category & (WTF::Unicode::Mark_NonSpacing|
- WTF::Unicode::Mark_SpacingCombining|
- WTF::Unicode::Mark_Enclosing|
- WTF::Unicode::Letter_Modifier|
- WTF::Unicode::Number_DecimalDigit))
+ if (category & (Mark_NonSpacing | Mark_SpacingCombining | Mark_Enclosing | Letter_Modifier | Number_DecimalDigit))
return NameCont;
return NotPartOfName;
}