Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Side by Side Diff: Source/core/rendering/style/RenderStyle.h

Issue 219633002: Proper support for multiple text decorations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #define SET_BORDERVALUE_COLOR(group, variable, value) \ 89 #define SET_BORDERVALUE_COLOR(group, variable, value) \
90 if (!compareEqual(group->variable.color(), value)) \ 90 if (!compareEqual(group->variable.color(), value)) \
91 group.access()->variable.setColor(value) 91 group.access()->variable.setColor(value)
92 92
93 namespace WebCore { 93 namespace WebCore {
94 94
95 using std::max; 95 using std::max;
96 96
97 class FilterOperations; 97 class FilterOperations;
98 98
99 class AppliedTextDecoration;
100 class AppliedTextDecorationList;
99 class BorderData; 101 class BorderData;
100 class CounterContent; 102 class CounterContent;
101 class CursorList; 103 class CursorList;
102 class Font; 104 class Font;
103 class FontMetrics; 105 class FontMetrics;
104 class IntRect; 106 class IntRect;
105 class Pair; 107 class Pair;
106 class ShadowList; 108 class ShadowList;
107 class StyleImage; 109 class StyleImage;
108 class StyleInheritedData; 110 class StyleInheritedData;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 struct InheritedFlags { 157 struct InheritedFlags {
156 bool operator==(const InheritedFlags& other) const 158 bool operator==(const InheritedFlags& other) const
157 { 159 {
158 return (_empty_cells == other._empty_cells) 160 return (_empty_cells == other._empty_cells)
159 && (_caption_side == other._caption_side) 161 && (_caption_side == other._caption_side)
160 && (_list_style_type == other._list_style_type) 162 && (_list_style_type == other._list_style_type)
161 && (_list_style_position == other._list_style_position) 163 && (_list_style_position == other._list_style_position)
162 && (_visibility == other._visibility) 164 && (_visibility == other._visibility)
163 && (_text_align == other._text_align) 165 && (_text_align == other._text_align)
164 && (_text_transform == other._text_transform) 166 && (_text_transform == other._text_transform)
165 && (_text_decorations == other._text_decorations) 167 && (m_textUnderline == other.m_textUnderline)
166 && (_cursor_style == other._cursor_style) 168 && (_cursor_style == other._cursor_style)
167 && (_direction == other._direction) 169 && (_direction == other._direction)
168 && (_white_space == other._white_space) 170 && (_white_space == other._white_space)
169 && (_border_collapse == other._border_collapse) 171 && (_border_collapse == other._border_collapse)
170 && (_box_direction == other._box_direction) 172 && (_box_direction == other._box_direction)
171 && (m_rtlOrdering == other.m_rtlOrdering) 173 && (m_rtlOrdering == other.m_rtlOrdering)
172 && (m_printColorAdjust == other.m_printColorAdjust) 174 && (m_printColorAdjust == other.m_printColorAdjust)
173 && (_pointerEvents == other._pointerEvents) 175 && (_pointerEvents == other._pointerEvents)
174 && (_insideLink == other._insideLink) 176 && (_insideLink == other._insideLink)
175 && (m_writingMode == other.m_writingMode); 177 && (m_writingMode == other.m_writingMode);
176 } 178 }
177 179
178 bool operator!=(const InheritedFlags& other) const { return !(*this == o ther); } 180 bool operator!=(const InheritedFlags& other) const { return !(*this == o ther); }
179 181
180 unsigned _empty_cells : 1; // EEmptyCell 182 unsigned _empty_cells : 1; // EEmptyCell
181 unsigned _caption_side : 2; // ECaptionSide 183 unsigned _caption_side : 2; // ECaptionSide
182 unsigned _list_style_type : 7; // EListStyleType 184 unsigned _list_style_type : 7; // EListStyleType
183 unsigned _list_style_position : 1; // EListStylePosition 185 unsigned _list_style_position : 1; // EListStylePosition
184 unsigned _visibility : 2; // EVisibility 186 unsigned _visibility : 2; // EVisibility
185 unsigned _text_align : 4; // ETextAlign 187 unsigned _text_align : 4; // ETextAlign
186 unsigned _text_transform : 2; // ETextTransform 188 unsigned _text_transform : 2; // ETextTransform
187 unsigned _text_decorations : TextDecorationBits; 189 unsigned m_textUnderline : 1;
188 unsigned _cursor_style : 6; // ECursor 190 unsigned _cursor_style : 6; // ECursor
189 unsigned _direction : 1; // TextDirection 191 unsigned _direction : 1; // TextDirection
190 unsigned _white_space : 3; // EWhiteSpace 192 unsigned _white_space : 3; // EWhiteSpace
191 // 32 bits
192 unsigned _border_collapse : 1; // EBorderCollapse 193 unsigned _border_collapse : 1; // EBorderCollapse
193 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction proper ty, flexible box layout module) 194 unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction proper ty, flexible box layout module)
195 // 32 bits
194 196
195 // non CSS2 inherited 197 // non CSS2 inherited
196 unsigned m_rtlOrdering : 1; // Order 198 unsigned m_rtlOrdering : 1; // Order
197 unsigned m_printColorAdjust : PrintColorAdjustBits; 199 unsigned m_printColorAdjust : PrintColorAdjustBits;
198 unsigned _pointerEvents : 4; // EPointerEvents 200 unsigned _pointerEvents : 4; // EPointerEvents
199 unsigned _insideLink : 2; // EInsideLink 201 unsigned _insideLink : 2; // EInsideLink
200 // 43 bits 202 // 40 bits
201 203
202 // CSS Text Layout Module Level 3: Vertical writing support 204 // CSS Text Layout Module Level 3: Vertical writing support
203 unsigned m_writingMode : 2; // WritingMode 205 unsigned m_writingMode : 2; // WritingMode
204 // 45 bits 206 // 42 bits
205 } inherited_flags; 207 } inherited_flags;
206 208
207 // don't inherit 209 // don't inherit
208 struct NonInheritedFlags { 210 struct NonInheritedFlags {
209 bool operator==(const NonInheritedFlags& other) const 211 bool operator==(const NonInheritedFlags& other) const
210 { 212 {
211 return _effectiveDisplay == other._effectiveDisplay 213 return _effectiveDisplay == other._effectiveDisplay
212 && _originalDisplay == other._originalDisplay 214 && _originalDisplay == other._originalDisplay
213 && _overflowX == other._overflowX 215 && _overflowX == other._overflowX
214 && _overflowY == other._overflowY 216 && _overflowY == other._overflowY
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 protected: 296 protected:
295 void setBitDefaults() 297 void setBitDefaults()
296 { 298 {
297 inherited_flags._empty_cells = initialEmptyCells(); 299 inherited_flags._empty_cells = initialEmptyCells();
298 inherited_flags._caption_side = initialCaptionSide(); 300 inherited_flags._caption_side = initialCaptionSide();
299 inherited_flags._list_style_type = initialListStyleType(); 301 inherited_flags._list_style_type = initialListStyleType();
300 inherited_flags._list_style_position = initialListStylePosition(); 302 inherited_flags._list_style_position = initialListStylePosition();
301 inherited_flags._visibility = initialVisibility(); 303 inherited_flags._visibility = initialVisibility();
302 inherited_flags._text_align = initialTextAlign(); 304 inherited_flags._text_align = initialTextAlign();
303 inherited_flags._text_transform = initialTextTransform(); 305 inherited_flags._text_transform = initialTextTransform();
304 inherited_flags._text_decorations = initialTextDecoration(); 306 inherited_flags.m_textUnderline = false;
305 inherited_flags._cursor_style = initialCursor(); 307 inherited_flags._cursor_style = initialCursor();
306 inherited_flags._direction = initialDirection(); 308 inherited_flags._direction = initialDirection();
307 inherited_flags._white_space = initialWhiteSpace(); 309 inherited_flags._white_space = initialWhiteSpace();
308 inherited_flags._border_collapse = initialBorderCollapse(); 310 inherited_flags._border_collapse = initialBorderCollapse();
309 inherited_flags.m_rtlOrdering = initialRTLOrdering(); 311 inherited_flags.m_rtlOrdering = initialRTLOrdering();
310 inherited_flags._box_direction = initialBoxDirection(); 312 inherited_flags._box_direction = initialBoxDirection();
311 inherited_flags.m_printColorAdjust = initialPrintColorAdjust(); 313 inherited_flags.m_printColorAdjust = initialPrintColorAdjust();
312 inherited_flags._pointerEvents = initialPointerEvents(); 314 inherited_flags._pointerEvents = initialPointerEvents();
313 inherited_flags._insideLink = NotInsideLink; 315 inherited_flags._insideLink = NotInsideLink;
314 inherited_flags.m_writingMode = initialWritingMode(); 316 inherited_flags.m_writingMode = initialWritingMode();
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 FontWeight fontWeight() const; 574 FontWeight fontWeight() const;
573 575
574 float textAutosizingMultiplier() const { return visual->m_textAutosizingMult iplier; } 576 float textAutosizingMultiplier() const { return visual->m_textAutosizingMult iplier; }
575 577
576 const Length& textIndent() const { return rareInheritedData->indent; } 578 const Length& textIndent() const { return rareInheritedData->indent; }
577 TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(r areInheritedData->m_textIndentLine); } 579 TextIndentLine textIndentLine() const { return static_cast<TextIndentLine>(r areInheritedData->m_textIndentLine); }
578 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flag s._text_align); } 580 ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flag s._text_align); }
579 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rare InheritedData->m_textAlignLast); } 581 TextAlignLast textAlignLast() const { return static_cast<TextAlignLast>(rare InheritedData->m_textAlignLast); }
580 TextJustify textJustify() const { return static_cast<TextJustify>(rareInheri tedData->m_textJustify); } 582 TextJustify textJustify() const { return static_cast<TextJustify>(rareInheri tedData->m_textJustify); }
581 ETextTransform textTransform() const { return static_cast<ETextTransform>(in herited_flags._text_transform); } 583 ETextTransform textTransform() const { return static_cast<ETextTransform>(in herited_flags._text_transform); }
582 TextDecoration textDecorationsInEffect() const { return static_cast<TextDeco ration>(inherited_flags._text_decorations); } 584 TextDecoration textDecorationsInEffect() const;
585 TextDecoration appliedTextUnderline() const { return static_cast<TextDecorat ion>(inherited_flags.m_textUnderline); }
esprehn 2014/03/31 17:41:24 Instead of this you can encapsulate the optimizati
andersr 2014/04/01 17:07:54 Note that I have not fully addressed this issue in
586 const AppliedTextDecorationList* appliedTextDecorations() const { return rar eInheritedData->appliedTextDecorations.get(); }
esprehn 2014/03/31 17:41:24 const Vector<AppliedTextDecoration>&, reference no
587 bool hasAppliedTextDecorations() const { return appliedTextUnderline() || ap pliedTextDecorations(); }
583 TextDecoration textDecoration() const { return static_cast<TextDecoration>(v isual->textDecoration); } 588 TextDecoration textDecoration() const { return static_cast<TextDecoration>(v isual->textDecoration); }
584 TextUnderlinePosition textUnderlinePosition() const { return static_cast<Tex tUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); } 589 TextUnderlinePosition textUnderlinePosition() const { return static_cast<Tex tUnderlinePosition>(rareInheritedData->m_textUnderlinePosition); }
585 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDec orationStyle>(rareNonInheritedData->m_textDecorationStyle); } 590 TextDecorationStyle textDecorationStyle() const { return static_cast<TextDec orationStyle>(rareNonInheritedData->m_textDecorationStyle); }
586 float wordSpacing() const; 591 float wordSpacing() const;
587 float letterSpacing() const; 592 float letterSpacing() const;
588 593
589 float zoom() const { return visual->m_zoom; } 594 float zoom() const { return visual->m_zoom; }
590 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; } 595 float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
591 596
592 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); } 597 TextDirection direction() const { return static_cast<TextDirection>(inherite d_flags._direction); }
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 setFontSize(fontDescription().specifiedSize()); 1105 setFontSize(fontDescription().specifiedSize());
1101 } 1106 }
1102 1107
1103 void setColor(const Color&); 1108 void setColor(const Color&);
1104 void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v); } 1109 void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v); }
1105 void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_text IndentLine, v); } 1110 void setTextIndentLine(TextIndentLine v) { SET_VAR(rareInheritedData, m_text IndentLine, v); }
1106 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; } 1111 void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; }
1107 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAl ignLast, v); } 1112 void setTextAlignLast(TextAlignLast v) { SET_VAR(rareInheritedData, m_textAl ignLast, v); }
1108 void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustif y, v); } 1113 void setTextJustify(TextJustify v) { SET_VAR(rareInheritedData, m_textJustif y, v); }
1109 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; } 1114 void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; }
1110 void addToTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_ decorations |= v; } 1115 void setTextDecorationsInEffect(TextDecoration);
1111 void setTextDecorationsInEffect(TextDecoration v) { inherited_flags._text_de corations = v; } 1116 void addAppliedTextDecoration(TextDecoration);
1117 void addAppliedTextDecoration(const AppliedTextDecoration&);
1118 void applyTextDecoration(TextDecoration, TextDecorationStyle, const StyleCol or&);
1119 void applyTextDecorations();
1120 void clearAppliedTextDecorations();
1112 void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v ); } 1121 void setTextDecoration(TextDecoration v) { SET_VAR(visual, textDecoration, v ); }
1113 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInherit edData, m_textUnderlinePosition, v); } 1122 void setTextUnderlinePosition(TextUnderlinePosition v) { SET_VAR(rareInherit edData, m_textUnderlinePosition, v); }
1114 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInherite dData, m_textDecorationStyle, v); } 1123 void setTextDecorationStyle(TextDecorationStyle v) { SET_VAR(rareNonInherite dData, m_textDecorationStyle, v); }
1115 void setDirection(TextDirection v) { inherited_flags._direction = v; } 1124 void setDirection(TextDirection v) { inherited_flags._direction = v; }
1116 void setLineHeight(Length specifiedLineHeight); 1125 void setLineHeight(Length specifiedLineHeight);
1117 bool setZoom(float); 1126 bool setZoom(float);
1118 void setZoomWithoutReturnValue(float f) { setZoom(f); } 1127 void setZoomWithoutReturnValue(float f) { setZoom(f); }
1119 bool setEffectiveZoom(float); 1128 bool setEffectiveZoom(float);
1120 1129
1121 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_ima geRendering, v); } 1130 void setImageRendering(EImageRendering v) { SET_VAR(rareInheritedData, m_ima geRendering, v); }
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 1510
1502 bool isSharable() const; 1511 bool isSharable() const;
1503 1512
1504 bool emptyState() const { return noninherited_flags.emptyState; } 1513 bool emptyState() const { return noninherited_flags.emptyState; }
1505 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; } 1514 void setEmptyState(bool b) { setUnique(); noninherited_flags.emptyState = b; }
1506 bool firstChildState() const { return noninherited_flags.firstChildState; } 1515 bool firstChildState() const { return noninherited_flags.firstChildState; }
1507 void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; } 1516 void setFirstChildState() { setUnique(); noninherited_flags.firstChildState = true; }
1508 bool lastChildState() const { return noninherited_flags.lastChildState; } 1517 bool lastChildState() const { return noninherited_flags.lastChildState; }
1509 void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; } 1518 void setLastChildState() { setUnique(); noninherited_flags.lastChildState = true; }
1510 1519
1511 StyleColor visitedDependentDecorationColor() const; 1520 StyleColor visitedDependentDecorationStyleColor() const;
1521 Color visitedDependentDecorationColor() const;
1512 Color visitedDependentColor(int colorProperty) const; 1522 Color visitedDependentColor(int colorProperty) const;
1513 1523
1514 void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInhe ritance = true; } 1524 void setHasExplicitlyInheritedProperties() { noninherited_flags.explicitInhe ritance = true; }
1515 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.ex plicitInheritance; } 1525 bool hasExplicitlyInheritedProperties() const { return noninherited_flags.ex plicitInheritance; }
1516 1526
1517 void setHasCurrentColor() { noninherited_flags.currentColor = true; } 1527 void setHasCurrentColor() { noninherited_flags.currentColor = true; }
1518 bool hasCurrentColor() const { return noninherited_flags.currentColor; } 1528 bool hasCurrentColor() const { return noninherited_flags.currentColor; }
1519 1529
1520 // Initial values for all the properties 1530 // Initial values for all the properties
1521 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; } 1531 static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 inline bool RenderStyle::hasPseudoElementStyle() const 1872 inline bool RenderStyle::hasPseudoElementStyle() const
1863 { 1873 {
1864 return noninherited_flags._pseudoBits & PSEUDO_ELEMENT_MASK; 1874 return noninherited_flags._pseudoBits & PSEUDO_ELEMENT_MASK;
1865 } 1875 }
1866 1876
1867 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&); 1877 float calcBorderRadiiConstraintScaleFor(const FloatRect&, const FloatRoundedRect ::Radii&);
1868 1878
1869 } // namespace WebCore 1879 } // namespace WebCore
1870 1880
1871 #endif // RenderStyle_h 1881 #endif // RenderStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698