Changeset 80438 in webkit
- Timestamp:
- Mar 6, 2011 2:44:48 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80430 r80438 1 2011-03-06 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 <rdar://problem/9093327> Implement -hyphenate-limit-{before,after} 6 https://bugs.webkit.org/show_bug.cgi?id=55850 7 8 * fast/css/getComputedStyle/computed-style-expected.txt: 9 * fast/css/parsing-hyphenate-limit-expected.txt: Added. 10 * fast/css/parsing-hyphenate-limit.html: Added. 11 * fast/text/hyphenate-limit-before-after.html: Added. 12 * platform/mac/fast/text/hyphenate-limit-before-after-expected.checksum: Added. 13 * platform/mac/fast/text/hyphenate-limit-before-after-expected.png: Added. 14 * platform/mac/fast/text/hyphenate-limit-before-after-expected.txt: Added. 15 * svg/css/getComputedStyle-basic-expected.txt: 16 1 17 2011-03-05 Sheriff Bot <webkit.review.bot@gmail.com> 2 18 -
trunk/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
r74538 r80438 138 138 -webkit-font-smoothing: auto; 139 139 -webkit-highlight: none; 140 -webkit-hyphenate-character: auto; 141 -webkit-hyphenate-limit-after: auto; 142 -webkit-hyphenate-limit-before: auto; 143 -webkit-hyphens: manual; 140 144 -webkit-line-break: normal; 141 145 -webkit-line-clamp: none; 146 -webkit-locale: auto; 142 147 -webkit-margin-before-collapse: collapse; 143 148 -webkit-margin-after-collapse: collapse; … … 161 166 -webkit-text-combine: none; 162 167 -webkit-text-decorations-in-effect: none; 168 -webkit-text-emphasis-color: rgb(0, 0, 0); 169 -webkit-text-emphasis-position: over; 170 -webkit-text-emphasis-style: none; 163 171 -webkit-text-fill-color: rgb(0, 0, 0); 164 172 -webkit-text-security: none; -
trunk/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
r79675 r80438 273 273 rect: style.getPropertyValue(-webkit-highlight) : none 274 274 rect: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue] 275 rect: style.getPropertyValue(-webkit-hyphenate-character) : auto 276 rect: style.getPropertyCSSValue(-webkit-hyphenate-character) : [object CSSPrimitiveValue] 277 rect: style.getPropertyValue(-webkit-hyphenate-limit-after) : auto 278 rect: style.getPropertyCSSValue(-webkit-hyphenate-limit-after) : [object CSSPrimitiveValue] 279 rect: style.getPropertyValue(-webkit-hyphenate-limit-before) : auto 280 rect: style.getPropertyCSSValue(-webkit-hyphenate-limit-before) : [object CSSPrimitiveValue] 281 rect: style.getPropertyValue(-webkit-hyphens) : manual 282 rect: style.getPropertyCSSValue(-webkit-hyphens) : [object CSSPrimitiveValue] 275 283 rect: style.getPropertyValue(-webkit-line-break) : normal 276 284 rect: style.getPropertyCSSValue(-webkit-line-break) : [object CSSPrimitiveValue] 277 285 rect: style.getPropertyValue(-webkit-line-clamp) : none 278 286 rect: style.getPropertyCSSValue(-webkit-line-clamp) : [object CSSPrimitiveValue] 287 rect: style.getPropertyValue(-webkit-locale) : auto 288 rect: style.getPropertyCSSValue(-webkit-locale) : [object CSSPrimitiveValue] 279 289 rect: style.getPropertyValue(-webkit-margin-before-collapse) : collapse 280 290 rect: style.getPropertyCSSValue(-webkit-margin-before-collapse) : [object CSSPrimitiveValue] … … 319 329 rect: style.getPropertyValue(-webkit-text-decorations-in-effect) : none 320 330 rect: style.getPropertyCSSValue(-webkit-text-decorations-in-effect) : [object CSSPrimitiveValue] 331 rect: style.getPropertyValue(-webkit-text-emphasis-color) : rgb(0, 0, 0) 332 rect: style.getPropertyCSSValue(-webkit-text-emphasis-color) : [object CSSPrimitiveValue] 333 rect: style.getPropertyValue(-webkit-text-emphasis-position) : over 334 rect: style.getPropertyCSSValue(-webkit-text-emphasis-position) : [object CSSPrimitiveValue] 335 rect: style.getPropertyValue(-webkit-text-emphasis-style) : none 336 rect: style.getPropertyCSSValue(-webkit-text-emphasis-style) : [object CSSPrimitiveValue] 321 337 rect: style.getPropertyValue(-webkit-text-fill-color) : rgb(0, 0, 0) 322 338 rect: style.getPropertyCSSValue(-webkit-text-fill-color) : [object CSSPrimitiveValue] … … 699 715 g: style.getPropertyValue(-webkit-highlight) : none 700 716 g: style.getPropertyCSSValue(-webkit-highlight) : [object CSSPrimitiveValue] 717 g: style.getPropertyValue(-webkit-hyphenate-character) : auto 718 g: style.getPropertyCSSValue(-webkit-hyphenate-character) : [object CSSPrimitiveValue] 719 g: style.getPropertyValue(-webkit-hyphenate-limit-after) : auto 720 g: style.getPropertyCSSValue(-webkit-hyphenate-limit-after) : [object CSSPrimitiveValue] 721 g: style.getPropertyValue(-webkit-hyphenate-limit-before) : auto 722 g: style.getPropertyCSSValue(-webkit-hyphenate-limit-before) : [object CSSPrimitiveValue] 723 g: style.getPropertyValue(-webkit-hyphens) : manual 724 g: style.getPropertyCSSValue(-webkit-hyphens) : [object CSSPrimitiveValue] 701 725 g: style.getPropertyValue(-webkit-line-break) : normal 702 726 g: style.getPropertyCSSValue(-webkit-line-break) : [object CSSPrimitiveValue] 703 727 g: style.getPropertyValue(-webkit-line-clamp) : none 704 728 g: style.getPropertyCSSValue(-webkit-line-clamp) : [object CSSPrimitiveValue] 729 g: style.getPropertyValue(-webkit-locale) : auto 730 g: style.getPropertyCSSValue(-webkit-locale) : [object CSSPrimitiveValue] 705 731 g: style.getPropertyValue(-webkit-margin-before-collapse) : collapse 706 732 g: style.getPropertyCSSValue(-webkit-margin-before-collapse) : [object CSSPrimitiveValue] … … 745 771 g: style.getPropertyValue(-webkit-text-decorations-in-effect) : none 746 772 g: style.getPropertyCSSValue(-webkit-text-decorations-in-effect) : [object CSSPrimitiveValue] 773 g: style.getPropertyValue(-webkit-text-emphasis-color) : rgb(0, 0, 0) 774 g: style.getPropertyCSSValue(-webkit-text-emphasis-color) : [object CSSPrimitiveValue] 775 g: style.getPropertyValue(-webkit-text-emphasis-position) : over 776 g: style.getPropertyCSSValue(-webkit-text-emphasis-position) : [object CSSPrimitiveValue] 777 g: style.getPropertyValue(-webkit-text-emphasis-style) : none 778 g: style.getPropertyCSSValue(-webkit-text-emphasis-style) : [object CSSPrimitiveValue] 747 779 g: style.getPropertyValue(-webkit-text-fill-color) : rgb(0, 0, 0) 748 780 g: style.getPropertyCSSValue(-webkit-text-fill-color) : [object CSSPrimitiveValue] -
trunk/Source/WebCore/ChangeLog
r80435 r80438 1 2011-03-06 Dan Bernstein <mitz@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 <rdar://problem/9093327> Implement -hyphenate-limit-{before,after} 6 https://bugs.webkit.org/show_bug.cgi?id=55850 7 8 Tests: fast/css/parsing-hyphenate-limit.html 9 fast/text/hyphenate-limit-before-after.html 10 11 * css/CSSComputedStyleDeclaration.cpp: 12 (WebCore::computedProperties) Updated this array with the new properties and some old properties 13 that it was missing. 14 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Added 15 CSSPropertyWebkitHyphenateLimit{Before,After}. 16 17 * css/CSSParser.cpp: 18 (WebCore::CSSParser::parseValue): Parse -webkit-hyphenate-limit-{before,after}, allowing 19 'auto' and non-negative integers. 20 21 * css/CSSPropertyNames.in: Added -webkit-hyphenate-limit-{before,after}. 22 23 * css/CSSStyleSelector.cpp: 24 (WebCore::CSSStyleSelector::applyProperty): Handle CSSPropertyWebkitHyphenateLimit{Before,After}. 25 26 * rendering/RenderBlockLineLayout.cpp: 27 (WebCore::tryHyphenating): Added minimum prefix and suffix length parameters and checks to only 28 allow hyphenation if the prefix and the suffix are sufficiently long. 29 (WebCore::RenderBlock::findNextLineBreak): Pass the limits to tryHyphenating(). 30 31 * rendering/style/RenderStyle.cpp: 32 (WebCore::RenderStyle::diff): A difference in hyphenation limits is a layout difference. 33 34 * rendering/style/RenderStyle.h: 35 (WebCore::InheritedFlags::hyphenationLimitBefore): Added. 36 (WebCore::InheritedFlags::hyphenationLimitAfter): Added. 37 (WebCore::InheritedFlags::setHyphenationLimitBefore): Added. 38 (WebCore::InheritedFlags::setHyphenationLimitAfter): Added. 39 (WebCore::InheritedFlags::initialHyphenationLimitBefore): Added. Returns -1, which is the 40 representation of 'auto'. 41 (WebCore::InheritedFlags::initialHyphenationLimitAfter): Ditto. 42 43 * rendering/style/StyleRareInheritedData.cpp: 44 (WebCore::StyleRareInheritedData::StyleRareInheritedData): Initialize hyphenation limits. 45 (WebCore::StyleRareInheritedData::operator==): Compare hyphenation limits. 46 * rendering/style/StyleRareInheritedData.h: 47 1 48 2011-03-06 Jessie Berlin <jberlin@apple.com> 2 49 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r80288 r80438 196 196 CSSPropertyWebkitFontSmoothing, 197 197 CSSPropertyWebkitHighlight, 198 CSSPropertyWebkitHyphenateCharacter, 199 CSSPropertyWebkitHyphenateLimitAfter, 200 CSSPropertyWebkitHyphenateLimitBefore, 201 CSSPropertyWebkitHyphens, 198 202 CSSPropertyWebkitLineBreak, 199 203 CSSPropertyWebkitLineClamp, 204 CSSPropertyWebkitLocale, 200 205 CSSPropertyWebkitMarginBeforeCollapse, 201 206 CSSPropertyWebkitMarginAfterCollapse, … … 219 224 CSSPropertyWebkitTextCombine, 220 225 CSSPropertyWebkitTextDecorationsInEffect, 226 CSSPropertyWebkitTextEmphasisColor, 227 CSSPropertyWebkitTextEmphasisPosition, 228 CSSPropertyWebkitTextEmphasisStyle, 221 229 CSSPropertyWebkitTextFillColor, 222 230 CSSPropertyWebkitTextSecurity, … … 1117 1125 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1118 1126 return CSSPrimitiveValue::create(style->hyphenationString(), CSSPrimitiveValue::CSS_STRING); 1127 case CSSPropertyWebkitHyphenateLimitAfter: 1128 if (style->hyphenationLimitAfter() < 0) 1129 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1130 return CSSPrimitiveValue::create(style->hyphenationLimitAfter(), CSSPrimitiveValue::CSS_NUMBER); 1131 case CSSPropertyWebkitHyphenateLimitBefore: 1132 if (style->hyphenationLimitBefore() < 0) 1133 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); 1134 return CSSPrimitiveValue::create(style->hyphenationLimitBefore(), CSSPrimitiveValue::CSS_NUMBER); 1119 1135 case CSSPropertyWebkitBorderFit: 1120 1136 if (style->borderFit() == BorderFitBorder) -
trunk/Source/WebCore/css/CSSParser.cpp
r80288 r80438 1597 1597 case CSSPropertyWebkitHyphenateCharacter: 1598 1598 if (id == CSSValueAuto || value->unit == CSSPrimitiveValue::CSS_STRING) 1599 validPrimitive = true; 1600 break; 1601 1602 case CSSPropertyWebkitHyphenateLimitBefore: 1603 case CSSPropertyWebkitHyphenateLimitAfter: 1604 if (id == CSSValueAuto || validUnit(value, FInteger | FNonNeg, true)) 1599 1605 validPrimitive = true; 1600 1606 break; -
trunk/Source/WebCore/css/CSSPropertyNames.in
r80288 r80438 228 228 -webkit-highlight 229 229 -webkit-hyphenate-character 230 -webkit-hyphenate-limit-after 231 -webkit-hyphenate-limit-before 230 232 -webkit-hyphens 231 233 -webkit-line-break -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r80383 r80438 5760 5760 return; 5761 5761 } 5762 case CSSPropertyWebkitHyphenateLimitAfter: { 5763 HANDLE_INHERIT_AND_INITIAL(hyphenationLimitAfter, HyphenationLimitAfter); 5764 if (primitiveValue->getIdent() == CSSValueAuto) 5765 m_style->setHyphenationLimitAfter(-1); 5766 else 5767 m_style->setHyphenationLimitAfter(min(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_NUMBER), static_cast<int>(numeric_limits<short>::max()))); 5768 return; 5769 } 5770 case CSSPropertyWebkitHyphenateLimitBefore: { 5771 HANDLE_INHERIT_AND_INITIAL(hyphenationLimitBefore, HyphenationLimitBefore); 5772 if (primitiveValue->getIdent() == CSSValueAuto) 5773 m_style->setHyphenationLimitBefore(-1); 5774 else 5775 m_style->setHyphenationLimitBefore(min(primitiveValue->getIntValue(CSSPrimitiveValue::CSS_NUMBER), static_cast<int>(numeric_limits<short>::max()))); 5776 return; 5777 } 5762 5778 case CSSPropertyWebkitLocale: { 5763 5779 HANDLE_INHERIT_AND_INITIAL(locale, Locale); -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r80380 r80438 1412 1412 } 1413 1413 1414 static void tryHyphenating(RenderText* text, const Font& font, const AtomicString& localeIdentifier, int lastSpace, int pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated) 1415 { 1414 static void tryHyphenating(RenderText* text, const Font& font, const AtomicString& localeIdentifier, int minimumPrefixLength, int minimumSuffixLength, int lastSpace, int pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated) 1415 { 1416 // Map 'hyphenate-limit-{before,after}: auto;' to 2. 1417 if (minimumPrefixLength < 0) 1418 minimumPrefixLength = 2; 1419 1420 if (minimumSuffixLength < 0) 1421 minimumSuffixLength = 2; 1422 1423 if (pos - lastSpace <= minimumSuffixLength) 1424 return; 1425 1416 1426 const AtomicString& hyphenString = text->style()->hyphenString(); 1417 1427 int hyphenWidth = font.width(TextRun(hyphenString.characters(), hyphenString.length())); … … 1424 1434 1425 1435 unsigned prefixLength = font.offsetForPosition(TextRun(text->characters() + lastSpace, pos - lastSpace, !collapseWhiteSpace, xPos + lastSpaceWordSpacing), maxPrefixWidth, false); 1426 if ( !prefixLength)1436 if (prefixLength < static_cast<unsigned>(minimumPrefixLength)) 1427 1437 return; 1428 1438 1429 prefixLength = lastHyphenLocation(text->characters() + lastSpace, pos - lastSpace, prefixLength + 1, localeIdentifier); 1430 if (!prefixLength) 1439 prefixLength = lastHyphenLocation(text->characters() + lastSpace, pos - lastSpace, min(prefixLength, static_cast<unsigned>(pos - lastSpace - minimumSuffixLength)) + 1, localeIdentifier); 1440 // FIXME: The following assumes that the character at lastSpace is a space (and therefore should not factor 1441 // into hyphenate-limit-before) unless lastSpace is 0. This is wrong in the rare case of hyphenating 1442 // the first word in a text node which has leading whitespace. 1443 if (prefixLength - (lastSpace ? 1 : 0) < static_cast<unsigned>(minimumPrefixLength)) 1431 1444 return; 1445 1446 ASSERT(pos - lastSpace - prefixLength >= static_cast<unsigned>(minimumSuffixLength)); 1432 1447 1433 1448 #if !ASSERT_DISABLED … … 1796 1811 if (lineWasTooWide || w + tmpW > width) { 1797 1812 if (canHyphenate && w + tmpW > width) { 1798 tryHyphenating(t, f, style->locale(), lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);1813 tryHyphenating(t, f, style->locale(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated); 1799 1814 if (hyphenated) 1800 1815 goto end; … … 1914 1929 1915 1930 if (canHyphenate && w + tmpW > width) { 1916 tryHyphenating(t, f, style->locale(), lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated);1931 tryHyphenating(t, f, style->locale(), style->hyphenationLimitBefore(), style->hyphenationLimitAfter(), lastSpace, pos, w + tmpW - additionalTmpW, width, isFixedPitch, collapseWhiteSpace, lastSpaceWordSpacing, lBreak, nextBreakable, hyphenated); 1917 1932 if (hyphenated) 1918 1933 goto end; -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r80288 r80438 406 406 rareInheritedData->textSecurity != other->rareInheritedData->textSecurity || 407 407 rareInheritedData->hyphens != other->rareInheritedData->hyphens || 408 rareInheritedData->hyphenationLimitBefore != other->rareInheritedData->hyphenationLimitBefore || 409 rareInheritedData->hyphenationLimitAfter != other->rareInheritedData->hyphenationLimitAfter || 408 410 rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString || 409 411 rareInheritedData->locale != other->rareInheritedData->locale || -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r80288 r80438 695 695 const AtomicString& highlight() const { return rareInheritedData->highlight; } 696 696 Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); } 697 short hyphenationLimitBefore() const { return rareInheritedData->hyphenationLimitBefore; } 698 short hyphenationLimitAfter() const { return rareInheritedData->hyphenationLimitAfter; } 697 699 const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; } 698 700 const AtomicString& locale() const { return rareInheritedData->locale; } … … 1048 1050 void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); } 1049 1051 void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); } 1052 void setHyphenationLimitBefore(short limit) { SET_VAR(rareInheritedData, hyphenationLimitBefore, limit); } 1053 void setHyphenationLimitAfter(short limit) { SET_VAR(rareInheritedData, hyphenationLimitAfter, limit); } 1050 1054 void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); } 1051 1055 void setLocale(const AtomicString& locale) { SET_VAR(rareInheritedData, locale, locale); } … … 1274 1278 static ESpeak initialSpeak() { return SpeakNormal; } 1275 1279 static Hyphens initialHyphens() { return HyphensManual; } 1280 static short initialHyphenationLimitBefore() { return -1; } 1281 static short initialHyphenationLimitAfter() { return -1; } 1276 1282 static const AtomicString& initialHyphenationString() { return nullAtom; } 1277 1283 static const AtomicString& initialLocale() { return nullAtom; } -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r80288 r80438 53 53 , textEmphasisMark(TextEmphasisMarkNone) 54 54 , textEmphasisPosition(TextEmphasisPositionOver) 55 , hyphenationLimitBefore(-1) 56 , hyphenationLimitAfter(-1) 55 57 { 56 58 } … … 85 87 , textEmphasisPosition(o.textEmphasisPosition) 86 88 , hyphenationString(o.hyphenationString) 89 , hyphenationLimitBefore(o.hyphenationLimitBefore) 90 , hyphenationLimitAfter(o.hyphenationLimitAfter) 87 91 , locale(o.locale) 88 92 , textEmphasisCustomMark(o.textEmphasisCustomMark) … … 129 133 && speak == o.speak 130 134 && hyphens == o.hyphens 135 && hyphenationLimitBefore == o.hyphenationLimitBefore 136 && hyphenationLimitAfter == o.hyphenationLimitAfter 131 137 && textEmphasisFill == o.textEmphasisFill 132 138 && textEmphasisMark == o.textEmphasisMark -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r80288 r80438 87 87 88 88 AtomicString hyphenationString; 89 short hyphenationLimitBefore; 90 short hyphenationLimitAfter; 91 89 92 AtomicString locale; 90 93
Note: See TracChangeset
for help on using the changeset viewer.