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

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

Issue 2844183002: Generate StyleBoxData in ComputedStyleBase. (Closed)
Patch Set: Rebase Created 3 years, 7 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 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 friend class ColorPropertyFunctions; 173 friend class ColorPropertyFunctions;
174 174
175 // FIXME: When we stop resolving currentColor at style time, these can be 175 // FIXME: When we stop resolving currentColor at style time, these can be
176 // removed. 176 // removed.
177 friend class CSSToStyleMap; 177 friend class CSSToStyleMap;
178 friend class FilterOperationResolver; 178 friend class FilterOperationResolver;
179 friend class StyleBuilderConverter; 179 friend class StyleBuilderConverter;
180 friend class StyleResolverState; 180 friend class StyleResolverState;
181 friend class StyleResolver; 181 friend class StyleResolver;
182 182
183 private:
184 class StyleBoxData : public RefCountedCopyable<StyleBoxData> {
185 public:
186 static PassRefPtr<StyleBoxData> Create() {
187 return AdoptRef(new StyleBoxData);
188 }
189 PassRefPtr<StyleBoxData> Copy() const {
190 return AdoptRef(new StyleBoxData(*this));
191 }
192
193 bool operator==(const StyleBoxData& other) const {
194 return width_ == other.width_ && height_ == other.height_ &&
195 min_width_ == other.min_width_ && max_width_ == other.max_width_ &&
196 min_height_ == other.min_height_ &&
197 max_height_ == other.max_height_ &&
198 vertical_align_length_ == other.vertical_align_length_ &&
199 z_index_ == other.z_index_ &&
200 has_auto_z_index_ == other.has_auto_z_index_ &&
201 box_sizing_ == other.box_sizing_ &&
202 box_decoration_break_ == other.box_decoration_break_;
203 }
204 bool operator!=(const StyleBoxData& o) const { return !(*this == o); }
205
206 Length width_;
207 Length height_;
208 Length min_width_;
209 Length max_width_;
210 Length min_height_;
211 Length max_height_;
212 Length vertical_align_length_;
213 int z_index_;
214 unsigned has_auto_z_index_ : 1;
215 unsigned box_sizing_ : 1; // EBoxSizing
216 unsigned box_decoration_break_ : 1; // EBoxDecorationBreak
217
218 private:
219 StyleBoxData()
220 : width_(Length()),
221 height_(Length()),
222 min_width_(Length()),
223 max_width_(Length(kMaxSizeNone)),
224 min_height_(Length()),
225 max_height_(Length(kMaxSizeNone)),
226 z_index_(0),
227 has_auto_z_index_(static_cast<unsigned>(true)),
228 box_sizing_(static_cast<unsigned>(EBoxSizing::kContentBox)),
229 box_decoration_break_(
230 static_cast<unsigned>(EBoxDecorationBreak::kSlice)) {}
231
232 StyleBoxData(const StyleBoxData&) = default;
233 };
234
235 protected: 183 protected:
236 // non-inherited attributes 184 // non-inherited attributes
237 DataRef<StyleBoxData> box_data_;
238 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; 185 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_;
239 186
240 // inherited attributes 187 // inherited attributes
241 DataRef<StyleRareInheritedData> rare_inherited_data_; 188 DataRef<StyleRareInheritedData> rare_inherited_data_;
242 DataRef<StyleInheritedData> inherited_data_; 189 DataRef<StyleInheritedData> inherited_data_;
243 190
244 // list of associated pseudo styles 191 // list of associated pseudo styles
245 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; 192 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_;
246 193
247 DataRef<SVGComputedStyle> svg_style_; 194 DataRef<SVGComputedStyle> svg_style_;
(...skipping 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3766 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3820 } 3767 }
3821 3768
3822 inline bool ComputedStyle::HasPseudoElementStyle() const { 3769 inline bool ComputedStyle::HasPseudoElementStyle() const {
3823 return PseudoBitsInternal() & kElementPseudoIdMask; 3770 return PseudoBitsInternal() & kElementPseudoIdMask;
3824 } 3771 }
3825 3772
3826 } // namespace blink 3773 } // namespace blink
3827 3774
3828 #endif // ComputedStyle_h 3775 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698