Changeset 146104 in webkit
- Timestamp:
- Mar 18, 2013 12:43:22 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 20 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r146100 r146104 1 2013-03-18 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 [css3-text] Add rendering support for -webkit-text-underline-position 4 https://bugs.webkit.org/show_bug.cgi?id=102795 5 6 Reviewed by Levi Weintraub. 7 8 Added text-underline-position tests for 'text-underline-position' CSS3 9 property, with 'webkit' prefix. 10 11 * fast/css3-text/css3-text-decoration/text-underline-position/style.css: Added. 12 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-all-expected.txt: Added. 13 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-all.html: Added. 14 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-alphabetic-expected.txt: Added. 15 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-alphabetic.html: Added. 16 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-auto-expected.txt: Added. 17 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-auto.html: Added. 18 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-expected.txt: Added. 19 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-out-of-flow-expected.txt: Added. 20 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-out-of-flow.html: Added. 21 * fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under.html: Added. 22 * platform/chromium-linux/fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-all-expected.png: Added. 23 * platform/chromium-linux/fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-alphabetic-expected.png: Added. 24 * platform/chromium-linux/fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-auto-expected.png: Added. 25 * platform/chromium-linux/fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-expected.png: Added. 26 * platform/chromium-linux/fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-out-of-flow-expected.png: Added. 27 1 28 2013-03-18 Michael Saboff <msaboff@apple.com> 2 29 -
trunk/Source/WebCore/ChangeLog
r146103 r146104 1 2013-03-18 Lamarque V. Souza <Lamarque.Souza@basyskom.com> 2 3 [css3-text] Add rendering support for -webkit-text-underline-position 4 https://bugs.webkit.org/show_bug.cgi?id=102795 5 6 Reviewed by Levi Weintraub. 7 8 This patch implements rendering support for values [ auto | alphabetic | under ] 9 of CSS3 property text-underline-position. We don't fully match the specification 10 as we don't support [ left | right ] and this is left for another implementation 11 as the rendering will need to be added. 12 13 Tests: fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-all.html 14 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-alphabetic.html 15 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-auto.html 16 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under-out-of-flow.html 17 fast/css3-text/css3-text-decoration/text-underline-position/text-underline-position-under.html 18 19 * rendering/InlineFlowBox.cpp: 20 (WebCore::InlineFlowBox::computeMaxLogicalTop): Added method to compute maximal logical top among all chidren of 21 this InlineTextBox. 22 * rendering/InlineFlowBox.h: 23 (InlineFlowBox): 24 * rendering/InlineTextBox.cpp: 25 (WebCore::computeUnderlineOffset): Added method to compute offset for text-underline-position property. 26 (WebCore::InlineTextBox::paintDecoration): Paint decoration at position calculated using computeUnderlineOffset(). 27 * rendering/RootInlineBox.cpp: 28 (WebCore::RootInlineBox::RootInlineBox): 29 (WebCore::RootInlineBox::alignBoxesInBlockDirection): Call method to compute maximal logical top among all 30 children of this RootInlineBox. 31 * rendering/RootInlineBox.h: 32 (RootInlineBox): 33 (WebCore::RootInlineBox::maxLogicalTop): Added getter for m_maxLogicalTop class member. 34 * rendering/style/RenderStyle.h: Added the usual getter / setter / initial methods for text-underline-position 35 property 36 1 37 2013-03-18 Christian Biesinger <cbiesinger@chromium.org> 2 38 -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r144565 r146104 739 739 } 740 740 } 741 742 #if ENABLE(CSS3_TEXT) 743 void InlineFlowBox::computeMaxLogicalTop(float& maxLogicalTop) 744 { 745 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 746 if (curr->renderer()->isOutOfFlowPositioned()) 747 continue; // Positioned placeholders don't affect calculations. 748 749 if (descendantsHaveSameLineHeightAndBaseline()) 750 continue; 751 752 maxLogicalTop = max<float>(maxLogicalTop, curr->y()); 753 float localMaxLogicalTop = 0; 754 if (curr->isInlineFlowBox()) 755 toInlineFlowBox(curr)->computeMaxLogicalTop(localMaxLogicalTop); 756 maxLogicalTop = max<float>(maxLogicalTop, localMaxLogicalTop); 757 } 758 } 759 #endif // CSS3_TEXT 741 760 742 761 void InlineFlowBox::flipLinesInBlockDirection(LayoutUnit lineTop, LayoutUnit lineBottom) -
trunk/Source/WebCore/rendering/InlineFlowBox.h
r140640 r146104 320 320 InlineFlowBox* m_nextLineBox; // The next box that also uses our RenderObject 321 321 322 #if ENABLE(CSS3_TEXT) 323 // Maximum logicalTop among all children of an InlineFlowBox. Used to 324 // calculate the offset for TextUnderlinePositionUnder. 325 void computeMaxLogicalTop(float& maxLogicalTop); 326 #endif // CSS3_TEXT 322 327 private: 323 328 unsigned m_includeLogicalLeftEdge : 1; -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r141816 r146104 959 959 } 960 960 961 #if ENABLE(CSS3_TEXT) 962 static int computeUnderlineOffset(const TextUnderlinePosition underlinePosition, const FontMetrics& fontMetrics, const InlineTextBox* inlineTextBox, const int textDecorationThickness) 963 { 964 // Compute the gap between the font and the underline. Use at least one 965 // pixel gap, if underline is thick then use a bigger gap. 966 const int gap = max<int>(1, ceilf(textDecorationThickness / 2.0)); 967 968 // According to the specification TextUnderlinePositionAuto should default to 'alphabetic' for horizontal text 969 // and to 'under Left' for vertical text (e.g. japanese). We support only horizontal text for now. 970 switch (underlinePosition) { 971 case TextUnderlinePositionAlphabetic: 972 case TextUnderlinePositionAuto: 973 return fontMetrics.ascent() + gap; // Position underline near the alphabetic baseline. 974 case TextUnderlinePositionUnder: { 975 // Position underline relative to the under edge of the lowest element's content box. 976 const float offset = inlineTextBox->root()->maxLogicalTop() - inlineTextBox->logicalTop(); 977 if (offset > 0) 978 return inlineTextBox->logicalHeight() + gap + offset; 979 return inlineTextBox->logicalHeight() + gap; 980 } 981 } 982 983 ASSERT_NOT_REACHED(); 984 return fontMetrics.ascent() + gap; 985 } 986 #endif // CSS3_TEXT 987 961 988 void InlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoint& boxOrigin, ETextDecoration deco, TextDecorationStyle decorationStyle, const ShadowData* shadow) 962 989 { … … 1035 1062 if (deco & UNDERLINE) { 1036 1063 context->setStrokeColor(underline, colorSpace); 1064 #if ENABLE(CSS3_TEXT) 1065 TextUnderlinePosition underlinePosition = styleToUse->textUnderlinePosition(); 1066 const int underlineOffset = computeUnderlineOffset(underlinePosition, styleToUse->fontMetrics(), this, textDecorationThickness); 1067 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset), width, isPrinting); 1068 1069 if (decorationStyle == TextDecorationStyleDouble) 1070 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + underlineOffset + doubleOffset), width, isPrinting); 1071 #else 1037 1072 // Leave one pixel of white between the baseline and the underline. 1038 1073 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1), width, isPrinting); 1039 #if ENABLE(CSS3_TEXT)1040 if (decorationStyle == TextDecorationStyleDouble)1041 context->drawLineForText(FloatPoint(localOrigin.x(), localOrigin.y() + baseline + 1 + doubleOffset), width, isPrinting);1042 1074 #endif // CSS3_TEXT 1043 1075 } -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r144497 r146104 54 54 , m_lineTopWithLeading(0) 55 55 , m_lineBottomWithLeading(0) 56 #if ENABLE(CSS3_TEXT) 57 , m_maxLogicalTop(0) 58 #endif // CSS3_TEXT 56 59 { 57 60 setIsHorizontal(block->isHorizontalWritingMode()); … … 280 283 if (isSVGRootInlineBox()) 281 284 return 0; 285 286 // FIXME: figure out how to call computeMaxLogicalTop() when SVG is enabled. 282 287 #endif 283 288 … … 331 336 heightOfBlock += gridSnapAdjustment; 332 337 } 338 339 #if ENABLE(CSS3_TEXT) 340 m_maxLogicalTop = 0; 341 computeMaxLogicalTop(m_maxLogicalTop); 342 #endif // CSS3_TEXT 333 343 334 344 return heightOfBlock + maxHeight; -
trunk/Source/WebCore/rendering/RootInlineBox.h
r140291 r146104 187 187 } 188 188 189 #if ENABLE(CSS3_TEXT) 190 // Used to calculate the underline offset for TextUnderlinePositionUnder. 191 float maxLogicalTop() const { return m_maxLogicalTop; } 192 #endif // CSS3_TEXT 193 189 194 Node* getLogicalStartBoxWithNode(InlineBox*&) const; 190 195 Node* getLogicalEndBoxWithNode(InlineBox*&) const; … … 220 225 LayoutUnit m_lineTopWithLeading; 221 226 LayoutUnit m_lineBottomWithLeading; 227 228 #if ENABLE(CSS3_TEXT) 229 // Maximum logicalTop among all children of an InlineFlowBox. Used to 230 // calculate the offset for TextUnderlinePositionUnder. 231 float m_maxLogicalTop; 232 #endif // CSS3_TEXT 222 233 223 234 struct LineFragmentationData {
Note: See TracChangeset
for help on using the changeset viewer.