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

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

Issue 2838513002: DO NOT LAND. Revert of https://codereview.chromium.org/2797963002 (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | 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) 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 RefCounted<SameSizeAsComputedStyle> { 73 struct SameSizeAsComputedStyle : public RefCounted<SameSizeAsComputedStyle> {
74 struct ComputedStyleBase { 74 struct ComputedStyleBase {
75 unsigned bitfields_[4]; 75 unsigned bitfields_[4];
76 } base_; 76 } base_;
77 77
78 void* data_refs[7]; 78 void* data_refs[7];
79 void* own_ptrs[1]; 79 void* own_ptrs[1];
80 void* data_ref_svg_style; 80 void* data_ref_svg_style;
81
82 struct NonInheritedData {
83 unsigned m_bitfields[1];
84 } m_nonInheritedData;
81 }; 85 };
82 86
83 // If this assert fails, it means that size of ComputedStyle has changed. Please 87 // If this assert fails, it means that size of ComputedStyle has changed. Please
84 // check that you really *do* what to increase the size of ComputedStyle, then 88 // check that you really *do* what to increase the size of ComputedStyle, then
85 // update the SameSizeAsComputedStyle struct to match the updated storage of 89 // update the SameSizeAsComputedStyle struct to match the updated storage of
86 // ComputedStyle. 90 // ComputedStyle.
87 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); 91 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle);
88 92
89 PassRefPtr<ComputedStyle> ComputedStyle::Create() { 93 PassRefPtr<ComputedStyle> ComputedStyle::Create() {
90 return AdoptRef(new ComputedStyle(InitialStyle())); 94 return AdoptRef(new ComputedStyle(InitialStyle()));
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) 141 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o)
138 : ComputedStyleBase(o), 142 : ComputedStyleBase(o),
139 RefCounted<ComputedStyle>(), 143 RefCounted<ComputedStyle>(),
140 box_(o.box_), 144 box_(o.box_),
141 visual_(o.visual_), 145 visual_(o.visual_),
142 background_(o.background_), 146 background_(o.background_),
143 surround_(o.surround_), 147 surround_(o.surround_),
144 rare_non_inherited_data_(o.rare_non_inherited_data_), 148 rare_non_inherited_data_(o.rare_non_inherited_data_),
145 rare_inherited_data_(o.rare_inherited_data_), 149 rare_inherited_data_(o.rare_inherited_data_),
146 style_inherited_data_(o.style_inherited_data_), 150 style_inherited_data_(o.style_inherited_data_),
147 svg_style_(o.svg_style_) {} 151 svg_style_(o.svg_style_),
152 m_nonInheritedData(o.m_nonInheritedData) {}
148 153
149 static StyleRecalcChange DiffPseudoStyles(const ComputedStyle& old_style, 154 static StyleRecalcChange DiffPseudoStyles(const ComputedStyle& old_style,
150 const ComputedStyle& new_style) { 155 const ComputedStyle& new_style) {
151 // If the pseudoStyles have changed, ensure layoutObject triggers setStyle. 156 // If the pseudoStyles have changed, ensure layoutObject triggers setStyle.
152 if (!old_style.HasAnyPublicPseudoStyles() && 157 if (!old_style.HasAnyPublicPseudoStyles() &&
153 !new_style.HasAnyPublicPseudoStyles()) 158 !new_style.HasAnyPublicPseudoStyles())
154 return kNoChange; 159 return kNoChange;
155 for (PseudoId pseudo_id = kFirstPublicPseudoId; 160 for (PseudoId pseudo_id = kFirstPublicPseudoId;
156 pseudo_id < kFirstInternalPseudoId; 161 pseudo_id < kFirstInternalPseudoId;
157 pseudo_id = static_cast<PseudoId>(pseudo_id + 1)) { 162 pseudo_id = static_cast<PseudoId>(pseudo_id + 1)) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 rare_non_inherited_data_ = other.rare_non_inherited_data_; 345 rare_non_inherited_data_ = other.rare_non_inherited_data_;
341 346
342 // The flags are copied one-by-one because they contain 347 // The flags are copied one-by-one because they contain
343 // bunch of stuff other than real style data. 348 // bunch of stuff other than real style data.
344 // See comments for each skipped flag below. 349 // See comments for each skipped flag below.
345 350
346 // These are not generated in ComputedStyleBase 351 // These are not generated in ComputedStyleBase
347 SetOriginalDisplay(other.OriginalDisplay()); 352 SetOriginalDisplay(other.OriginalDisplay());
348 SetVerticalAlign(other.VerticalAlign()); 353 SetVerticalAlign(other.VerticalAlign());
349 SetHasViewportUnits(other.HasViewportUnits()); 354 SetHasViewportUnits(other.HasViewportUnits());
350 SetHasRemUnitsInternal(other.HasRemUnits()); 355 m_nonInheritedData.m_hasRemUnits = other.HasRemUnits();
351 356
352 // Correctly set during selector matching: 357 // Correctly set during selector matching:
353 // m_styleType 358 // m_styleType
354 // m_pseudoBits 359 // m_pseudoBits
355 360
356 // Set correctly while computing style for children: 361 // Set correctly while computing style for children:
357 // m_explicitInheritance 362 // m_explicitInheritance
358 363
359 // unique() styles are not cacheable. 364 // unique() styles are not cacheable.
360 DCHECK(!other.Unique()); 365 DCHECK(!other.Unique());
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 if (value < 0) 2508 if (value < 0)
2504 fvalue -= 0.5f; 2509 fvalue -= 0.5f;
2505 else 2510 else
2506 fvalue += 0.5f; 2511 fvalue += 0.5f;
2507 } 2512 }
2508 2513
2509 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2514 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2510 } 2515 }
2511 2516
2512 } // namespace blink 2517 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698