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

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

Issue 2538983002: Made CSS white-space property use IndependentInherit (Closed)
Patch Set: Rebase Created 4 years 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 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 } 203 }
204 204
205 bool operator!=(const InheritedData& other) const { 205 bool operator!=(const InheritedData& other) const {
206 return !(*this == other); 206 return !(*this == other);
207 } 207 }
208 208
209 inline bool compareEqualIndependent(const InheritedData& other) const { 209 inline bool compareEqualIndependent(const InheritedData& other) const {
210 // These must match the properties tagged 'independent' in 210 // These must match the properties tagged 'independent' in
211 // CSSProperties.in. 211 // CSSProperties.in.
212 // TODO(sashab): Generate this function. 212 // TODO(sashab): Generate this function.
213 return (m_pointerEvents == other.m_pointerEvents); 213 return (m_pointerEvents == other.m_pointerEvents) &&
214 (m_whiteSpace == other.m_whiteSpace);
214 } 215 }
215 216
216 inline bool compareEqualNonIndependent(const InheritedData& other) const { 217 inline bool compareEqualNonIndependent(const InheritedData& other) const {
217 return (m_listStyleType == other.m_listStyleType) && 218 return (m_listStyleType == other.m_listStyleType) &&
218 (m_textAlign == other.m_textAlign) && 219 (m_textAlign == other.m_textAlign) &&
219 (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && 220 (m_hasSimpleUnderline == other.m_hasSimpleUnderline) &&
220 (m_cursorStyle == other.m_cursorStyle) && 221 (m_cursorStyle == other.m_cursorStyle) &&
221 (m_direction == other.m_direction) && 222 (m_direction == other.m_direction) &&
222 (m_whiteSpace == other.m_whiteSpace) &&
223 (m_borderCollapse == other.m_borderCollapse) && 223 (m_borderCollapse == other.m_borderCollapse) &&
224 (m_boxDirection == other.m_boxDirection) && 224 (m_boxDirection == other.m_boxDirection) &&
225 (m_rtlOrdering == other.m_rtlOrdering) && 225 (m_rtlOrdering == other.m_rtlOrdering) &&
226 (m_printColorAdjust == other.m_printColorAdjust) && 226 (m_printColorAdjust == other.m_printColorAdjust) &&
227 (m_insideLink == other.m_insideLink) && 227 (m_insideLink == other.m_insideLink) &&
228 (m_writingMode == other.m_writingMode); 228 (m_writingMode == other.m_writingMode);
229 } 229 }
230 230
231 unsigned m_listStyleType : 7; // EListStyleType 231 unsigned m_listStyleType : 7; // EListStyleType
232 unsigned m_textAlign : 4; // ETextAlign 232 unsigned m_textAlign : 4; // ETextAlign
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // clear which inherited properties have a flag stored and which don't. 341 // clear which inherited properties have a flag stored and which don't.
342 // Keep this list of fields in sync with: 342 // Keep this list of fields in sync with:
343 // - setBitDefaults() 343 // - setBitDefaults()
344 // - The ComputedStyle setter, which must take an extra boolean parameter 344 // - The ComputedStyle setter, which must take an extra boolean parameter
345 // and set this - propagateIndependentInheritedProperties() in 345 // and set this - propagateIndependentInheritedProperties() in
346 // ComputedStyle.cpp 346 // ComputedStyle.cpp
347 // - The compareEqual() methods in the corresponding class 347 // - The compareEqual() methods in the corresponding class
348 // InheritedFlags 348 // InheritedFlags
349 unsigned m_isPointerEventsInherited : 1; 349 unsigned m_isPointerEventsInherited : 1;
350 unsigned m_isVisibilityInherited : 1; 350 unsigned m_isVisibilityInherited : 1;
351 unsigned m_isWhiteSpaceInherited : 1;
351 352
352 // If you add more style bits here, you will also need to update 353 // If you add more style bits here, you will also need to update
353 // ComputedStyle::copyNonInheritedFromCached() 68 bits 354 // ComputedStyle::copyNonInheritedFromCached() 68 bits
354 } m_nonInheritedData; 355 } m_nonInheritedData;
355 356
356 // !END SYNC! 357 // !END SYNC!
357 358
358 void setBitDefaults() { 359 void setBitDefaults() {
359 ComputedStyleBase::setBitDefaults(); 360 ComputedStyleBase::setBitDefaults();
360 m_inheritedData.m_listStyleType = 361 m_inheritedData.m_listStyleType =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 m_nonInheritedData.m_affectedByFocus = false; 400 m_nonInheritedData.m_affectedByFocus = false;
400 m_nonInheritedData.m_affectedByHover = false; 401 m_nonInheritedData.m_affectedByHover = false;
401 m_nonInheritedData.m_affectedByActive = false; 402 m_nonInheritedData.m_affectedByActive = false;
402 m_nonInheritedData.m_affectedByDrag = false; 403 m_nonInheritedData.m_affectedByDrag = false;
403 m_nonInheritedData.m_isLink = false; 404 m_nonInheritedData.m_isLink = false;
404 m_nonInheritedData.m_hasRemUnits = false; 405 m_nonInheritedData.m_hasRemUnits = false;
405 406
406 // All independently inherited properties default to being inherited. 407 // All independently inherited properties default to being inherited.
407 m_nonInheritedData.m_isPointerEventsInherited = true; 408 m_nonInheritedData.m_isPointerEventsInherited = true;
408 m_nonInheritedData.m_isVisibilityInherited = true; 409 m_nonInheritedData.m_isVisibilityInherited = true;
410 m_nonInheritedData.m_isWhiteSpaceInherited = true;
409 } 411 }
410 412
411 private: 413 private:
412 // TODO(sashab): Move these to the bottom of ComputedStyle. 414 // TODO(sashab): Move these to the bottom of ComputedStyle.
413 ALWAYS_INLINE ComputedStyle(); 415 ALWAYS_INLINE ComputedStyle();
414 416
415 enum InitialStyleTag { InitialStyle }; 417 enum InitialStyleTag { InitialStyle };
416 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag); 418 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag);
417 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); 419 ALWAYS_INLINE ComputedStyle(const ComputedStyle&);
418 420
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 } 2278 }
2277 2279
2278 // white-space inherited 2280 // white-space inherited
2279 static EWhiteSpace initialWhiteSpace() { return EWhiteSpace::Normal; } 2281 static EWhiteSpace initialWhiteSpace() { return EWhiteSpace::Normal; }
2280 EWhiteSpace whiteSpace() const { 2282 EWhiteSpace whiteSpace() const {
2281 return static_cast<EWhiteSpace>(m_inheritedData.m_whiteSpace); 2283 return static_cast<EWhiteSpace>(m_inheritedData.m_whiteSpace);
2282 } 2284 }
2283 void setWhiteSpace(EWhiteSpace v) { 2285 void setWhiteSpace(EWhiteSpace v) {
2284 m_inheritedData.m_whiteSpace = static_cast<unsigned>(v); 2286 m_inheritedData.m_whiteSpace = static_cast<unsigned>(v);
2285 } 2287 }
2288 void setWhiteSpaceIsInherited(bool isInherited) {
2289 m_nonInheritedData.m_isWhiteSpaceInherited = isInherited;
2290 }
2286 2291
2287 // word-break inherited (aka -epub-word-break) 2292 // word-break inherited (aka -epub-word-break)
2288 static EWordBreak initialWordBreak() { return NormalWordBreak; } 2293 static EWordBreak initialWordBreak() { return NormalWordBreak; }
2289 EWordBreak wordBreak() const { 2294 EWordBreak wordBreak() const {
2290 return static_cast<EWordBreak>(m_rareInheritedData->wordBreak); 2295 return static_cast<EWordBreak>(m_rareInheritedData->wordBreak);
2291 } 2296 }
2292 void setWordBreak(EWordBreak b) { 2297 void setWordBreak(EWordBreak b) {
2293 SET_VAR(m_rareInheritedData, wordBreak, b); 2298 SET_VAR(m_rareInheritedData, wordBreak, b);
2294 } 2299 }
2295 2300
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
4096 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); 4101 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1);
4097 } 4102 }
4098 4103
4099 inline bool ComputedStyle::hasPseudoElementStyle() const { 4104 inline bool ComputedStyle::hasPseudoElementStyle() const {
4100 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; 4105 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask;
4101 } 4106 }
4102 4107
4103 } // namespace blink 4108 } // namespace blink
4104 4109
4105 #endif // ComputedStyle_h 4110 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSProperties.in ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698