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

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

Issue 2145823002: Implement the overflow-anchor CSS property as an opt-out for ScrollAnchoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Put opt-out behind RuntimeEnabledFeature and update tests Created 4 years, 5 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // 42 bits 211 // 42 bits
212 } m_inheritedData; 212 } m_inheritedData;
213 213
214 // don't inherit 214 // don't inherit
215 struct NonInheritedData { 215 struct NonInheritedData {
216 // Compare computed styles, differences in other flags should not cause an inequality. 216 // Compare computed styles, differences in other flags should not cause an inequality.
217 bool operator==(const NonInheritedData& other) const 217 bool operator==(const NonInheritedData& other) const
218 { 218 {
219 return m_effectiveDisplay == other.m_effectiveDisplay 219 return m_effectiveDisplay == other.m_effectiveDisplay
220 && m_originalDisplay == other.m_originalDisplay 220 && m_originalDisplay == other.m_originalDisplay
221 && m_overflowAnchor == other.m_overflowAnchor
221 && m_overflowX == other.m_overflowX 222 && m_overflowX == other.m_overflowX
222 && m_overflowY == other.m_overflowY 223 && m_overflowY == other.m_overflowY
223 && m_verticalAlign == other.m_verticalAlign 224 && m_verticalAlign == other.m_verticalAlign
224 && m_clear == other.m_clear 225 && m_clear == other.m_clear
225 && m_position == other.m_position 226 && m_position == other.m_position
226 && m_floating == other.m_floating 227 && m_floating == other.m_floating
227 && m_tableLayout == other.m_tableLayout 228 && m_tableLayout == other.m_tableLayout
228 && m_unicodeBidi == other.m_unicodeBidi 229 && m_unicodeBidi == other.m_unicodeBidi
229 // hasViewportUnits 230 // hasViewportUnits
230 && m_breakBefore == other.m_breakBefore 231 && m_breakBefore == other.m_breakBefore
231 && m_breakAfter == other.m_breakAfter 232 && m_breakAfter == other.m_breakAfter
232 && m_breakInside == other.m_breakInside; 233 && m_breakInside == other.m_breakInside;
233 // styleType 234 // styleType
234 // pseudoBits 235 // pseudoBits
235 // explicitInheritance 236 // explicitInheritance
236 // unique 237 // unique
237 // emptyState 238 // emptyState
238 // affectedByFocus 239 // affectedByFocus
239 // affectedByHover 240 // affectedByHover
240 // affectedByActive 241 // affectedByActive
241 // affectedByDrag 242 // affectedByDrag
242 // isLink 243 // isLink
243 } 244 }
244 245
245 bool operator!=(const NonInheritedData& other) const { return !(*this == other); } 246 bool operator!=(const NonInheritedData& other) const { return !(*this == other); }
246 247
247 unsigned m_effectiveDisplay : 5; // EDisplay 248 unsigned m_effectiveDisplay : 5; // EDisplay
248 unsigned m_originalDisplay : 5; // EDisplay 249 unsigned m_originalDisplay : 5; // EDisplay
250 unsigned m_overflowAnchor : 2; // EOverflowAnchor
249 unsigned m_overflowX : 3; // EOverflow 251 unsigned m_overflowX : 3; // EOverflow
250 unsigned m_overflowY : 3; // EOverflow 252 unsigned m_overflowY : 3; // EOverflow
251 unsigned m_verticalAlign : 4; // EVerticalAlign 253 unsigned m_verticalAlign : 4; // EVerticalAlign
252 unsigned m_clear : 2; // EClear 254 unsigned m_clear : 2; // EClear
253 unsigned m_position : 3; // EPosition 255 unsigned m_position : 3; // EPosition
254 unsigned m_floating : 2; // EFloat 256 unsigned m_floating : 2; // EFloat
255 unsigned m_tableLayout : 1; // ETableLayout 257 unsigned m_tableLayout : 1; // ETableLayout
256 unsigned m_unicodeBidi : 3; // EUnicodeBidi 258 unsigned m_unicodeBidi : 3; // EUnicodeBidi
257 259
258 // This is set if we used viewport units when resolving a length. 260 // This is set if we used viewport units when resolving a length.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 m_inheritedData.m_whiteSpace = initialWhiteSpace(); 307 m_inheritedData.m_whiteSpace = initialWhiteSpace();
306 m_inheritedData.m_borderCollapse = initialBorderCollapse(); 308 m_inheritedData.m_borderCollapse = initialBorderCollapse();
307 m_inheritedData.m_rtlOrdering = initialRTLOrdering(); 309 m_inheritedData.m_rtlOrdering = initialRTLOrdering();
308 m_inheritedData.m_boxDirection = initialBoxDirection(); 310 m_inheritedData.m_boxDirection = initialBoxDirection();
309 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust(); 311 m_inheritedData.m_printColorAdjust = initialPrintColorAdjust();
310 m_inheritedData.m_pointerEvents = initialPointerEvents(); 312 m_inheritedData.m_pointerEvents = initialPointerEvents();
311 m_inheritedData.m_insideLink = NotInsideLink; 313 m_inheritedData.m_insideLink = NotInsideLink;
312 m_inheritedData.m_writingMode = initialWritingMode(); 314 m_inheritedData.m_writingMode = initialWritingMode();
313 315
314 m_nonInheritedData.m_effectiveDisplay = m_nonInheritedData.m_originalDis play = initialDisplay(); 316 m_nonInheritedData.m_effectiveDisplay = m_nonInheritedData.m_originalDis play = initialDisplay();
317 m_nonInheritedData.m_overflowAnchor = initialOverflowAnchor();
315 m_nonInheritedData.m_overflowX = initialOverflowX(); 318 m_nonInheritedData.m_overflowX = initialOverflowX();
316 m_nonInheritedData.m_overflowY = initialOverflowY(); 319 m_nonInheritedData.m_overflowY = initialOverflowY();
317 m_nonInheritedData.m_verticalAlign = initialVerticalAlign(); 320 m_nonInheritedData.m_verticalAlign = initialVerticalAlign();
318 m_nonInheritedData.m_clear = initialClear(); 321 m_nonInheritedData.m_clear = initialClear();
319 m_nonInheritedData.m_position = initialPosition(); 322 m_nonInheritedData.m_position = initialPosition();
320 m_nonInheritedData.m_floating = initialFloating(); 323 m_nonInheritedData.m_floating = initialFloating();
321 m_nonInheritedData.m_tableLayout = initialTableLayout(); 324 m_nonInheritedData.m_tableLayout = initialTableLayout();
322 m_nonInheritedData.m_unicodeBidi = initialUnicodeBidi(); 325 m_nonInheritedData.m_unicodeBidi = initialUnicodeBidi();
323 m_nonInheritedData.m_breakBefore = initialBreakBefore(); 326 m_nonInheritedData.m_breakBefore = initialBreakBefore();
324 m_nonInheritedData.m_breakAfter = initialBreakAfter(); 327 m_nonInheritedData.m_breakAfter = initialBreakAfter();
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 { 572 {
570 if (m_background->outline().style() == BorderStyleNone) 573 if (m_background->outline().style() == BorderStyleNone)
571 return 0; 574 return 0;
572 return m_background->outline().width(); 575 return m_background->outline().width();
573 } 576 }
574 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > Bord erStyleHidden; } 577 bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > Bord erStyleHidden; }
575 EBorderStyle outlineStyle() const { return m_background->outline().style(); } 578 EBorderStyle outlineStyle() const { return m_background->outline().style(); }
576 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto> (m_background->outline().isAuto()); } 579 OutlineIsAuto outlineStyleIsAuto() const { return static_cast<OutlineIsAuto> (m_background->outline().isAuto()); }
577 int outlineOutsetExtent() const; 580 int outlineOutsetExtent() const;
578 581
582 EOverflowAnchor overflowAnchor() const { return static_cast<EOverflowAnchor> (m_nonInheritedData.m_overflowAnchor); }
579 EOverflow overflowX() const { return static_cast<EOverflow>(m_nonInheritedDa ta.m_overflowX); } 583 EOverflow overflowX() const { return static_cast<EOverflow>(m_nonInheritedDa ta.m_overflowX); }
580 EOverflow overflowY() const { return static_cast<EOverflow>(m_nonInheritedDa ta.m_overflowY); } 584 EOverflow overflowY() const { return static_cast<EOverflow>(m_nonInheritedDa ta.m_overflowY); }
581 // It's sufficient to just check one direction, since it's illegal to have v isible on only one overflow value. 585 // It's sufficient to just check one direction, since it's illegal to have v isible on only one overflow value.
582 bool isOverflowVisible() const { ASSERT(overflowX() != OverflowVisible || ov erflowX() == overflowY()); return overflowX() == OverflowVisible; } 586 bool isOverflowVisible() const { ASSERT(overflowX() != OverflowVisible || ov erflowX() == overflowY()); return overflowX() == OverflowVisible; }
583 bool isOverflowPaged() const { return overflowY() == OverflowPagedX || overf lowY() == OverflowPagedY; } 587 bool isOverflowPaged() const { return overflowY() == OverflowPagedX || overf lowY() == OverflowPagedY; }
584 588
585 EVisibility visibility() const { return static_cast<EVisibility>(m_inherited Data.m_visibility); } 589 EVisibility visibility() const { return static_cast<EVisibility>(m_inherited Data.m_visibility); }
586 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(m_ nonInheritedData.m_verticalAlign); } 590 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(m_ nonInheritedData.m_verticalAlign); }
587 const Length& getVerticalAlignLength() const { return m_box->verticalAlign() ; } 591 const Length& getVerticalAlignLength() const { return m_box->verticalAlign() ; }
588 592
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 if (!otherStyle) 1171 if (!otherStyle)
1168 return !hasOutline(); 1172 return !hasOutline();
1169 return m_background->outline().visuallyEqual(otherStyle->m_background->o utline()); 1173 return m_background->outline().visuallyEqual(otherStyle->m_background->o utline());
1170 } 1174 }
1171 void setOutlineFromStyle(const ComputedStyle& o) 1175 void setOutlineFromStyle(const ComputedStyle& o)
1172 { 1176 {
1173 ASSERT(!isOutlineEquivalent(&o)); 1177 ASSERT(!isOutlineEquivalent(&o));
1174 m_background.access()->m_outline = o.m_background->m_outline; 1178 m_background.access()->m_outline = o.m_background->m_outline;
1175 } 1179 }
1176 1180
1181 void setOverflowAnchor(EOverflowAnchor v) { m_nonInheritedData.m_overflowAnc hor = v; }
1177 void setOverflowX(EOverflow v) { m_nonInheritedData.m_overflowX = v; } 1182 void setOverflowX(EOverflow v) { m_nonInheritedData.m_overflowX = v; }
1178 void setOverflowY(EOverflow v) { m_nonInheritedData.m_overflowY = v; } 1183 void setOverflowY(EOverflow v) { m_nonInheritedData.m_overflowY = v; }
1179 void setVisibility(EVisibility v) { m_inheritedData.m_visibility = v; } 1184 void setVisibility(EVisibility v) { m_inheritedData.m_visibility = v; }
1180 void setVerticalAlign(EVerticalAlign v) { m_nonInheritedData.m_verticalAlign = v; } 1185 void setVerticalAlign(EVerticalAlign v) { m_nonInheritedData.m_verticalAlign = v; }
1181 void setVerticalAlignLength(const Length& length) { setVerticalAlign(Vertica lAlignLength); SET_VAR(m_box, m_verticalAlign, length); } 1186 void setVerticalAlignLength(const Length& length) { setVerticalAlign(Vertica lAlignLength); SET_VAR(m_box, m_verticalAlign, length); }
1182 1187
1183 void setHasAutoClip() { SET_VAR(m_visual, hasAutoClip, true); SET_VAR(m_visu al, clip, ComputedStyle::initialClip()); } 1188 void setHasAutoClip() { SET_VAR(m_visual, hasAutoClip, true); SET_VAR(m_visu al, clip, ComputedStyle::initialClip()); }
1184 void setClip(const LengthBox& box) { SET_VAR(m_visual, hasAutoClip, false); SET_VAR(m_visual, clip, box); } 1189 void setClip(const LengthBox& box) { SET_VAR(m_visual, hasAutoClip, false); SET_VAR(m_visual, clip, box); }
1185 1190
1186 void setUnicodeBidi(EUnicodeBidi b) { m_nonInheritedData.m_unicodeBidi = b; } 1191 void setUnicodeBidi(EUnicodeBidi b) { m_nonInheritedData.m_unicodeBidi = b; }
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 static WritingMode initialWritingMode() { return TopToBottomWritingMode; } 1701 static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
1697 static TextCombine initialTextCombine() { return TextCombineNone; } 1702 static TextCombine initialTextCombine() { return TextCombineNone; }
1698 static TextOrientation initialTextOrientation() { return TextOrientationMixe d; } 1703 static TextOrientation initialTextOrientation() { return TextOrientationMixe d; }
1699 static ObjectFit initialObjectFit() { return ObjectFitFill; } 1704 static ObjectFit initialObjectFit() { return ObjectFitFill; }
1700 static LengthPoint initialObjectPosition() { return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); } 1705 static LengthPoint initialObjectPosition() { return LengthPoint(Length(50.0, Percent), Length(50.0, Percent)); }
1701 static EDisplay initialDisplay() { return INLINE; } 1706 static EDisplay initialDisplay() { return INLINE; }
1702 static EEmptyCells initialEmptyCells() { return EmptyCellsShow; } 1707 static EEmptyCells initialEmptyCells() { return EmptyCellsShow; }
1703 static EFloat initialFloating() { return NoFloat; } 1708 static EFloat initialFloating() { return NoFloat; }
1704 static EListStylePosition initialListStylePosition() { return ListStylePosit ionOutside; } 1709 static EListStylePosition initialListStylePosition() { return ListStylePosit ionOutside; }
1705 static EListStyleType initialListStyleType() { return Disc; } 1710 static EListStyleType initialListStyleType() { return Disc; }
1711 static EOverflowAnchor initialOverflowAnchor() { return AnchorAuto; }
1706 static EOverflow initialOverflowX() { return OverflowVisible; } 1712 static EOverflow initialOverflowX() { return OverflowVisible; }
1707 static EOverflow initialOverflowY() { return OverflowVisible; } 1713 static EOverflow initialOverflowY() { return OverflowVisible; }
1708 static EBreak initialBreakAfter() { return BreakAuto; } 1714 static EBreak initialBreakAfter() { return BreakAuto; }
1709 static EBreak initialBreakBefore() { return BreakAuto; } 1715 static EBreak initialBreakBefore() { return BreakAuto; }
1710 static EBreak initialBreakInside() { return BreakAuto; } 1716 static EBreak initialBreakInside() { return BreakAuto; }
1711 static EPosition initialPosition() { return StaticPosition; } 1717 static EPosition initialPosition() { return StaticPosition; }
1712 static ETableLayout initialTableLayout() { return TableLayoutAuto; } 1718 static ETableLayout initialTableLayout() { return TableLayoutAuto; }
1713 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; } 1719 static EUnicodeBidi initialUnicodeBidi() { return UBNormal; }
1714 static ETextTransform initialTextTransform() { return TTNONE; } 1720 static ETextTransform initialTextTransform() { return TTNONE; }
1715 static EVisibility initialVisibility() { return VISIBLE; } 1721 static EVisibility initialVisibility() { return VISIBLE; }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 } 2061 }
2056 2062
2057 inline bool ComputedStyle::hasPseudoElementStyle() const 2063 inline bool ComputedStyle::hasPseudoElementStyle() const
2058 { 2064 {
2059 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 2065 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
2060 } 2066 }
2061 2067
2062 } // namespace blink 2068 } // namespace blink
2063 2069
2064 #endif // ComputedStyle_h 2070 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698