LayoutTests:
- test for http://bugzilla.opendarwin.org/show_bug.cgi?id=6310
text-transform: uppercase/lowercase don't handle cases one character becomes two
* fast/css/case-transform.html: Added.
* fast/css/case-transform-expected.txt: Added.
WebCore:
Rubber stamped by Hyatt.
- http://bugzilla.opendarwin.org/show_bug.cgi?id=8782
use ICU and UChar more, QChar less
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=6310
text-transform: uppercase/lowercase don't handle cases one character becomes two
Test: fast/css/case-transform.html
By using ICU more, this fixes some bugs in a few places.
* bindings/js/JSXMLSerializer.cpp:
* css/css_valueimpl.h:
* kwq/KWQTextStream.cpp:
* loader/CachedObject.h:
* platform/Color.cpp:
Add includes of DeprecatedString.h as needed, now that StringImpl.h no longer
includes it.
* bindings/js/kjs_css.cpp: (KJS::cssPropertyName):
Eliminate use of QChar::latin1() in a case where it's not helpful.
* bindings/js/kjs_proxy.cpp: (WebCore::KJSProxy::evaluate):
Use characters() function instead of the old unicode() function.
* bindings/js/kjs_window.cpp: (KJS::isSeparator):
Use UChar instead of QChar.
* bindings/objc/DOMInternal.mm:
(StringImpl::operator NSString*): Remove typecast that's no longer needed.
(String::String): Ditto. Also use Vector for local buffer to make code read simpler.
* bridge/mac/FrameMac.mm:
(WebCore::selectorForKeyEvent): Remove call to unicode() function, no longer needed.
(WebCore::FrameMac::setTitle): Remove QChar cast, no longer needed.
(WebCore::FrameMac::setStatusBarText): Ditto.
(WebCore::FrameMac::advanceToNextMisspelling): Use UChar instead of QChar.
(WebCore::FrameMac::runJavaScriptAlert): Remove QChar cast, no longer needed.
(WebCore::FrameMac::runJavaScriptConfirm): Ditto.
(WebCore::FrameMac::runJavaScriptPrompt): Ditto.
(WebCore::FrameMac::attributedString): Replaces calls of QChar::direction() with
calls to u_charDirection and use ICU constants instead of QChar ones.
(WebCore::FrameMac::markMisspellings): Remove QChar cast, no longer needed. Added a
QChar cast so we can call isSpace -- slated to be removed later.
(WebCore::FrameMac::shouldClose): Remove QChar cast, no longer needed.
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge selectedString]): Remove QChar cast, no longer needed.
(-[WebCoreFrameBridge stringForRange:]): Ditto.
* css/CSSGrammar.y: Update for field name change from string to characters.
Use UChar instead of unsigned short.
* css/css_valueimpl.cpp:
(WebCore::propertyID): Use UChar instead of unsigned short and get rid of call to
unicode() function, no longer needed.
(WebCore::quoteStringIfNeeded): Use strings when building up a resulting string,
instead of depending on the feature where you can append characters to a string.
* css/csshelper.cpp: (WebCore::parseURL): Remove calls to unicode() function and
rewrite to obviate the need to call lower() just to check for a few constant
character values. Also remove a now-unneeded type cast.
* css/cssparser.h: Changed ParseString field to use UChar and to be named characters
instead of string. Changed many other fields to be UChar instead of unsigned short.
(WebCore::domString): Update for that.
(WebCore::atomicString): Ditto.
* css/cssparser.cpp:
(WebCore::ParseString::lower): Use u_tolower instead of QChar::lower(). Also change
name to characters from string.
(WebCore::CSSParser::setupParser): Use UChar instead of unsigned short.
(WebCore::CSSParser::lex): Ditto. Also update for characters name change.
(WebCore::CSSParser::text): Use UChar instead of unsigned short. Also tweak some
of the code a little bit to handle a couple of overflow cases better and reduce
type casting.
(WebCore::deprecatedString): Moved here so we don't have to include DeprecatedString.h
in the header file.
* css/cssstyleselector.cpp: (WebCore::checkPseudoState): Added a type cast since this
code now bridges the world between modern code and QChar/DeprecatedString.
* dom/CharacterData.cpp: (WebCore::CharacterData::CharacterData): Changed QChar to UChar.
* dom/Document.h:
* dom/Document.cpp:
(WebCore::Document::isValidName): Updated for name change from unicode to characters.
(WebCore::Document::parseQualifiedName): Ditto.
(WebCore::Document::backslashAsCurrencySymbol): Changed return type to UChar.
* dom/NamedMappedAttrMap.cpp:
(WebCore::isClassWhitespace): Changed parameter to UChar from QChar.
(WebCore::NamedMappedAttrMap::parseClassAttribute): Changed from UChar to QChar and
from unicode to characters.
* dom/Position.cpp:
(WebCore::Position::leadingWhitespacePosition): Changed from QChar to UChar.
(WebCore::Position::trailingWhitespacePosition): Ditto.
* dom/StyledElement.cpp:
(WebCore::isClassWhitespace): Changed from QChar to UChar.
(WebCore::StyledElement::addCSSLength): Changed from QChar to UChar, and remove one
case where latin1() was used and was not helpful.
(WebCore::StyledElement::addCSSColor): Removed unicode() function call, no longer needed.
* dom/dom2_eventsimpl.cpp: (WebCore::KeyboardEvent::charCode):
* html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::constrainValue):
Removed unicode() function call, no longer needed.
* dom/xml_tokenizer.h: Removed default parameter for xmlDocPtrForString so we don't have
to include the DeprecatedString.h header in this file (and since no one uses it).
* editing/HTMLInterchange.cpp: (convertHTMLTextToInterchangeFormat): Added a couple calls
to the unicode() function to bridge the gap from QChar/DeprecatedString back to modern
code.
* editing/InsertTextCommand.cpp: Removed unused function.
* editing/TextIterator.h: Changed from QChar to UChar.
* editing/TextIterator.cpp:
(WebCore::TextIterator::TextIterator): Initialize m_lastCharacter since it's now a UChar
(which is just a typedef) rather than a QChar (which was a class with a default value of 0).
(WebCore::TextIterator::handleTextNode): Updated to use characters() instead of unicode().
(WebCore::TextIterator::handleTextBox): Removed unicode() call since it's now a UChar instead
of a QChar.
(WebCore::TextIterator::emitCharacter): More of the same.
(WebCore::SimplifiedBackwardsTextIterator::handleTextNode): Ditto.
(WebCore::SimplifiedBackwardsTextIterator::emitCharacter): Ditto.
(WebCore::CharacterIterator::string): Ditto.
(WebCore::WordAwareIterator::advance): Ditto.
(WebCore::WordAwareIterator::length): Ditto.
(WebCore::WordAwareIterator::characters): Ditto.
(WebCore::CircularSearchBuffer::CircularSearchBuffer): Changed to use UChar
instead of QChar, but also to use foldCase() instead of lower(), because
we want case folding here, not lowercasing.
(WebCore::CircularSearchBuffer::append): Ditto, with u_foldCase.
(WebCore::CircularSearchBuffer::isMatch): Ditto.
(WebCore::plainText): Added type cast since this bridges the gap from the modern stuff
to QChar/DeprecatedString.
* editing/VisiblePosition.h: Changed from QChar to UChar.
* editing/VisiblePosition.cpp: (WebCore::VisiblePosition::characterAfter): Ditto.
* editing/markup.cpp: (WebCore::escapeTextForMarkup): Changed code that used latin1()
for no good reason to use unicode() instead.
* html/HTMLTokenizer.h: Changed from QChar to UChar.
* html/HTMLTokenizer.cpp: Changed from QChar to UChar, including removing the
KHTML_ALLOC_QCHAR_VEC and KHTML_DELETE_QCHAR_VEC macros, which weren't being
used consistently anyway.
(WebCore::fixUpChar): More of the same.
(WebCore::tagMatch): Ditto.
(WebCore::HTMLTokenizer::reset): Ditto.
(WebCore::HTMLTokenizer::begin): Ditto. Also corrected anomaly where buffer
size was not the same as the size value -- this was only true in the initial
allocation, so I believe there was no value in it.
(WebCore::HTMLTokenizer::parseSpecial): Ditto. Also removed a use of latin1()
that was unnnecessary extra work.
(WebCore::HTMLTokenizer::scriptHandler): More of the same.
(WebCore::HTMLTokenizer::parseComment): Ditto.
(WebCore::HTMLTokenizer::parseServer): Ditto.
(WebCore::HTMLTokenizer::parseProcessingInstruction): Ditto. Another unnecessary
use of latin1() removed.
(WebCore::HTMLTokenizer::parseText): Ditto.
(WebCore::HTMLTokenizer::parseEntity): Ditto. Changed hex-parsing code to handle
uppercase hex a more-efficient way than calling QChar::lower() on each character.
Also changed surrogate code logic to fix a couple things -- reject character codes
> 0x10FFFF as it should and use U16_LEAD and U16_TRAIL instead of writing our
own versions of these.
(WebCore::HTMLTokenizer::parseTag): Ditto.
(WebCore::HTMLTokenizer::write): Ditto.
(WebCore::HTMLTokenizer::end): Ditto.
(WebCore::HTMLTokenizer::finish): Ditto.
(WebCore::HTMLTokenizer::enlargeBuffer): Ditto.
(WebCore::HTMLTokenizer::enlargeScriptBuffer): Ditto.
(WebCore::HTMLTokenizer::notifyFinished):
(WebCore::decodeNamedEntity): Ditto.
* html/html_inlineimpl.cpp: (WebCore::parseFontSizeNumber): Changed from QChar
to UChar, including using u_isdigit and u_charDigitValue instead of QChar::isNumber
and QChar::digitValue. Also removed unneeded range checking that's already done
by WebCore::String.
* kwq/KWQLoader.mm: (KWQIsResponseURLEqualToURL): Rewrote to use Vector and UChar,
removing all the type casts and making the whole function much shorter.
* kwq/WebCoreAXObject.mm:
(AXAttributedStringAppendText): Use UChar instead of QChar.
(-[WebCoreAXObject doAXAttributedStringForTextMarkerRange:]): More of the same.
* loader/Cache.h: Remove unnecessary default parameters, preventing the need to
include the DeprecatedString.h header in this header. Cleaned up the header
structure a bit, removing some obsolete and redundant comments and fixing typos.
* loader/Cache.cpp: Removed unused preload functions.
* page/Frame.h:
* page/Frame.cpp:
(WebCore::UserStyleSheetLoader::UserStyleSheetLoader): Added explicit arguments.
This was the only caller anywhere that took advantage of the default parameter
values in one of the Cache class request functions.
(WebCore::Frame::backslashAsCurrencySymbol): Changed QChar to UChar.
* platform/AtomicString.h: Changed QChar to UChar. Removed constructor that makes
an AtomicString from a single character. Renamed unicode() function to characters().
Renamed KHTML_ATOMICSTRING_HIDE_GLOBALS to ATOMICSTRING_HIDE_GLOBALS.
* platform/AtomicString.cpp:
(WebCore::CStringTranslator::equal): Changed QChar to UChar.
(WebCore::operator==): Changed unicode() to characters().
(WebCore::UCharBufferTranslator::hash): More of the same.
(WebCore::UCharBufferTranslator::equal): Ditto.
(WebCore::UCharBufferTranslator::translate): Ditto.
(WebCore::AtomicString::add): Ditto.
(WebCore::AtomicString::operator Identifier): Ditto.
(WebCore::AtomicString::operator UString): Ditto.
(WebCore::AtomicString::AtomicString): Moved here so we don't need DeprecatedString.h
in the header.
(WebCore::AtomicString::deprecatedString): Ditto.
* platform/DeprecatedString.h: Removed QChar::Direction enum and all the DirXXX values,
isDigit, isLetter, isNumber, isLetterOrNumber, isPunct, digitValue, and direction functions.
(QChar::isSpace): Changed to use u_charDirection instead of QChar::direction.
* platform/Font.h: (WebCore::Font::width): Changed QChar to UChar.
* platform/Font.cpp: (WebCore::Font::width): Ditto.
* platform/GraphicsContext.h:
* platform/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawText): Changed QChar to UChar. Removed horizontalAlignment
parameter from simplified string drawing entry point, since it's not used.
(WebCore::GraphicsContext::drawHighlightForText): Changed QChar to UChar.
* platform/PlatformString.h: Changed QChar to UChar. Removed constructor that makes
a String from a single character. Renamed unicode() function to characters(). Added
an append function and changed += operator to just call that. Added a foldCase() function.
Removed the concatenation operators that add individual strings before or after.
* platform/String.cpp:
(WebCore::String::String): Changed QChar to UChar.
(WebCore::String::append): Renamed from operator+= and removed the return value.
(WebCore::String::operator[]): Changed QChar to UChar.
(WebCore::String::foldCase): Added.
(WebCore::String::percentage): More of the same.
(WebCore::String::characters): Renamed from unicode().
(WebCore::String::deprecatedString): More of the same.
(WebCore::String::sprintf): Fixed mistakes in the comments.
(WebCore::String::isEmpty): Tweaked a bit.
(WebCore::operator==): More of the same.
(WebCore::String::operator Identifier): Ditto.
(WebCore::String::operator UString): Ditto.
* platform/SegmentedString.h: Changed from QChar to UChar. Had to initialize
data members that are now UChar.
* platform/SegmentedString.cpp:
(WebCore::SegmentedString::length): Updated for change from QChar to UChar.
(WebCore::SegmentedString::append): Ditto.
(WebCore::SegmentedString::prepend): Ditto.
(WebCore::SegmentedString::toString): Ditto.
* platform/StringHash.h: Updated to use UChar instead of QChar and for name changes.
Also changed to use case folding intead of lowercasing for case insensitive hashing.
* platform/StringImpl.h:
* platform/StringImpl.cpp:
(WebCore::newUCharVector): Changed to UChar from QChar.
(WebCore::deleteUCharVector): Ditto.
(WebCore::StringImpl::StringImpl): Ditto.
(WebCore::StringImpl::init): Ditto. Also renamed from initWithChar and initWithQChar.
(WebCore::StringImpl::~StringImpl): Ditto.
(WebCore::StringImpl::append): Ditto.
(WebCore::StringImpl::insert): Ditto.
(WebCore::StringImpl::truncate): Ditto.
(WebCore::StringImpl::remove): Ditto.
(WebCore::StringImpl::split): Ditto.
(WebCore::StringImpl::containsOnlyWhitespace): Ditto. Also added comment because this
function seems a little broken.
(WebCore::parseLength): More of the same.
(WebCore::StringImpl::toCoordsArray): Ditto.
(WebCore::StringImpl::toLengthArray): Ditto.
(WebCore::StringImpl::isLower): Ditto.
(WebCore::StringImpl::lower): Rewrote to use u_strToLower.
(WebCore::StringImpl::upper): Rewrote to use u_strToUpper.
(WebCore::StringImpl::foldCase): Added. Uses u_strFoldCase.
(WebCore::getWordBreakIterator): Changed to use U_FAILURE instead of accepting only
U_ZERO_ERROR as a success code.
(WebCore::StringImpl::capitalize): More QChar to UChar changes.
(WebCore::StringImpl::toInt): Ditto.
(WebCore::equal): Changed from QChar to UChar and was careful to preserve the old
semantics where "high ASCII" is treated as U+0080-U+00FF even though I don't know
if this feature is important.
(WebCore::equalIgnoringCase): Ditto, but used case folding instead of lowercasing
by using the u_foldCase and u_memcasecmp functions. Also renamed from
equalCaseInsensitive for more-consistent naming.
(WebCore::StringImpl::find): Ditto. Use case folding for the case insensitive branch.
(WebCore::StringImpl::replace): More of the same.
(WebCore::StringImpl::computeHash): Ditto.
(WebCore::StringImpl::ascii): Ditto.
* platform/TextBoundaries.h: Changed from QChar to UChar.
* platform/mac/TextBoundaries.mm:
(WebCore::findWordBoundary): Made the change to UChar and removed some type casts.
(WebCore::findNextWordFromIndex): Ditto.
(WebCore::findSentenceBoundary): Ditto.
(WebCore::findNextSentenceFromIndex): Ditto.
* platform/TextEncoding.h:
* platform/TextEncoding.cpp:
(WebCore::TextEncoding::backslashAsCurrencySymbol): Changed from QChar to UChar.
(WebCore::TextEncoding::fromUnicode): More of the same.
* platform/mac/TextEncodingMac.cpp: (WebCore::TextEncoding::fromUnicode): More
of the same.
* platform/mac/FontFamilyMac.mm: (WebCore::FontFamily::getNSFamily): Removed a
now-unneeded type cast.
* platform/mac/FontMac.mm:
(WebCore::Font::selectionRectForText):
(WebCore::Font::drawText):
(WebCore::Font::drawHighlightForText):
(WebCore::Font::floatWidth):
(WebCore::Font::checkSelectionPoint):
Changed QChar to UChar and removed some now-unneeded type casts.
* editing/RebalanceWhitespaceCommand.cpp: (WebCore::isWhitespace):
* editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::doApply):
* editing/visible_units.cpp:
(WebCore::previousBoundary):
(WebCore::nextBoundary):
(WebCore::startWordBoundary):
(WebCore::endWordBoundary):
(WebCore::previousWordPositionBoundary):
(WebCore::nextWordPositionBoundary):
(WebCore::startSentenceBoundary):
(WebCore::endSentenceBoundary):
(WebCore::previousSentencePositionBoundary):
(WebCore::nextSentencePositionBoundary):
(WebCore::startOfParagraph):
(WebCore::endOfParagraph):
* html/HTMLParser.cpp: (WebCore::HTMLParser::handleError):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::selectionRect):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::paintSelection):
(WebCore::InlineTextBox::paintMarkedTextBackground):
(WebCore::InlineTextBox::paintTextMatchMarker):
(WebCore::InlineTextBox::offsetForPosition):
(WebCore::InlineTextBox::positionForOffset):
* rendering/RenderBlock.cpp:
(WebCore::stripTrailingSpace):
(WebCore::RenderBlock::updateFirstLetter):
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutVerticalBox):
* rendering/RenderObject.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::backslashAsCurrencySymbol):
* rendering/RenderTreeAsText.cpp: (quoteAndEscapeNonPrintables):
* rendering/break_lines.cpp: (WebCore::nextBreakablePosition):
* rendering/break_lines.h: (WebCore::isBreakable):
* rendering/render_style.h: (WebCore::RenderStyle::isCollapsibleWhiteSpace):
* xml/XSLStyleSheet.cpp: (WebCore::XSLStyleSheet::parseString):
* xml/xmlhttprequest.cpp:
(WebCore::getMIMEType):
(WebCore::getCharset):
Changed QChar to UChar.
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageChanged): Changed QChar to UChar.
(WebCore::RenderImage::paint): Changed callers of drawText to no-longer pass 0
for the horizontal alignment, since I removed that parameters.
* rendering/RenderText.h: Changed QChar to UChar.
* rendering/RenderText.cpp:
(WebCore::characterBreakIterator): Update for name change.
(WebCore::RenderText::RenderText): Ditto.
(WebCore::RenderText::allAscii): Remove uneeded unicode() and allow the value
U+007F to count as ASCII.
(WebCore::RenderText::cacheWidths): Changed QChar to UChar.
(WebCore::RenderText::widthFromCache): Changed code that deals with direction to
use the ICU direction calls.
(WebCore::RenderText::trimmedMinMaxWidth): Changed QChar to UChar.
(WebCore::RenderText::calcMinMaxWidth): Ditto.
(WebCore::RenderText::containsOnlyWhitespace): Ditto.
(WebCore::RenderText::setText): Ditto.
(WebCore::RenderText::width): Ditto.
* rendering/RenderTextField.cpp:
(WebCore::RenderTextField::updateFromElement): Removed unneeded QChar cast.
(WebCore::RenderTextField::calcMinMaxWidth): Changed from QChar to UChar.
* rendering/bidi.h:
* rendering/bidi.cpp:
(WebCore::BidiIterator::BidiIterator):
(WebCore::BidiState::BidiState):
(WebCore::BidiContext::BidiContext):
(WebCore::bidiNext):
(WebCore::bidiFirst):
(WebCore::BidiIterator::current):
(WebCore::BidiIterator::direction):
(WebCore::addRun):
(WebCore::checkMidpoints):
(WebCore::appendRun):
(WebCore::embed):
(WebCore::RenderBlock::tabWidth):
(WebCore::RenderBlock::computeHorizontalPositionsForLine):
(WebCore::RenderBlock::bidiReorderLine):
(WebCore::RenderBlock::layoutInlineChildren):
(WebCore::skipNonBreakingSpace):
(WebCore::RenderBlock::skipWhitespace):
(WebCore::RenderBlock::findNextLineBreak):
(WebCore::RenderBlock::checkLinesForTextOverflow):
Changed from QChar to UChar and all direction from QChar constants to the
ones from ICU.
* rendering/render_form.cpp:
(WebCore::RenderLineEdit::updateFromElement):
(WebCore::RenderSelect::updateFromElement):
(WebCore::RenderTextArea::updateFromElement):
(WebCore::RenderTextArea::text):
(WebCore::RenderTextArea::textWithHardLineBreaks):
Got rid of now-unneeded QChar type casts.
* rendering/render_line.cpp:
(WebCore::InlineFlowBox::placeBoxesHorizontally): Updated for change from QChar
to UChar.
(WebCore::EllipsisBox::paint): Updated for unicode() -> characters() name change.
* rendering/render_list.cpp:
(WebCore::toRoman): Updated from QChar to UChar.
(WebCore::toLetterString): Ditto.
(WebCore::toHebrew): More of the same, also cleaned up the logic a bit.
(WebCore::RenderListMarker::paint): Removed the alignment parameters from the
various functions. Also removed all reliance on the width-measuring functions
that take a string.
(WebCore::RenderListMarker::calcMinMaxWidth): More of the same.
(WebCore::RenderListMarker::getRelativeMarkerRect): Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14273 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/rendering/bidi.cpp b/WebCore/rendering/bidi.cpp
index 986c1f9..3810f97 100644
--- a/WebCore/rendering/bidi.cpp
+++ b/WebCore/rendering/bidi.cpp
@@ -2,7 +2,7 @@
* This file is part of the html renderer for KDE.
*
* Copyright (C) 2000 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -38,18 +38,16 @@
namespace WebCore {
// an iterator which traverses all the objects within a block
-struct BidiIterator
-{
+struct BidiIterator {
BidiIterator() : block(0), obj(0), pos(0) {}
BidiIterator(RenderBlock* b, RenderObject* o, unsigned int p)
- :block(b), obj(o), pos(p) {}
+ : block(b), obj(o), pos(p) {}
void increment(BidiState& state);
bool atEnd() const;
- const QChar& current() const;
-
- QChar::Direction direction() const;
+ UChar current() const;
+ UCharDirection direction() const;
RenderBlock* block;
RenderObject* obj;
@@ -57,7 +55,7 @@
};
struct BidiState {
- BidiState() : context(0), dir(QChar::DirON), adjustEmbedding(false), reachedEndOfLine(false) {}
+ BidiState() : context(0), dir(U_OTHER_NEUTRAL), adjustEmbedding(false), reachedEndOfLine(false) {}
BidiIterator sor;
BidiIterator eor;
@@ -65,7 +63,7 @@
BidiIterator current;
RefPtr<BidiContext> context;
BidiStatus status;
- QChar::Direction dir;
+ UCharDirection dir;
bool adjustEmbedding;
BidiIterator endOfLine;
bool reachedEndOfLine;
@@ -104,8 +102,8 @@
static bool emptyRun = true;
static int numSpaces;
-static void embed(QChar::Direction d, BidiState &bidi);
-static void appendRun(BidiState &bidi);
+static void embed(UCharDirection, BidiState&);
+static void appendRun(BidiState&);
static int getBPMWidth(int childValue, Length cssUnit)
{
@@ -199,7 +197,7 @@
Each line of text caches the embedding level at the start of the line for faster
relayouting
*/
-BidiContext::BidiContext(unsigned char l, QChar::Direction e, BidiContext *p, bool o)
+BidiContext::BidiContext(unsigned char l, UCharDirection e, BidiContext *p, bool o)
: level(l), override(o), m_dir(e)
{
parent = p;
@@ -280,9 +278,9 @@
EUnicodeBidi ub = next->style()->unicodeBidi();
if (ub != UBNormal) {
TextDirection dir = next->style()->direction();
- QChar::Direction d = (ub == Embed
- ? (dir == RTL ? QChar::DirRLE : QChar::DirLRE)
- : (dir == RTL ? QChar::DirRLO : QChar::DirLRO));
+ UCharDirection d = (ub == Embed
+ ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)
+ : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));
embed(d, bidi);
}
}
@@ -298,7 +296,7 @@
while (current && current != block) {
if (bidi.adjustEmbedding && current->isInlineFlow() && current->style()->unicodeBidi() != UBNormal)
- embed(QChar::DirPDF, bidi);
+ embed(U_POP_DIRECTIONAL_FORMAT, bidi);
next = current->nextSibling();
if (next) {
@@ -306,9 +304,9 @@
EUnicodeBidi ub = next->style()->unicodeBidi();
if (ub != UBNormal) {
TextDirection dir = next->style()->direction();
- QChar::Direction d = (ub == Embed
- ? (dir == RTL ? QChar::DirRLE : QChar::DirLRE)
- : (dir == RTL ? QChar::DirRLO : QChar::DirLRO));
+ UCharDirection d = (ub == Embed
+ ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)
+ : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));
embed(d, bidi);
}
}
@@ -348,9 +346,9 @@
EUnicodeBidi ub = o->style()->unicodeBidi();
if (ub != UBNormal) {
TextDirection dir = o->style()->direction();
- QChar::Direction d = (ub == Embed
- ? (dir == RTL ? QChar::DirRLE : QChar::DirLRE)
- : (dir == RTL ? QChar::DirRLO : QChar::DirLRO));
+ UCharDirection d = (ub == Embed
+ ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)
+ : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));
embed(d, bidi);
}
}
@@ -386,33 +384,30 @@
return !obj;
}
-const QChar& BidiIterator::current() const
+UChar BidiIterator::current() const
{
- static QChar nullCharacter;
-
if (!obj || !obj->isText())
- return nullCharacter;
+ return 0;
RenderText* text = static_cast<RenderText*>(obj);
if (!text->text())
- return nullCharacter;
+ return 0;
return text->text()[pos];
}
-ALWAYS_INLINE QChar::Direction BidiIterator::direction() const
+ALWAYS_INLINE UCharDirection BidiIterator::direction() const
{
if (!obj)
- return QChar::DirON;
+ return U_OTHER_NEUTRAL;
if (obj->isListMarker())
- return obj->style()->direction() == LTR ? QChar::DirL : QChar::DirR;
+ return obj->style()->direction() == LTR ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT;
if (!obj->isText())
- return QChar::DirON;
-
- RenderText *renderTxt = static_cast<RenderText *>(obj);
+ return U_OTHER_NEUTRAL;
+ RenderText* renderTxt = static_cast<RenderText*>(obj);
if (pos >= renderTxt->stringLength())
- return QChar::DirON;
- return renderTxt->text()[pos].direction();
+ return U_OTHER_NEUTRAL;
+ return u_charDirection(renderTxt->text()[pos]);
}
// -------------------------------------------------------------------------------------------------
@@ -433,7 +428,7 @@
RenderText* text = static_cast<RenderText*>(bidiRun->obj);
if (text->text()) {
for (int i = bidiRun->start; i < bidiRun->stop; i++) {
- const QChar c = text->text()[i];
+ UChar c = text->text()[i];
if (c == ' ' || c == '\n' || c == '\t')
numSpaces++;
}
@@ -524,11 +519,11 @@
// Don't shave a character off the endpoint if it was from a soft hyphen.
RenderText* textObj = static_cast<RenderText*>(endpoint.obj);
if (endpoint.pos+1 < textObj->length()) {
- if (textObj->text()[endpoint.pos+1].unicode() == SOFT_HYPHEN)
+ if (textObj->text()[endpoint.pos+1] == SOFT_HYPHEN)
return;
} else if (startpoint.obj->isText()) {
RenderText *startText = static_cast<RenderText*>(startpoint.obj);
- if (startText->length() > 0 && startText->text()[0].unicode() == SOFT_HYPHEN)
+ if (startText->length() > 0 && startText->text()[0] == SOFT_HYPHEN)
return;
}
}
@@ -625,37 +620,44 @@
bidi.eor.increment(bidi);
bidi.sor = bidi.eor;
- bidi.dir = QChar::DirON;
- bidi.status.eor = QChar::DirON;
+ bidi.dir = U_OTHER_NEUTRAL;
+ bidi.status.eor = U_OTHER_NEUTRAL;
bidi.adjustEmbedding = b;
}
-static void embed(QChar::Direction d, BidiState& bidi)
+static void embed(UCharDirection d, BidiState& bidi)
{
bool b = bidi.adjustEmbedding;
bidi.adjustEmbedding = false;
- if (d == QChar::DirPDF) {
+ if (d == U_POP_DIRECTIONAL_FORMAT) {
BidiContext *c = bidi.context->parent;
if (c) {
if (!emptyRun && bidi.eor != bidi.last) {
- assert(bidi.status.eor != QChar::DirON);
+ assert(bidi.status.eor != U_OTHER_NEUTRAL);
// 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 == QChar::DirES || bidi.status.last == QChar::DirET || bidi.status.last == QChar::DirCS || bidi.status.last == QChar::DirBN || bidi.status.last == QChar::DirB || bidi.status.last == QChar::DirS || bidi.status.last == QChar::DirWS || bidi.status.last == QChar::DirON);
- if (bidi.dir == QChar::DirON)
+ assert(bidi.status.last == U_EUROPEAN_NUMBER_SEPARATOR
+ || bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR
+ || bidi.status.last == U_COMMON_NUMBER_SEPARATOR
+ || bidi.status.last == U_BOUNDARY_NEUTRAL
+ || bidi.status.last == U_BLOCK_SEPARATOR
+ || bidi.status.last == U_SEGMENT_SEPARATOR
+ || bidi.status.last == U_WHITE_SPACE_NEUTRAL
+ || bidi.status.last == U_OTHER_NEUTRAL);
+ if (bidi.dir == U_OTHER_NEUTRAL)
bidi.dir = bidi.context->dir();
- if (bidi.context->dir() == QChar::DirL) {
+ if (bidi.context->dir() == U_LEFT_TO_RIGHT) {
// bidi.sor ... bidi.eor ... bidi.last L
- if (bidi.status.eor == QChar::DirEN) {
- if (bidi.status.lastStrong != QChar::DirL) {
- bidi.dir = QChar::DirEN;
+ if (bidi.status.eor == U_EUROPEAN_NUMBER) {
+ if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
+ bidi.dir = U_EUROPEAN_NUMBER;
appendRun(bidi);
}
- } else if (bidi.status.eor == QChar::DirAN) {
- bidi.dir = QChar::DirAN;
+ } else if (bidi.status.eor == U_ARABIC_NUMBER) {
+ bidi.dir = U_ARABIC_NUMBER;
appendRun(bidi);
- } else if (bidi.status.eor != QChar::DirL)
+ } else if (bidi.status.eor != U_LEFT_TO_RIGHT)
appendRun(bidi);
- } else if (bidi.status.eor != QChar::DirR && bidi.status.eor != QChar::DirAL)
+ } else if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC)
appendRun(bidi);
bidi.eor = bidi.last;
}
@@ -669,15 +671,15 @@
bidi.eor.obj = 0;
}
} else {
- QChar::Direction runDir;
- if (d == QChar::DirRLE || d == QChar::DirRLO)
- runDir = QChar::DirR;
+ UCharDirection runDir;
+ if (d == U_RIGHT_TO_LEFT_EMBEDDING || d == U_RIGHT_TO_LEFT_OVERRIDE)
+ runDir = U_RIGHT_TO_LEFT;
else
- runDir = QChar::DirL;
- bool override = d == QChar::DirLRO || d == QChar::DirRLO;
+ runDir = U_LEFT_TO_RIGHT;
+ bool override = d == U_LEFT_TO_RIGHT_OVERRIDE || d == U_RIGHT_TO_LEFT_OVERRIDE;
unsigned char level = bidi.context->level;
- if (runDir == QChar::DirR) {
+ if (runDir == U_RIGHT_TO_LEFT) {
if (level%2) // we have an odd level
level += 2;
else
@@ -691,40 +693,47 @@
if (level < 61) {
if (!emptyRun && bidi.eor != bidi.last) {
- assert(bidi.status.eor != QChar::DirON);
+ assert(bidi.status.eor != U_OTHER_NEUTRAL);
// 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 == QChar::DirES || bidi.status.last == QChar::DirET || bidi.status.last == QChar::DirCS || bidi.status.last == QChar::DirBN || bidi.status.last == QChar::DirB || bidi.status.last == QChar::DirS || bidi.status.last == QChar::DirWS || bidi.status.last == QChar::DirON);
- if (bidi.dir == QChar::DirON)
+ assert(bidi.status.last == U_EUROPEAN_NUMBER_SEPARATOR
+ || bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR
+ || bidi.status.last == U_COMMON_NUMBER_SEPARATOR
+ || bidi.status.last == U_BOUNDARY_NEUTRAL
+ || bidi.status.last == U_BLOCK_SEPARATOR
+ || bidi.status.last == U_SEGMENT_SEPARATOR
+ || bidi.status.last == U_WHITE_SPACE_NEUTRAL
+ || bidi.status.last == U_OTHER_NEUTRAL);
+ if (bidi.dir == U_OTHER_NEUTRAL)
bidi.dir = runDir;
- if (runDir == QChar::DirL) {
+ if (runDir == U_LEFT_TO_RIGHT) {
// bidi.sor ... bidi.eor ... bidi.last L
- if (bidi.status.eor == QChar::DirEN) {
- if (bidi.status.lastStrong != QChar::DirL) {
- bidi.dir = QChar::DirEN;
+ if (bidi.status.eor == U_EUROPEAN_NUMBER) {
+ if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
+ bidi.dir = U_EUROPEAN_NUMBER;
appendRun(bidi);
- if (bidi.context->dir() != QChar::DirL)
- bidi.dir = QChar::DirR;
+ if (bidi.context->dir() != U_LEFT_TO_RIGHT)
+ bidi.dir = U_RIGHT_TO_LEFT;
}
- } else if (bidi.status.eor == QChar::DirAN) {
- bidi.dir = QChar::DirAN;
+ } else if (bidi.status.eor == U_ARABIC_NUMBER) {
+ bidi.dir = U_ARABIC_NUMBER;
appendRun(bidi);
- if (bidi.context->dir() != QChar::DirL) {
+ if (bidi.context->dir() != U_LEFT_TO_RIGHT) {
bidi.eor = bidi.last;
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
appendRun(bidi);
}
- } else if (bidi.status.eor != QChar::DirL) {
- if (bidi.context->dir() == QChar::DirL || bidi.status.lastStrong == QChar::DirL)
+ } else if (bidi.status.eor != U_LEFT_TO_RIGHT) {
+ if (bidi.context->dir() == U_LEFT_TO_RIGHT || bidi.status.lastStrong == U_LEFT_TO_RIGHT)
appendRun(bidi);
else
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
}
- } else if (bidi.status.eor != QChar::DirR && bidi.status.eor != QChar::DirAL) {
+ } else if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {
// bidi.sor ... bidi.eor ... bidi.last R; bidi.eor=L/EN/AN; EN,AN behave like R (rule N1)
- if (bidi.context->dir() == QChar::DirR || bidi.status.lastStrong == QChar::DirR || bidi.status.lastStrong == QChar::DirAL)
+ if (bidi.context->dir() == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT_ARABIC)
appendRun(bidi);
else
- bidi.dir = QChar::DirL;
+ bidi.dir = U_LEFT_TO_RIGHT;
}
bidi.eor = bidi.last;
}
@@ -835,7 +844,7 @@
return 0;
if (!m_tabWidth) {
- QChar spaceChar(' ');
+ const UChar spaceChar = ' ';
const Font& font = style()->font();
int spaceWidth = font.width(&spaceChar, 1);
m_tabWidth = spaceWidth * 8;
@@ -863,9 +872,9 @@
int effectiveWidth = textWidth;
int rtLength = rt->length();
if (rtLength != 0) {
- if (r->start == 0 && needsWordSpacing && rt->text()[r->start].isSpace())
+ if (r->start == 0 && needsWordSpacing && QChar(rt->text()[r->start]).isSpace())
effectiveWidth += rt->font(m_firstLine)->wordSpacing();
- needsWordSpacing = !rt->text()[r->stop-1].isSpace() && r->stop == rtLength;
+ needsWordSpacing = !QChar(rt->text()[r->stop-1]).isSpace() && r->stop == rtLength;
}
if (!r->compact) {
RenderStyle *style = r->obj->style();
@@ -908,7 +917,7 @@
case TAAUTO:
numSpaces = 0;
// for right to left fall through to right aligned
- if (bidi.context->basicDir() == QChar::DirL)
+ if (bidi.context->basicDir() == U_LEFT_TO_RIGHT)
break;
case RIGHT:
case KHTML_RIGHT:
@@ -936,7 +945,7 @@
// get the number of spaces in the run
int spaces = 0;
for ( int i = r->start; i < r->stop; i++ ) {
- const QChar c = static_cast<RenderText *>(r->obj)->text()[i];
+ UChar c = static_cast<RenderText*>(r->obj)->text()[i];
if (c == ' ' || c == '\n' || c == '\t')
spaces++;
}
@@ -1002,7 +1011,7 @@
sLastBidiRun = 0;
sBidiRunCount = 0;
- assert(bidi.dir == QChar::DirON);
+ assert(bidi.dir == U_OTHER_NEUTRAL);
emptyRun = true;
@@ -1016,7 +1025,7 @@
BidiState stateAtEnd;
while (true) {
- QChar::Direction dirCurrent;
+ UCharDirection dirCurrent;
if (pastEnd && (previousLineBrokeCleanly || bidi.current.atEnd())) {
BidiContext *c = bidi.context.get();
while (c->parent)
@@ -1032,71 +1041,76 @@
}
} else {
dirCurrent = bidi.current.direction();
- if (bidi.context->override && dirCurrent != QChar::DirRLE && dirCurrent != QChar::DirLRE && dirCurrent != QChar::DirRLO && dirCurrent != QChar::DirLRO && dirCurrent != QChar::DirPDF)
+ if (bidi.context->override
+ && dirCurrent != U_RIGHT_TO_LEFT_EMBEDDING
+ && dirCurrent != U_LEFT_TO_RIGHT_EMBEDDING
+ && dirCurrent != U_RIGHT_TO_LEFT_OVERRIDE
+ && dirCurrent != U_LEFT_TO_RIGHT_OVERRIDE
+ && dirCurrent != U_POP_DIRECTIONAL_FORMAT)
dirCurrent = bidi.context->dir();
- else if (dirCurrent == QChar::DirNSM)
+ else if (dirCurrent == U_DIR_NON_SPACING_MARK)
dirCurrent = bidi.status.last;
}
- assert(bidi.status.eor != QChar::DirON);
+ assert(bidi.status.eor != U_OTHER_NEUTRAL);
switch (dirCurrent) {
// embedding and overrides (X1-X9 in the Bidi specs)
- case QChar::DirRLE:
- case QChar::DirLRE:
- case QChar::DirRLO:
- case QChar::DirLRO:
- case QChar::DirPDF:
+ case U_RIGHT_TO_LEFT_EMBEDDING:
+ case U_LEFT_TO_RIGHT_EMBEDDING:
+ case U_RIGHT_TO_LEFT_OVERRIDE:
+ case U_LEFT_TO_RIGHT_OVERRIDE:
+ case U_POP_DIRECTIONAL_FORMAT:
embed(dirCurrent, bidi);
break;
// strong types
- case QChar::DirL:
+ case U_LEFT_TO_RIGHT:
switch(bidi.status.last) {
- case QChar::DirR:
- case QChar::DirAL:
- case QChar::DirEN:
- case QChar::DirAN:
- if (bidi.status.last != QChar::DirEN || bidi.status.lastStrong != QChar::DirL)
+ case U_RIGHT_TO_LEFT:
+ case U_RIGHT_TO_LEFT_ARABIC:
+ case U_EUROPEAN_NUMBER:
+ case U_ARABIC_NUMBER:
+ if (bidi.status.last != U_EUROPEAN_NUMBER || bidi.status.lastStrong != U_LEFT_TO_RIGHT)
appendRun(bidi);
break;
- case QChar::DirL:
+ case U_LEFT_TO_RIGHT:
break;
- case QChar::DirES:
- case QChar::DirET:
- case QChar::DirCS:
- case QChar::DirBN:
- case QChar::DirB:
- case QChar::DirS:
- case QChar::DirWS:
- case QChar::DirON:
- if (bidi.status.eor == QChar::DirEN) {
- if (bidi.status.lastStrong != QChar::DirL) {
+ case U_EUROPEAN_NUMBER_SEPARATOR:
+ case U_EUROPEAN_NUMBER_TERMINATOR:
+ case U_COMMON_NUMBER_SEPARATOR:
+ case U_BOUNDARY_NEUTRAL:
+ case U_BLOCK_SEPARATOR:
+ case U_SEGMENT_SEPARATOR:
+ case U_WHITE_SPACE_NEUTRAL:
+ case U_OTHER_NEUTRAL:
+ if (bidi.status.eor == U_EUROPEAN_NUMBER) {
+ if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
// the numbers need to be on a higher embedding level, so let's close that run
- bidi.dir = QChar::DirEN;
+ bidi.dir = U_EUROPEAN_NUMBER;
appendRun(bidi);
- if (bidi.context->dir() != QChar::DirL) {
+ if (bidi.context->dir() != U_LEFT_TO_RIGHT) {
// the neutrals take the embedding direction, which is R
bidi.eor = bidi.last;
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
appendRun(bidi);
}
}
- } else if (bidi.status.eor == QChar::DirAN) {
+ } else if (bidi.status.eor == U_ARABIC_NUMBER) {
// Arabic numbers are always on a higher embedding level, so let's close that run
- bidi.dir = QChar::DirAN;
+ bidi.dir = U_ARABIC_NUMBER;
appendRun(bidi);
- if (bidi.context->dir() != QChar::DirL) {
+ if (bidi.context->dir() != U_LEFT_TO_RIGHT) {
// the neutrals take the embedding direction, which is R
bidi.eor = bidi.last;
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
appendRun(bidi);
}
- } else if(bidi.status.eor != QChar::DirL) {
+ } else if(bidi.status.eor != U_LEFT_TO_RIGHT) {
//last stuff takes embedding dir
- if (bidi.context->dir() != QChar::DirL && bidi.status.lastStrong != QChar::DirL) {
+ if (bidi.context->dir() != U_LEFT_TO_RIGHT && bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
bidi.eor = bidi.last;
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
}
appendRun(bidi);
}
@@ -1104,34 +1118,34 @@
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = QChar::DirL;
- bidi.status.lastStrong = QChar::DirL;
- bidi.dir = QChar::DirL;
+ bidi.status.eor = U_LEFT_TO_RIGHT;
+ bidi.status.lastStrong = U_LEFT_TO_RIGHT;
+ bidi.dir = U_LEFT_TO_RIGHT;
break;
- case QChar::DirAL:
- case QChar::DirR:
+ case U_RIGHT_TO_LEFT_ARABIC:
+ case U_RIGHT_TO_LEFT:
switch (bidi.status.last) {
- case QChar::DirL:
- case QChar::DirEN:
- case QChar::DirAN:
+ case U_LEFT_TO_RIGHT:
+ case U_EUROPEAN_NUMBER:
+ case U_ARABIC_NUMBER:
appendRun(bidi);
- case QChar::DirR:
- case QChar::DirAL:
+ case U_RIGHT_TO_LEFT:
+ case U_RIGHT_TO_LEFT_ARABIC:
break;
- case QChar::DirES:
- case QChar::DirET:
- case QChar::DirCS:
- case QChar::DirBN:
- case QChar::DirB:
- case QChar::DirS:
- case QChar::DirWS:
- case QChar::DirON:
- if (bidi.status.eor != QChar::DirR && bidi.status.eor != QChar::DirAL) {
+ case U_EUROPEAN_NUMBER_SEPARATOR:
+ case U_EUROPEAN_NUMBER_TERMINATOR:
+ case U_COMMON_NUMBER_SEPARATOR:
+ case U_BOUNDARY_NEUTRAL:
+ case U_BLOCK_SEPARATOR:
+ case U_SEGMENT_SEPARATOR:
+ case U_WHITE_SPACE_NEUTRAL:
+ case U_OTHER_NEUTRAL:
+ if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {
//last stuff takes embedding dir
- if (bidi.context->dir() != QChar::DirR && bidi.status.lastStrong != QChar::DirR
- && bidi.status.lastStrong != QChar::DirAL) {
+ if (bidi.context->dir() != U_RIGHT_TO_LEFT && bidi.status.lastStrong != U_RIGHT_TO_LEFT
+ && bidi.status.lastStrong != U_RIGHT_TO_LEFT_ARABIC) {
bidi.eor = bidi.last;
- bidi.dir = QChar::DirL;
+ bidi.dir = U_LEFT_TO_RIGHT;
}
appendRun(bidi);
}
@@ -1139,99 +1153,99 @@
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = QChar::DirR;
+ bidi.status.eor = U_RIGHT_TO_LEFT;
bidi.status.lastStrong = dirCurrent;
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
break;
// weak types:
- case QChar::DirEN:
- if (bidi.status.lastStrong != QChar::DirAL) {
+ case U_EUROPEAN_NUMBER:
+ if (bidi.status.lastStrong != U_RIGHT_TO_LEFT_ARABIC) {
// if last strong was AL change EN to AN
switch (bidi.status.last) {
- case QChar::DirEN:
- case QChar::DirL:
+ case U_EUROPEAN_NUMBER:
+ case U_LEFT_TO_RIGHT:
break;
- case QChar::DirR:
- case QChar::DirAL:
- case QChar::DirAN:
+ case U_RIGHT_TO_LEFT:
+ case U_RIGHT_TO_LEFT_ARABIC:
+ case U_ARABIC_NUMBER:
bidi.eor = bidi.last;
appendRun(bidi);
- bidi.dir = QChar::DirEN;
+ bidi.dir = U_EUROPEAN_NUMBER;
break;
- case QChar::DirES:
- case QChar::DirCS:
- if (bidi.status.eor == QChar::DirEN)
+ case U_EUROPEAN_NUMBER_SEPARATOR:
+ case U_COMMON_NUMBER_SEPARATOR:
+ if (bidi.status.eor == U_EUROPEAN_NUMBER)
break;
- case QChar::DirET:
- case QChar::DirBN:
- case QChar::DirB:
- case QChar::DirS:
- case QChar::DirWS:
- case QChar::DirON:
- if (bidi.status.eor == QChar::DirR) {
+ case U_EUROPEAN_NUMBER_TERMINATOR:
+ case U_BOUNDARY_NEUTRAL:
+ case U_BLOCK_SEPARATOR:
+ case U_SEGMENT_SEPARATOR:
+ case U_WHITE_SPACE_NEUTRAL:
+ case U_OTHER_NEUTRAL:
+ if (bidi.status.eor == U_RIGHT_TO_LEFT) {
// neutrals go to R
- bidi.eor = bidi.status.last == QChar::DirET ? bidi.lastBeforeET : bidi.last;
+ bidi.eor = bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR ? bidi.lastBeforeET : bidi.last;
appendRun(bidi);
- bidi.dir = QChar::DirEN;
- } else if (bidi.status.eor != QChar::DirL &&
- (bidi.status.eor != QChar::DirEN || bidi.status.lastStrong != QChar::DirL) &&
- bidi.dir != QChar::DirL) {
+ bidi.dir = U_EUROPEAN_NUMBER;
+ } else if (bidi.status.eor != U_LEFT_TO_RIGHT &&
+ (bidi.status.eor != U_EUROPEAN_NUMBER || bidi.status.lastStrong != U_LEFT_TO_RIGHT) &&
+ bidi.dir != U_LEFT_TO_RIGHT) {
// numbers on both sides, neutrals get right to left direction
appendRun(bidi);
- bidi.eor = bidi.status.last == QChar::DirET ? bidi.lastBeforeET : bidi.last;
- bidi.dir = QChar::DirR;
+ bidi.eor = bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR ? bidi.lastBeforeET : bidi.last;
+ bidi.dir = U_RIGHT_TO_LEFT;
appendRun(bidi);
- bidi.dir = QChar::DirEN;
+ bidi.dir = U_EUROPEAN_NUMBER;
}
default:
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = QChar::DirEN;
- if (bidi.dir == QChar::DirON)
- bidi.dir = QChar::DirL;
+ bidi.status.eor = U_EUROPEAN_NUMBER;
+ if (bidi.dir == U_OTHER_NEUTRAL)
+ bidi.dir = U_LEFT_TO_RIGHT;
break;
}
- case QChar::DirAN:
- dirCurrent = QChar::DirAN;
+ case U_ARABIC_NUMBER:
+ dirCurrent = U_ARABIC_NUMBER;
switch (bidi.status.last) {
- case QChar::DirL:
- if (bidi.context->dir() == QChar::DirL)
+ case U_LEFT_TO_RIGHT:
+ if (bidi.context->dir() == U_LEFT_TO_RIGHT)
appendRun(bidi);
break;
- case QChar::DirAN:
+ case U_ARABIC_NUMBER:
break;
- case QChar::DirR:
- case QChar::DirAL:
- case QChar::DirEN:
+ case U_RIGHT_TO_LEFT:
+ case U_RIGHT_TO_LEFT_ARABIC:
+ case U_EUROPEAN_NUMBER:
bidi.eor = bidi.last;
appendRun(bidi);
break;
- case QChar::DirCS:
- if (bidi.status.eor == QChar::DirAN)
+ case U_COMMON_NUMBER_SEPARATOR:
+ if (bidi.status.eor == U_ARABIC_NUMBER)
break;
- case QChar::DirES:
- case QChar::DirET:
- case QChar::DirBN:
- case QChar::DirB:
- case QChar::DirS:
- case QChar::DirWS:
- case QChar::DirON:
- if (bidi.status.eor != QChar::DirR && bidi.status.eor != QChar::DirAL) {
+ case U_EUROPEAN_NUMBER_SEPARATOR:
+ case U_EUROPEAN_NUMBER_TERMINATOR:
+ case U_BOUNDARY_NEUTRAL:
+ case U_BLOCK_SEPARATOR:
+ case U_SEGMENT_SEPARATOR:
+ case U_WHITE_SPACE_NEUTRAL:
+ case U_OTHER_NEUTRAL:
+ if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {
// run of L before neutrals, neutrals take embedding dir (N2)
- if (bidi.context->dir() == QChar::DirR || bidi.status.lastStrong == QChar::DirR
- || bidi.status.lastStrong == QChar::DirAL) {
+ if (bidi.context->dir() == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT
+ || bidi.status.lastStrong == U_RIGHT_TO_LEFT_ARABIC) {
// the embedding direction is R
// close the L run
appendRun(bidi);
// neutrals become an R run
- bidi.dir = QChar::DirR;
+ bidi.dir = U_RIGHT_TO_LEFT;
} else {
// the embedding direction is L
// append neutrals to the L run and close it
- bidi.dir = QChar::DirL;
+ bidi.dir = U_LEFT_TO_RIGHT;
}
}
bidi.eor = bidi.last;
@@ -1240,37 +1254,37 @@
break;
}
bidi.eor = bidi.current;
- bidi.status.eor = QChar::DirAN;
- if (bidi.dir == QChar::DirON)
- bidi.dir = QChar::DirAN;
+ bidi.status.eor = U_ARABIC_NUMBER;
+ if (bidi.dir == U_OTHER_NEUTRAL)
+ bidi.dir = U_ARABIC_NUMBER;
break;
- case QChar::DirES:
- case QChar::DirCS:
+ case U_EUROPEAN_NUMBER_SEPARATOR:
+ case U_COMMON_NUMBER_SEPARATOR:
break;
- case QChar::DirET:
- if (bidi.status.last == QChar::DirEN) {
- dirCurrent = QChar::DirEN;
+ case U_EUROPEAN_NUMBER_TERMINATOR:
+ if (bidi.status.last == U_EUROPEAN_NUMBER) {
+ dirCurrent = U_EUROPEAN_NUMBER;
bidi.eor = bidi.current;
bidi.status.eor = dirCurrent;
- } else if (bidi.status.last != QChar::DirET)
+ } else if (bidi.status.last != U_EUROPEAN_NUMBER_TERMINATOR)
bidi.lastBeforeET = emptyRun ? bidi.eor : bidi.last;
break;
// boundary neutrals should be ignored
- case QChar::DirBN:
+ case U_BOUNDARY_NEUTRAL:
if (bidi.eor == bidi.last)
bidi.eor = bidi.current;
break;
// neutrals
- case QChar::DirB:
+ case U_BLOCK_SEPARATOR:
// ### what do we do with newline and paragraph seperators that come to here?
break;
- case QChar::DirS:
+ case U_SEGMENT_SEPARATOR:
// ### implement rule L1
break;
- case QChar::DirWS:
+ case U_WHITE_SPACE_NEUTRAL:
break;
- case QChar::DirON:
+ case U_OTHER_NEUTRAL:
break;
default:
break;
@@ -1281,13 +1295,13 @@
if (!bidi.reachedEndOfLine) {
bidi.eor = bidi.endOfLine;
switch (bidi.status.eor) {
- case QChar::DirL:
- case QChar::DirR:
- case QChar::DirAN:
+ case U_LEFT_TO_RIGHT:
+ case U_RIGHT_TO_LEFT:
+ case U_ARABIC_NUMBER:
bidi.dir = bidi.status.eor;
break;
- case QChar::DirEN:
- bidi.dir = bidi.status.lastStrong == QChar::DirL ? QChar::DirL : QChar::DirEN;
+ case U_EUROPEAN_NUMBER:
+ bidi.dir = bidi.status.lastStrong == U_LEFT_TO_RIGHT ? U_LEFT_TO_RIGHT : U_EUROPEAN_NUMBER;
break;
default:
assert(false);
@@ -1295,44 +1309,44 @@
appendRun(bidi);
}
bidi = stateAtEnd;
- bidi.dir = QChar::DirON;
+ bidi.dir = U_OTHER_NEUTRAL;
break;
}
}
// set status.last as needed.
switch (dirCurrent) {
- case QChar::DirET:
- if (bidi.status.last != QChar::DirEN)
- bidi.status.last = QChar::DirET;
+ case U_EUROPEAN_NUMBER_TERMINATOR:
+ if (bidi.status.last != U_EUROPEAN_NUMBER)
+ bidi.status.last = U_EUROPEAN_NUMBER_TERMINATOR;
break;
- case QChar::DirES:
- case QChar::DirCS:
- case QChar::DirS:
- case QChar::DirWS:
- case QChar::DirON:
+ case U_EUROPEAN_NUMBER_SEPARATOR:
+ case U_COMMON_NUMBER_SEPARATOR:
+ case U_SEGMENT_SEPARATOR:
+ case U_WHITE_SPACE_NEUTRAL:
+ case U_OTHER_NEUTRAL:
switch(bidi.status.last) {
- case QChar::DirL:
- case QChar::DirR:
- case QChar::DirAL:
- case QChar::DirEN:
- case QChar::DirAN:
+ case U_LEFT_TO_RIGHT:
+ case U_RIGHT_TO_LEFT:
+ case U_RIGHT_TO_LEFT_ARABIC:
+ case U_EUROPEAN_NUMBER:
+ case U_ARABIC_NUMBER:
bidi.status.last = dirCurrent;
break;
default:
- bidi.status.last = QChar::DirON;
+ bidi.status.last = U_OTHER_NEUTRAL;
}
break;
- case QChar::DirNSM:
- case QChar::DirBN:
- case QChar::DirRLE:
- case QChar::DirLRE:
- case QChar::DirRLO:
- case QChar::DirLRO:
- case QChar::DirPDF:
+ case U_DIR_NON_SPACING_MARK:
+ case U_BOUNDARY_NEUTRAL:
+ case U_RIGHT_TO_LEFT_EMBEDDING:
+ case U_LEFT_TO_RIGHT_EMBEDDING:
+ case U_RIGHT_TO_LEFT_OVERRIDE:
+ case U_LEFT_TO_RIGHT_OVERRIDE:
+ case U_POP_DIRECTIONAL_FORMAT:
// ignore these
break;
- case QChar::DirEN:
+ case U_EUROPEAN_NUMBER:
// fall through
default:
bidi.status.last = dirCurrent;
@@ -1340,7 +1354,11 @@
bidi.last = bidi.current;
- if (emptyRun && !(dirCurrent == QChar::DirRLE || dirCurrent == QChar::DirLRE || dirCurrent == QChar::DirRLO || dirCurrent == QChar::DirLRO || dirCurrent == QChar::DirPDF)) {
+ if (emptyRun && !(dirCurrent == U_RIGHT_TO_LEFT_EMBEDDING
+ || dirCurrent == U_LEFT_TO_RIGHT_EMBEDDING
+ || dirCurrent == U_RIGHT_TO_LEFT_OVERRIDE
+ || dirCurrent == U_LEFT_TO_RIGHT_OVERRIDE
+ || dirCurrent == U_POP_DIRECTIONAL_FORMAT)) {
bidi.sor = bidi.current;
emptyRun = false;
}
@@ -1350,7 +1368,11 @@
bidi.adjustEmbedding = true;
bidi.current.increment(bidi);
bidi.adjustEmbedding = false;
- if (emptyRun && (dirCurrent == QChar::DirRLE || dirCurrent == QChar::DirLRE || dirCurrent == QChar::DirRLO || dirCurrent == QChar::DirLRO || dirCurrent == QChar::DirPDF)) {
+ if (emptyRun && (dirCurrent == U_RIGHT_TO_LEFT_EMBEDDING
+ || dirCurrent == U_LEFT_TO_RIGHT_EMBEDDING
+ || dirCurrent == U_RIGHT_TO_LEFT_OVERRIDE
+ || dirCurrent == U_LEFT_TO_RIGHT_OVERRIDE
+ || dirCurrent == U_POP_DIRECTIONAL_FORMAT)) {
// exclude the embedding char itself from the new run so that ATSUI will never see it
bidi.eor.obj = 0;
bidi.last = bidi.current;
@@ -1533,18 +1555,18 @@
BidiContext *startEmbed;
if (style()->direction() == LTR) {
- startEmbed = new BidiContext( 0, QChar::DirL, NULL, style()->unicodeBidi() == Override );
- bidi.status.eor = QChar::DirL;
+ startEmbed = new BidiContext( 0, U_LEFT_TO_RIGHT, NULL, style()->unicodeBidi() == Override );
+ bidi.status.eor = U_LEFT_TO_RIGHT;
} else {
- startEmbed = new BidiContext( 1, QChar::DirR, NULL, style()->unicodeBidi() == Override );
- bidi.status.eor = QChar::DirR;
+ startEmbed = new BidiContext( 1, U_RIGHT_TO_LEFT, NULL, style()->unicodeBidi() == Override );
+ bidi.status.eor = U_RIGHT_TO_LEFT;
}
bidi.status.lastStrong = startEmbed->dir();
bidi.status.last = startEmbed->dir();
bidi.status.eor = startEmbed->dir();
bidi.context = startEmbed;
- bidi.dir = QChar::DirON;
+ bidi.dir = U_OTHER_NEUTRAL;
if (!smidpoints)
smidpoints = new DeprecatedArray<BidiIterator>;
@@ -1873,7 +1895,7 @@
static inline bool skipNonBreakingSpace(BidiIterator &it)
{
- if (it.obj->style()->nbspMode() != SPACE || it.current().unicode() != nonBreakingSpace)
+ if (it.obj->style()->nbspMode() != SPACE || it.current() != nonBreakingSpace)
return false;
// FIXME: This is bad. It makes nbsp inconsistent with space and won't work correctly
@@ -1901,7 +1923,7 @@
int w = lineWidth(m_height);
while (!it.atEnd() && (it.obj->isInlineFlow() || (shouldCollapseWhiteSpace(it.obj->style()) && !it.obj->isBR() &&
(it.current() == ' ' || it.current() == '\t' || (!it.obj->style()->preserveNewline() && it.current() == '\n') ||
- it.current().unicode() == SOFT_HYPHEN || skipNonBreakingSpace(it) || it.obj->isFloatingOrPositioned())))) {
+ it.current() == SOFT_HYPHEN || skipNonBreakingSpace(it) || it.obj->isFloatingOrPositioned())))) {
if (it.obj->isFloatingOrPositioned()) {
RenderObject *o = it.obj;
// add to special objects...
@@ -2102,8 +2124,7 @@
RenderObject* next = bidiNext(start.block, o, bidi);
if (style()->collapseWhiteSpace() && next && !next->isBR() && next->isText() && static_cast<RenderText*>(next)->stringLength() > 0) {
RenderText *nextText = static_cast<RenderText*>(next);
- QChar nextChar = nextText->text()[0];
-
+ UChar nextChar = nextText->text()[0];
if (nextText->style()->isCollapsibleWhiteSpace(nextChar)) {
currentCharacterIsSpace = true;
currentCharacterIsWS = true;
@@ -2118,7 +2139,7 @@
RenderText *t = static_cast<RenderText *>(o);
int strlen = t->stringLength();
int len = strlen - pos;
- const QChar* str = t->text();
+ const UChar* str = t->text();
const Font *f = t->font(m_firstLine);
// proportional font, needs a bit more work.
@@ -2134,14 +2155,14 @@
while (len) {
bool previousCharacterIsSpace = currentCharacterIsSpace;
bool previousCharacterIsWS = currentCharacterIsWS;
- const QChar c = str[pos];
+ UChar c = str[pos];
currentCharacterIsSpace = c == ' ' || c == '\t' || (!o->style()->preserveNewline() && (c == '\n'));
if (!o->style()->collapseWhiteSpace() || !currentCharacterIsSpace)
isLineEmpty = false;
// Check for soft hyphens. Go ahead and ignore them.
- if (c.unicode() == SOFT_HYPHEN) {
+ if (c == SOFT_HYPHEN) {
if (!ignoringSpaces) {
// Ignore soft hyphens
BidiIterator endMid;
@@ -2181,7 +2202,7 @@
// 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.unicode() == nonBreakingSpace);
+ currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == nonBreakingSpace);
if (breakWords)
wrapW += t->width(pos, 1, f, w+wrapW);
@@ -2266,7 +2287,7 @@
} else {
if (midWordBreak)
tmpW -= additionalTmpW;
- if (pos > 0 && str[pos-1].unicode() == SOFT_HYPHEN)
+ if (pos > 0 && str[pos-1] == SOFT_HYPHEN)
// Subtract the width of the soft hyphen out since we fit on a line.
tmpW -= t->width(pos-1, 1, f, w+tmpW);
}
@@ -2369,13 +2390,12 @@
checkForBreak = false;
RenderText* nextText = static_cast<RenderText*>(next);
if (nextText->stringLength() != 0) {
- QChar c = nextText->text()[0];
- if (c == ' ' || c == '\t' || (c == '\n' && !next->style()->preserveNewline())) {
+ UChar c = nextText->text()[0];
+ if (c == ' ' || c == '\t' || (c == '\n' && !next->style()->preserveNewline()))
// If the next item on the line is text, and if we did not end with
// a space, then the next text run continues our word (and so it needs to
// keep adding to |tmpW|. Just update and continue.
checkForBreak = true;
- }
}
bool canPlaceOnLine = (w + tmpW <= width) || !autoWrap;
if (canPlaceOnLine && checkForBreak) {
@@ -2508,8 +2528,8 @@
if (lBreak.obj && lBreak.pos >= 2 && lBreak.obj->isText()) {
// For soft hyphens on line breaks, we have to chop out the midpoints that made us
// ignore the hyphen so that it will render at the end of the line.
- QChar c = static_cast<RenderText*>(lBreak.obj)->text()[lBreak.pos-1];
- if (c.unicode() == SOFT_HYPHEN)
+ UChar c = static_cast<RenderText*>(lBreak.obj)->text()[lBreak.pos-1];
+ if (c == SOFT_HYPHEN)
chopMidpointsAt(lBreak.obj, lBreak.pos-2);
}
@@ -2538,8 +2558,8 @@
void RenderBlock::checkLinesForTextOverflow()
{
// Determine the width of the ellipsis using the current font.
- QChar ellipsis = 0x2026; // FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP) if 0x2026 not renderable
- static AtomicString ellipsisStr(ellipsis);
+ const UChar ellipsis = 0x2026; // FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP) if 0x2026 not renderable
+ static AtomicString ellipsisStr(&ellipsis, 1);
const Font& firstLineFont = firstLineStyle()->font();
const Font& font = style()->font();
int firstLineEllipsisWidth = firstLineFont.width(&ellipsis, 1);