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

Side by Side Diff: Source/core/layout/style/LayoutStyle.h

Issue 921843004: Stop explicit inheritance if LayoutStyle doesn't change. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Corrected and documented flag copying/comparisons Created 5 years, 10 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/layout/style/LayoutStyle.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 unsigned _pointerEvents : 4; // EPointerEvents 199 unsigned _pointerEvents : 4; // EPointerEvents
200 unsigned _insideLink : 2; // EInsideLink 200 unsigned _insideLink : 2; // EInsideLink
201 201
202 // CSS Text Layout Module Level 3: Vertical writing support 202 // CSS Text Layout Module Level 3: Vertical writing support
203 unsigned m_writingMode : 2; // WritingMode 203 unsigned m_writingMode : 2; // WritingMode
204 // 42 bits 204 // 42 bits
205 } inherited_flags; 205 } inherited_flags;
206 206
207 // don't inherit 207 // don't inherit
208 struct NonInheritedFlags { 208 struct NonInheritedFlags {
209 // Compare computed styles, differences in other flags should not cause an inequality.
209 bool operator==(const NonInheritedFlags& other) const 210 bool operator==(const NonInheritedFlags& other) const
210 { 211 {
211 return effectiveDisplay == other.effectiveDisplay 212 return effectiveDisplay == other.effectiveDisplay
212 && originalDisplay == other.originalDisplay 213 && originalDisplay == other.originalDisplay
213 && overflowX == other.overflowX 214 && overflowX == other.overflowX
214 && overflowY == other.overflowY 215 && overflowY == other.overflowY
215 && verticalAlign == other.verticalAlign 216 && verticalAlign == other.verticalAlign
216 && clear == other.clear 217 && clear == other.clear
217 && position == other.position 218 && position == other.position
218 && floating == other.floating 219 && floating == other.floating
219 && tableLayout == other.tableLayout 220 && tableLayout == other.tableLayout
221 && unicodeBidi == other.unicodeBidi
222 // hasViewportUnits
220 && pageBreakBefore == other.pageBreakBefore 223 && pageBreakBefore == other.pageBreakBefore
221 && pageBreakAfter == other.pageBreakAfter 224 && pageBreakAfter == other.pageBreakAfter
222 && pageBreakInside == other.pageBreakInside 225 && pageBreakInside == other.pageBreakInside;
223 && styleType == other.styleType 226 // styleType
224 && affectedByFocus == other.affectedByFocus 227 // pseudoBits
225 && affectedByHover == other.affectedByHover 228 // explicitInheritance
226 && affectedByActive == other.affectedByActive 229 // unique
227 && affectedByDrag == other.affectedByDrag 230 // emptyState
228 && pseudoBits == other.pseudoBits 231 // affectedByFocus
229 && unicodeBidi == other.unicodeBidi 232 // affectedByHover
230 && explicitInheritance == other.explicitInheritance 233 // affectedByActive
231 && unique == other.unique 234 // affectedByDrag
232 && emptyState == other.emptyState 235 // isLink
233 && isLink == other.isLink;
234 } 236 }
235 237
236 bool operator!=(const NonInheritedFlags& other) const { return !(*this = = other); } 238 bool operator!=(const NonInheritedFlags& other) const { return !(*this = = other); }
237 239
238 unsigned effectiveDisplay : 5; // EDisplay 240 unsigned effectiveDisplay : 5; // EDisplay
239 unsigned originalDisplay : 5; // EDisplay 241 unsigned originalDisplay : 5; // EDisplay
240 unsigned overflowX : 3; // EOverflow 242 unsigned overflowX : 3; // EOverflow
241 unsigned overflowY : 3; // EOverflow 243 unsigned overflowY : 3; // EOverflow
242 unsigned verticalAlign : 4; // EVerticalAlign 244 unsigned verticalAlign : 4; // EVerticalAlign
243 unsigned clear : 2; // EClear 245 unsigned clear : 2; // EClear
(...skipping 18 matching lines...) Expand all
262 unsigned unique : 1; // Style can not be shared. 264 unsigned unique : 1; // Style can not be shared.
263 265
264 unsigned emptyState : 1; 266 unsigned emptyState : 1;
265 267
266 unsigned affectedByFocus : 1; 268 unsigned affectedByFocus : 1;
267 unsigned affectedByHover : 1; 269 unsigned affectedByHover : 1;
268 unsigned affectedByActive : 1; 270 unsigned affectedByActive : 1;
269 unsigned affectedByDrag : 1; 271 unsigned affectedByDrag : 1;
270 272
271 unsigned isLink : 1; 273 unsigned isLink : 1;
272 // If you add more style bits here, you will also need to update LayoutS tyle::copyNonInheritedFrom() 274 // If you add more style bits here, you will also need to update LayoutS tyle::copyNonInheritedFromCached()
273 // 62 bits 275 // 62 bits
274 } noninherited_flags; 276 } noninherited_flags;
275 277
276 // !END SYNC! 278 // !END SYNC!
277 279
278 protected: 280 protected:
279 void setBitDefaults() 281 void setBitDefaults()
280 { 282 {
281 inherited_flags._empty_cells = initialEmptyCells(); 283 inherited_flags._empty_cells = initialEmptyCells();
282 inherited_flags._caption_side = initialCaptionSide(); 284 inherited_flags._caption_side = initialCaptionSide();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 static ItemPosition resolveJustification(const LayoutStyle& parentStyle, con st LayoutStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer); 346 static ItemPosition resolveJustification(const LayoutStyle& parentStyle, con st LayoutStyle& childStyle, ItemPosition resolvedAutoPositionForRenderer);
345 347
346 StyleDifference visualInvalidationDiff(const LayoutStyle&) const; 348 StyleDifference visualInvalidationDiff(const LayoutStyle&) const;
347 349
348 enum IsAtShadowBoundary { 350 enum IsAtShadowBoundary {
349 AtShadowBoundary, 351 AtShadowBoundary,
350 NotAtShadowBoundary, 352 NotAtShadowBoundary,
351 }; 353 };
352 354
353 void inheritFrom(const LayoutStyle& inheritParent, IsAtShadowBoundary = NotA tShadowBoundary); 355 void inheritFrom(const LayoutStyle& inheritParent, IsAtShadowBoundary = NotA tShadowBoundary);
354 void copyNonInheritedFrom(const LayoutStyle&); 356 void copyNonInheritedFromCached(const LayoutStyle&);
355 357
356 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags .styleType); } 358 PseudoId styleType() const { return static_cast<PseudoId>(noninherited_flags .styleType); }
357 void setStyleType(PseudoId styleType) { noninherited_flags.styleType = style Type; } 359 void setStyleType(PseudoId styleType) { noninherited_flags.styleType = style Type; }
358 360
359 LayoutStyle* getCachedPseudoStyle(PseudoId) const; 361 LayoutStyle* getCachedPseudoStyle(PseudoId) const;
360 LayoutStyle* addCachedPseudoStyle(PassRefPtr<LayoutStyle>); 362 LayoutStyle* addCachedPseudoStyle(PassRefPtr<LayoutStyle>);
361 void removeCachedPseudoStyle(PseudoId); 363 void removeCachedPseudoStyle(PseudoId);
362 364
363 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); } 365 const PseudoStyleCache* cachedPseudoStyles() const { return m_cachedPseudoSt yles.get(); }
364 366
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 } 1853 }
1852 1854
1853 inline bool LayoutStyle::hasPseudoElementStyle() const 1855 inline bool LayoutStyle::hasPseudoElementStyle() const
1854 { 1856 {
1855 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK; 1857 return noninherited_flags.pseudoBits & PSEUDO_ELEMENT_MASK;
1856 } 1858 }
1857 1859
1858 } // namespace blink 1860 } // namespace blink
1859 1861
1860 #endif // LayoutStyle_h 1862 #endif // LayoutStyle_h
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/layout/style/LayoutStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698