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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.h

Issue 1909233002: Spec-compliant parsing and initial values for 'orphans' and 'widows'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some unit tests had non-conformant widphans assumptions too. Created 4 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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 const Length& paddingUnder() const { return surround->padding.under(getWriti ngMode()); } 744 const Length& paddingUnder() const { return surround->padding.under(getWriti ngMode()); }
745 745
746 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor _style); } 746 ECursor cursor() const { return static_cast<ECursor>(inherited_flags._cursor _style); }
747 CursorList* cursors() const { return rareInheritedData->cursorData.get(); } 747 CursorList* cursors() const { return rareInheritedData->cursorData.get(); }
748 748
749 EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_f lags._insideLink); } 749 EInsideLink insideLink() const { return static_cast<EInsideLink>(inherited_f lags._insideLink); }
750 bool isLink() const { return noninherited_flags.isLink; } 750 bool isLink() const { return noninherited_flags.isLink; }
751 751
752 short widows() const { return rareInheritedData->widows; } 752 short widows() const { return rareInheritedData->widows; }
753 short orphans() const { return rareInheritedData->orphans; } 753 short orphans() const { return rareInheritedData->orphans; }
754 bool hasAutoWidows() const { return rareInheritedData->widows == 1; }
755 bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; }
756 EBreak breakAfter() const { return static_cast<EBreak>(noninherited_flags.br eakAfter); } 754 EBreak breakAfter() const { return static_cast<EBreak>(noninherited_flags.br eakAfter); }
757 EBreak breakBefore() const { return static_cast<EBreak>(noninherited_flags.b reakBefore); } 755 EBreak breakBefore() const { return static_cast<EBreak>(noninherited_flags.b reakBefore); }
758 EBreak breakInside() const { return static_cast<EBreak>(noninherited_flags.b reakInside); } 756 EBreak breakInside() const { return static_cast<EBreak>(noninherited_flags.b reakInside); }
759 757
760 // CSS3 Getter Methods 758 // CSS3 Getter Methods
761 759
762 int outlineOffset() const 760 int outlineOffset() const
763 { 761 {
764 if (m_background->outline().style() == BorderStyleNone) 762 if (m_background->outline().style() == BorderStyleNone)
765 return 0; 763 return 0;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 // The difference of them from normal stacking contexts is that they don't d etermine 1292 // The difference of them from normal stacking contexts is that they don't d etermine
1295 // the stacking of the elements underneath them. 1293 // the stacking of the elements underneath them.
1296 // (Note: There are also other elements treated as stacking context during p ainting, 1294 // (Note: There are also other elements treated as stacking context during p ainting,
1297 // but not managed in stacks. See ObjectPainter::paintAllPhasesAtomically(). ) 1295 // but not managed in stacks. See ObjectPainter::paintAllPhasesAtomically(). )
1298 bool isStacked() const { return isStackingContext() || position() != StaticP osition; } 1296 bool isStacked() const { return isStackingContext() || position() != StaticP osition; }
1299 1297
1300 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); } 1298 bool hasAutoZIndex() const { return m_box->hasAutoZIndex(); }
1301 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_b ox, m_zIndex, 0); } 1299 void setHasAutoZIndex() { SET_VAR(m_box, m_hasAutoZIndex, true); SET_VAR(m_b ox, m_zIndex, 0); }
1302 int zIndex() const { return m_box->zIndex(); } 1300 int zIndex() const { return m_box->zIndex(); }
1303 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_bo x, m_zIndex, v); } 1301 void setZIndex(int v) { SET_VAR(m_box, m_hasAutoZIndex, false); SET_VAR(m_bo x, m_zIndex, v); }
1304
1305 void setHasAutoWidows() { SET_VAR(rareInheritedData, widows, initialWidows() ); }
1306 void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); } 1302 void setWidows(short w) { SET_VAR(rareInheritedData, widows, w); }
1307 1303 void setOrphans(short o) { SET_VAR(rareInheritedData, orphans, o); }
1308 void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true ); SET_VAR(rareInheritedData, orphans, initialOrphans()); }
1309 void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, fals e); SET_VAR(rareInheritedData, orphans, o); }
1310
1311 void setBreakAfter(EBreak b) { ASSERT(b <= BreakValueLastAllowedForBreakAfte rAndBefore); noninherited_flags.breakAfter = b; } 1304 void setBreakAfter(EBreak b) { ASSERT(b <= BreakValueLastAllowedForBreakAfte rAndBefore); noninherited_flags.breakAfter = b; }
1312 void setBreakBefore(EBreak b) { ASSERT(b <= BreakValueLastAllowedForBreakAft erAndBefore); noninherited_flags.breakBefore = b; } 1305 void setBreakBefore(EBreak b) { ASSERT(b <= BreakValueLastAllowedForBreakAft erAndBefore); noninherited_flags.breakBefore = b; }
1313 void setBreakInside(EBreak b) { ASSERT(b <= BreakValueLastAllowedForBreakIns ide); noninherited_flags.breakInside = b; } 1306 void setBreakInside(EBreak b) { ASSERT(b <= BreakValueLastAllowedForBreakIns ide); noninherited_flags.breakInside = b; }
1314 1307
1315 // CSS3 Setters 1308 // CSS3 Setters
1316 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); } 1309 void setOutlineOffset(int v) { SET_VAR(m_background, m_outline.m_offset, v); }
1317 void setTextShadow(PassRefPtr<ShadowList>); 1310 void setTextShadow(PassRefPtr<ShadowList>);
1318 void setTextStrokeColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInher itedData, textStrokeColor, setTextStrokeColor, c); } 1311 void setTextStrokeColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInher itedData, textStrokeColor, setTextStrokeColor, c); }
1319 void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidt h, w); } 1312 void setTextStrokeWidth(float w) { SET_VAR(rareInheritedData, textStrokeWidt h, w); }
1320 void setTextFillColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInherit edData, textFillColor, setTextFillColor, c); } 1313 void setTextFillColor(const StyleColor& c) { SET_VAR_WITH_SETTER(rareInherit edData, textFillColor, setTextFillColor, c); }
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 static Length initialSize() { return Length(); } 1697 static Length initialSize() { return Length(); }
1705 static Length initialMinSize() { return Length(); } 1698 static Length initialMinSize() { return Length(); }
1706 static Length initialMaxSize() { return Length(MaxSizeNone); } 1699 static Length initialMaxSize() { return Length(MaxSizeNone); }
1707 static Length initialOffset() { return Length(); } 1700 static Length initialOffset() { return Length(); }
1708 static Length initialMargin() { return Length(Fixed); } 1701 static Length initialMargin() { return Length(Fixed); }
1709 static Length initialPadding() { return Length(Fixed); } 1702 static Length initialPadding() { return Length(Fixed); }
1710 static Length initialTextIndent() { return Length(Fixed); } 1703 static Length initialTextIndent() { return Length(Fixed); }
1711 static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; } 1704 static TextIndentLine initialTextIndentLine() { return TextIndentFirstLine; }
1712 static TextIndentType initialTextIndentType() { return TextIndentNormal; } 1705 static TextIndentType initialTextIndentType() { return TextIndentNormal; }
1713 static EVerticalAlign initialVerticalAlign() { return VerticalAlignBaseline; } 1706 static EVerticalAlign initialVerticalAlign() { return VerticalAlignBaseline; }
1714 static short initialWidows() { return 1; } 1707 static short initialWidows() { return 2; }
1715 static short initialOrphans() { return 2; } 1708 static short initialOrphans() { return 2; }
1716 static Length initialLineHeight() { return Length(-100.0, Percent); } 1709 static Length initialLineHeight() { return Length(-100.0, Percent); }
1717 static ETextAlign initialTextAlign() { return TASTART; } 1710 static ETextAlign initialTextAlign() { return TASTART; }
1718 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; } 1711 static TextAlignLast initialTextAlignLast() { return TextAlignLastAuto; }
1719 static TextJustify initialTextJustify() { return TextJustifyAuto; } 1712 static TextJustify initialTextJustify() { return TextJustifyAuto; }
1720 static TextDecoration initialTextDecoration() { return TextDecorationNone; } 1713 static TextDecoration initialTextDecoration() { return TextDecorationNone; }
1721 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnd erlinePositionAuto; } 1714 static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnd erlinePositionAuto; }
1722 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorat ionStyleSolid; } 1715 static TextDecorationStyle initialTextDecorationStyle() { return TextDecorat ionStyleSolid; }
1723 static float initialZoom() { return 1.0f; } 1716 static float initialZoom() { return 1.0f; }
1724 static int initialOutlineOffset() { return 0; } 1717 static int initialOutlineOffset() { return 0; }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 } 2033 }
2041 2034
2042 inline bool ComputedStyle::hasPseudoElementStyle() const 2035 inline bool ComputedStyle::hasPseudoElementStyle() const
2043 { 2036 {
2044 return noninherited_flags.pseudoBits & ElementPseudoIdMask; 2037 return noninherited_flags.pseudoBits & ElementPseudoIdMask;
2045 } 2038 }
2046 2039
2047 } // namespace blink 2040 } // namespace blink
2048 2041
2049 #endif // ComputedStyle_h 2042 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698