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

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

Issue 2555423002: Move white-space to be generated in ComputedStyleBase. (Closed)
Patch Set: Updated SameSizeAsComputedStyle() to reflect the change in inherited data bitfield size. 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // Since different compilers/architectures pack ComputedStyle differently, 71 // Since different compilers/architectures pack ComputedStyle differently,
72 // re-create the same structure for an accurate size comparison. 72 // re-create the same structure for an accurate size comparison.
73 struct SameSizeAsComputedStyle : public ComputedStyleBase, 73 struct SameSizeAsComputedStyle : public ComputedStyleBase,
74 public RefCounted<ComputedStyle> { 74 public RefCounted<ComputedStyle> {
75 void* dataRefs[7]; 75 void* dataRefs[7];
76 void* ownPtrs[1]; 76 void* ownPtrs[1];
77 void* dataRefSvgStyle; 77 void* dataRefSvgStyle;
78 78
79 struct InheritedData { 79 struct InheritedData {
80 unsigned m_bitfields[2]; 80 unsigned m_bitfields[1];
81 } m_inheritedData; 81 } m_inheritedData;
82 82
83 struct NonInheritedData { 83 struct NonInheritedData {
84 unsigned m_bitfields[3]; 84 unsigned m_bitfields[3];
85 } m_nonInheritedData; 85 } m_nonInheritedData;
86 }; 86 };
87 87
88 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); 88 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle);
89 89
90 PassRefPtr<ComputedStyle> ComputedStyle::create() { 90 PassRefPtr<ComputedStyle> ComputedStyle::create() {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return Inherit; 230 return Inherit;
231 231
232 return NoInherit; 232 return NoInherit;
233 } 233 }
234 234
235 void ComputedStyle::propagateIndependentInheritedProperties( 235 void ComputedStyle::propagateIndependentInheritedProperties(
236 const ComputedStyle& parentStyle) { 236 const ComputedStyle& parentStyle) {
237 ComputedStyleBase::propagateIndependentInheritedProperties(parentStyle); 237 ComputedStyleBase::propagateIndependentInheritedProperties(parentStyle);
238 if (m_nonInheritedData.m_isPointerEventsInherited) 238 if (m_nonInheritedData.m_isPointerEventsInherited)
239 setPointerEvents(parentStyle.pointerEvents()); 239 setPointerEvents(parentStyle.pointerEvents());
240 if (m_nonInheritedData.m_isWhiteSpaceInherited)
241 setWhiteSpace(parentStyle.whiteSpace());
242 } 240 }
243 241
244 StyleSelfAlignmentData resolvedSelfAlignment( 242 StyleSelfAlignmentData resolvedSelfAlignment(
245 const StyleSelfAlignmentData& value, 243 const StyleSelfAlignmentData& value,
246 ItemPosition normalValueBehavior) { 244 ItemPosition normalValueBehavior) {
247 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' 245 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto'
248 // flag to not just mean 'auto' prior to running the StyleAdjuster but also 246 // flag to not just mean 'auto' prior to running the StyleAdjuster but also
249 // mean 'normal' after running it. 247 // mean 'normal' after running it.
250 if (value.position() == ItemPositionNormal || 248 if (value.position() == ItemPositionNormal ||
251 value.position() == ItemPositionAuto) 249 value.position() == ItemPositionAuto)
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // m_nonInheritedData.m_affectedByFocus 415 // m_nonInheritedData.m_affectedByFocus
418 // m_nonInheritedData.m_affectedByHover 416 // m_nonInheritedData.m_affectedByHover
419 // m_nonInheritedData.m_affectedByActive 417 // m_nonInheritedData.m_affectedByActive
420 // m_nonInheritedData.m_affectedByDrag 418 // m_nonInheritedData.m_affectedByDrag
421 // m_nonInheritedData.m_isLink 419 // m_nonInheritedData.m_isLink
422 420
423 // Any properties that are inherited on a style are also inherited on elements 421 // Any properties that are inherited on a style are also inherited on elements
424 // that share this style. 422 // that share this style.
425 m_nonInheritedData.m_isPointerEventsInherited = 423 m_nonInheritedData.m_isPointerEventsInherited =
426 other.m_nonInheritedData.m_isPointerEventsInherited; 424 other.m_nonInheritedData.m_isPointerEventsInherited;
427 m_nonInheritedData.m_isWhiteSpaceInherited =
428 other.m_nonInheritedData.m_isWhiteSpaceInherited;
429 425
430 if (m_svgStyle != other.m_svgStyle) 426 if (m_svgStyle != other.m_svgStyle)
431 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get()); 427 m_svgStyle.access()->copyNonInheritedFromCached(other.m_svgStyle.get());
432 DCHECK_EQ(zoom(), initialZoom()); 428 DCHECK_EQ(zoom(), initialZoom());
433 } 429 }
434 430
435 bool ComputedStyle::operator==(const ComputedStyle& o) const { 431 bool ComputedStyle::operator==(const ComputedStyle& o) const {
436 return inheritedEqual(o) && nonInheritedEqual(o); 432 return inheritedEqual(o) && nonInheritedEqual(o);
437 } 433 }
438 434
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 m_styleInheritedData->vertical_border_spacing != 812 m_styleInheritedData->vertical_border_spacing !=
817 other.m_styleInheritedData->vertical_border_spacing) 813 other.m_styleInheritedData->vertical_border_spacing)
818 return true; 814 return true;
819 } 815 }
820 816
821 if (m_inheritedData.m_boxDirection != other.m_inheritedData.m_boxDirection || 817 if (m_inheritedData.m_boxDirection != other.m_inheritedData.m_boxDirection ||
822 m_inheritedData.m_rtlOrdering != other.m_inheritedData.m_rtlOrdering || 818 m_inheritedData.m_rtlOrdering != other.m_inheritedData.m_rtlOrdering ||
823 m_inheritedData.m_textAlign != other.m_inheritedData.m_textAlign || 819 m_inheritedData.m_textAlign != other.m_inheritedData.m_textAlign ||
824 textTransform() != other.textTransform() || 820 textTransform() != other.textTransform() ||
825 m_inheritedData.m_direction != other.m_inheritedData.m_direction || 821 m_inheritedData.m_direction != other.m_inheritedData.m_direction ||
826 m_inheritedData.m_whiteSpace != other.m_inheritedData.m_whiteSpace || 822 whiteSpace() != other.whiteSpace() ||
827 m_inheritedData.m_writingMode != other.m_inheritedData.m_writingMode) 823 m_inheritedData.m_writingMode != other.m_inheritedData.m_writingMode)
828 return true; 824 return true;
829 825
830 if (m_nonInheritedData.m_overflowX != other.m_nonInheritedData.m_overflowX || 826 if (m_nonInheritedData.m_overflowX != other.m_nonInheritedData.m_overflowX ||
831 m_nonInheritedData.m_overflowY != other.m_nonInheritedData.m_overflowY || 827 m_nonInheritedData.m_overflowY != other.m_nonInheritedData.m_overflowY ||
832 m_nonInheritedData.m_clear != other.m_nonInheritedData.m_clear || 828 m_nonInheritedData.m_clear != other.m_nonInheritedData.m_clear ||
833 m_nonInheritedData.m_unicodeBidi != 829 m_nonInheritedData.m_unicodeBidi !=
834 other.m_nonInheritedData.m_unicodeBidi || 830 other.m_nonInheritedData.m_unicodeBidi ||
835 floating() != other.floating() || 831 floating() != other.floating() ||
836 m_nonInheritedData.m_originalDisplay != 832 m_nonInheritedData.m_originalDisplay !=
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 if (value < 0) 2462 if (value < 0)
2467 fvalue -= 0.5f; 2463 fvalue -= 0.5f;
2468 else 2464 else
2469 fvalue += 0.5f; 2465 fvalue += 0.5f;
2470 } 2466 }
2471 2467
2472 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2468 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2473 } 2469 }
2474 2470
2475 } // namespace blink 2471 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698