Changeset 89864 in webkit
- Timestamp:
- Jun 27, 2011 3:01:38 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r89863 r89864 1 2011-06-27 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Add support for unicode-bidi:plaintext CSS property 6 https://bugs.webkit.org/show_bug.cgi?id=50949 7 Adding support for the 'plaintext' mode of unicode-bidi. 8 9 * fast/text/international/unicode-bidi-plaintext.html: Added. 10 * platform/chromium-linux/fast/text/international/unicode-bidi-plaintext-expected.txt: added 11 * platform/mac/fast/text/international/unicode-bidi-plaintext-expected.png: Added. 12 * platform/mac/fast/text/international/unicode-bidi-plaintext-expected.txt: Added. 13 1 14 2011-06-27 Jessie Berlin <jberlin@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r89858 r89864 1 2011-06-27 Levi Weintraub <leviw@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Add support for unicode-bidi:plaintext CSS property 6 https://bugs.webkit.org/show_bug.cgi?id=50949 7 8 Adding support for unicode-bidi: plaintext. This involves invoking P2 and P3 9 of the Unicode BiDi algorithm on each paragraph of a block with that style. 10 This is similar to dir=auto but done per-paragraph instead of per element. 11 12 Test: fast/text/international/unicode-bidi-plaintext.html 13 14 * css/CSSParser.cpp: 15 (WebCore::CSSParser::parseValue): Added plaintext. 16 * css/CSSPrimitiveValueMappings.h: 17 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Ditto. 18 (WebCore::CSSPrimitiveValue::operator EUnicodeBidi): Ditto. 19 * css/CSSValueKeywords.in: Ditto. 20 * html/HTMLElement.cpp: 21 (WebCore::unicodeBidiAttributeForDirAuto): Helper to map elements with dir=auto 22 to their proper unicode-bidi attribute. 23 (WebCore::HTMLElement::parseMappedAttribute): Assign plaintext to pre and textarea 24 when dir=auto. 25 * platform/text/UnicodeBidi.h: Added plaintext. 26 * rendering/RenderBlockLineLayout.cpp: 27 (WebCore::determineParagraphDirection): Determines the direction of a paragraph 28 based on the first strong character. Stops at first paragraph separator. 29 (WebCore::RenderBlock::layoutInlineChildren): Uses determineParagraphDirection 30 when in unicode-bidi: plaintext mode (and operating at the block's BidiContext) 31 to set each paragraph to the proper base BidiContext. 32 (WebCore::RenderBlock::determineStartPosition): Ditto. 33 * rendering/style/RenderStyle.h: Gave _unicodebidi another bit to accomodate 34 for plaintext. 35 1 36 2011-06-27 Alexis Menard <alexis.menard@openbossa.org> 2 37 -
trunk/Source/WebCore/css/CSSParser.cpp
r89712 r89864 861 861 return parseQuotes(propId, important); 862 862 break; 863 case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | inherit863 case CSSPropertyUnicodeBidi: // normal | embed | bidi-override | isolate | plaintext | inherit 864 864 if (id == CSSValueNormal 865 865 || id == CSSValueEmbed 866 866 || id == CSSValueBidiOverride 867 || id == CSSValueWebkitIsolate) 867 || id == CSSValueWebkitIsolate 868 || id == CSSValueWebkitPlaintext) 868 869 validPrimitive = true; 869 870 break; -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r89495 r89864 1772 1772 case Isolate: 1773 1773 m_value.ident = CSSValueWebkitIsolate; 1774 break; 1775 case Plaintext: 1776 m_value.ident = CSSValueWebkitPlaintext; 1777 break; 1774 1778 } 1775 1779 } … … 1786 1790 case CSSValueWebkitIsolate: 1787 1791 return Isolate; 1792 case CSSValueWebkitPlaintext: 1793 return Plaintext; 1788 1794 default: 1789 1795 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/css/CSSValueKeywords.in
r89712 r89864 411 411 invert 412 412 -webkit-isolate 413 -webkit-plaintext 413 414 landscape 414 415 ledger -
trunk/Source/WebCore/html/HTMLElement.cpp
r87125 r89864 126 126 return StyledElement::mapToEntry(attrName, result); 127 127 } 128 128 129 static inline int unicodeBidiAttributeForDirAuto(HTMLElement* element) 130 { 131 if (element->hasLocalName(bdoTag)) 132 return CSSValueBidiOverride; 133 if (element->hasLocalName(preTag) || element->hasLocalName(textareaTag)) 134 return CSSValueWebkitPlaintext; 135 return CSSValueEmbed; 136 } 137 129 138 void HTMLElement::parseMappedAttribute(Attribute* attr) 130 139 { … … 157 166 addCSSProperty(attr, CSSPropertyDirection, attr->value()); 158 167 dirAttributeChanged(attr); 159 addCSSProperty(attr, CSSPropertyUnicodeBidi, hasLocalName(bdoTag) ? CSSValueBidiOverride : CSSValueEmbed);168 addCSSProperty(attr, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); 160 169 } else if (attr->name() == draggableAttr) { 161 170 const AtomicString& value = attr->value(); -
trunk/Source/WebCore/platform/text/UnicodeBidi.h
r82828 r89864 33 33 Embed, 34 34 Override, 35 Isolate 35 Isolate, 36 Plaintext 36 37 }; 37 38 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r89769 r89864 111 111 } 112 112 return extraWidth; 113 } 114 115 static void determineParagraphDirection(TextDirection& dir, InlineIterator iter) 116 { 117 while (!iter.atEnd()) { 118 if (iter.atParagraphSeparator()) 119 return; 120 if (UChar current = iter.current()) { 121 Direction charDirection = direction(current); 122 if (charDirection == LeftToRight) { 123 dir = LTR; 124 return; 125 } 126 if (charDirection == RightToLeft || charDirection == RightToLeftArabic) { 127 dir = RTL; 128 return; 129 } 130 } 131 iter.increment(); 132 } 113 133 } 114 134 … … 945 965 946 966 InlineIterator oldEnd = end; 967 bool isNewUBAParagraph = lineInfo.previousLineBrokeCleanly(); 947 968 FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0; 948 969 end = lineBreaker.nextLineBreak(resolver, lineInfo, lineBreakIteratorInfo, lastFloatFromPreviousLine); … … 963 984 } else { 964 985 VisualDirectionOverride override = (style()->rtlOrdering() == VisualOrder ? (style()->direction() == LTR ? VisualLeftToRightOverride : VisualRightToLeftOverride) : NoVisualOverride); 986 987 if (isNewUBAParagraph && style()->unicodeBidi() == Plaintext && !resolver.context()->parent()) { 988 TextDirection direction = style()->direction(); 989 determineParagraphDirection(direction, resolver.position()); 990 resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); 991 } 965 992 // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine. 966 993 BidiRunList<BidiRun>& bidiRuns = resolver.runs(); … … 1350 1377 resolver.setStatus(last->lineBreakBidiStatus()); 1351 1378 } else { 1352 resolver.setStatus(BidiStatus(style()->direction(), style()->unicodeBidi() == Override)); 1379 TextDirection direction = style()->direction(); 1380 if (style()->unicodeBidi() == Plaintext) 1381 determineParagraphDirection(direction, InlineIterator(this, bidiFirstNotSkippingInlines(this), 0)); 1382 resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); 1353 1383 resolver.setPosition(InlineIterator(this, bidiFirstSkippingInlines(this, &resolver), 0)); 1354 1384 } -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r89142 r89864 257 257 bool _affectedByDrag : 1; 258 258 unsigned _pseudoBits : 7; 259 unsigned _unicodeBidi : 2; // EUnicodeBidi259 unsigned _unicodeBidi : 3; // EUnicodeBidi 260 260 bool _isLink : 1; 261 // 5 0bits261 // 53 bits 262 262 } noninherited_flags; 263 263
Note: See TracChangeset
for help on using the changeset viewer.