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

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

Issue 2841433002: Generate StyleBackgroundData 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 19 matching lines...) Expand all
30 #include "core/CSSPropertyNames.h" 30 #include "core/CSSPropertyNames.h"
31 #include "core/ComputedStyleBase.h" 31 #include "core/ComputedStyleBase.h"
32 #include "core/CoreExport.h" 32 #include "core/CoreExport.h"
33 #include "core/style/BorderValue.h" 33 #include "core/style/BorderValue.h"
34 #include "core/style/ComputedStyleConstants.h" 34 #include "core/style/ComputedStyleConstants.h"
35 #include "core/style/CounterDirectives.h" 35 #include "core/style/CounterDirectives.h"
36 #include "core/style/DataRef.h" 36 #include "core/style/DataRef.h"
37 #include "core/style/LineClampValue.h" 37 #include "core/style/LineClampValue.h"
38 #include "core/style/NinePieceImage.h" 38 #include "core/style/NinePieceImage.h"
39 #include "core/style/SVGComputedStyle.h" 39 #include "core/style/SVGComputedStyle.h"
40 #include "core/style/StyleBackgroundData.h"
41 #include "core/style/StyleBoxData.h" 40 #include "core/style/StyleBoxData.h"
42 #include "core/style/StyleContentAlignmentData.h" 41 #include "core/style/StyleContentAlignmentData.h"
43 #include "core/style/StyleDeprecatedFlexibleBoxData.h" 42 #include "core/style/StyleDeprecatedFlexibleBoxData.h"
44 #include "core/style/StyleDifference.h" 43 #include "core/style/StyleDifference.h"
45 #include "core/style/StyleFilterData.h" 44 #include "core/style/StyleFilterData.h"
46 #include "core/style/StyleFlexibleBoxData.h" 45 #include "core/style/StyleFlexibleBoxData.h"
47 #include "core/style/StyleGridData.h" 46 #include "core/style/StyleGridData.h"
48 #include "core/style/StyleGridItemData.h" 47 #include "core/style/StyleGridItemData.h"
49 #include "core/style/StyleInheritedData.h" 48 #include "core/style/StyleInheritedData.h"
50 #include "core/style/StyleMultiColData.h" 49 #include "core/style/StyleMultiColData.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 friend class CSSToStyleMap; 178 friend class CSSToStyleMap;
180 friend class FilterOperationResolver; 179 friend class FilterOperationResolver;
181 friend class StyleBuilderConverter; 180 friend class StyleBuilderConverter;
182 friend class StyleResolverState; 181 friend class StyleResolverState;
183 friend class StyleResolver; 182 friend class StyleResolver;
184 183
185 protected: 184 protected:
186 // non-inherited attributes 185 // non-inherited attributes
187 DataRef<StyleBoxData> box_data_; 186 DataRef<StyleBoxData> box_data_;
188 DataRef<StyleVisualData> visual_data_; 187 DataRef<StyleVisualData> visual_data_;
189 DataRef<StyleBackgroundData> background_data_;
190 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; 188 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_;
191 189
192 // inherited attributes 190 // inherited attributes
193 DataRef<StyleRareInheritedData> rare_inherited_data_; 191 DataRef<StyleRareInheritedData> rare_inherited_data_;
194 DataRef<StyleInheritedData> style_inherited_data_; 192 DataRef<StyleInheritedData> style_inherited_data_;
195 193
196 // list of associated pseudo styles 194 // list of associated pseudo styles
197 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; 195 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_;
198 196
199 DataRef<SVGComputedStyle> svg_style_; 197 DataRef<SVGComputedStyle> svg_style_;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 rare_non_inherited_data_->backface_visibility_); 408 rare_non_inherited_data_->backface_visibility_);
411 } 409 }
412 void SetBackfaceVisibility(EBackfaceVisibility b) { 410 void SetBackfaceVisibility(EBackfaceVisibility b) {
413 SET_VAR(rare_non_inherited_data_, backface_visibility_, b); 411 SET_VAR(rare_non_inherited_data_, backface_visibility_, b);
414 } 412 }
415 413
416 // Background properties. 414 // Background properties.
417 // background-color 415 // background-color
418 static Color InitialBackgroundColor() { return Color::kTransparent; } 416 static Color InitialBackgroundColor() { return Color::kTransparent; }
419 void SetBackgroundColor(const StyleColor& v) { 417 void SetBackgroundColor(const StyleColor& v) {
420 SET_VAR(background_data_, color_, v); 418 SET_VAR(background_data_, background_color_, v);
421 } 419 }
422 420
423 // background-image 421 // background-image
424 bool HasBackgroundImage() const { 422 bool HasBackgroundImage() const {
425 return background_data_->Background().HasImage(); 423 return background_data_->background_.HasImage();
426 } 424 }
427 bool HasFixedBackgroundImage() const { 425 bool HasFixedBackgroundImage() const {
428 return background_data_->Background().HasFixedImage(); 426 return background_data_->background_.HasFixedImage();
429 } 427 }
430 bool HasEntirelyFixedBackground() const; 428 bool HasEntirelyFixedBackground() const;
431 429
432 // background-clip 430 // background-clip
433 EFillBox BackgroundClip() const { 431 EFillBox BackgroundClip() const {
434 return static_cast<EFillBox>(background_data_->Background().Clip()); 432 return static_cast<EFillBox>(background_data_->background_.Clip());
435 } 433 }
436 434
437 // Border properties. 435 // Border properties.
438 // -webkit-border-image 436 // -webkit-border-image
439 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); } 437 static NinePieceImage InitialNinePieceImage() { return NinePieceImage(); }
440 const NinePieceImage& BorderImage() const { 438 const NinePieceImage& BorderImage() const {
441 return surround_data_->border_.GetImage(); 439 return surround_data_->border_.GetImage();
442 } 440 }
443 void SetBorderImage(const NinePieceImage& b) { 441 void SetBorderImage(const NinePieceImage& b) {
444 SET_VAR(surround_data_, border_.image_, b); 442 SET_VAR(surround_data_, border_.image_, b);
(...skipping 2913 matching lines...) Expand 10 before | Expand all | Expand 10 after
3358 bool HasBoxDecorationBackground() const { 3356 bool HasBoxDecorationBackground() const {
3359 return HasBackground() || HasBorderDecoration() || HasAppearance() || 3357 return HasBackground() || HasBorderDecoration() || HasAppearance() ||
3360 BoxShadow(); 3358 BoxShadow();
3361 } 3359 }
3362 3360
3363 // Background utility functions. 3361 // Background utility functions.
3364 FillLayer& AccessBackgroundLayers() { 3362 FillLayer& AccessBackgroundLayers() {
3365 return background_data_.Access()->background_; 3363 return background_data_.Access()->background_;
3366 } 3364 }
3367 const FillLayer& BackgroundLayers() const { 3365 const FillLayer& BackgroundLayers() const {
3368 return background_data_->Background(); 3366 return background_data_->background_;
3369 } 3367 }
3370 void AdjustBackgroundLayers() { 3368 void AdjustBackgroundLayers() {
3371 if (BackgroundLayers().Next()) { 3369 if (BackgroundLayers().Next()) {
3372 AccessBackgroundLayers().CullEmptyLayers(); 3370 AccessBackgroundLayers().CullEmptyLayers();
3373 AccessBackgroundLayers().FillUnsetProperties(); 3371 AccessBackgroundLayers().FillUnsetProperties();
3374 } 3372 }
3375 } 3373 }
3376 bool HasBackgroundRelatedColorReferencingCurrentColor() const { 3374 bool HasBackgroundRelatedColorReferencingCurrentColor() const {
3377 if (BackgroundColor().IsCurrentColor() || 3375 if (BackgroundColor().IsCurrentColor() ||
3378 VisitedLinkBackgroundColor().IsCurrentColor()) 3376 VisitedLinkBackgroundColor().IsCurrentColor())
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
3493 } 3491 }
3494 StyleColor BorderRightColor() const { 3492 StyleColor BorderRightColor() const {
3495 return surround_data_->border_.Right().GetColor(); 3493 return surround_data_->border_.Right().GetColor();
3496 } 3494 }
3497 StyleColor BorderTopColor() const { 3495 StyleColor BorderTopColor() const {
3498 return surround_data_->border_.Top().GetColor(); 3496 return surround_data_->border_.Top().GetColor();
3499 } 3497 }
3500 StyleColor BorderBottomColor() const { 3498 StyleColor BorderBottomColor() const {
3501 return surround_data_->border_.Bottom().GetColor(); 3499 return surround_data_->border_.Bottom().GetColor();
3502 } 3500 }
3503 StyleColor BackgroundColor() const { return background_data_->GetColor(); } 3501 StyleColor BackgroundColor() const {
3502 return background_data_->background_color_;
3503 }
3504 StyleAutoColor CaretColor() const { 3504 StyleAutoColor CaretColor() const {
3505 return rare_inherited_data_->CaretColor(); 3505 return rare_inherited_data_->CaretColor();
3506 } 3506 }
3507 Color GetColor() const; 3507 Color GetColor() const;
3508 StyleColor ColumnRuleColor() const { 3508 StyleColor ColumnRuleColor() const {
3509 return rare_non_inherited_data_->multi_col_->rule_.GetColor(); 3509 return rare_non_inherited_data_->multi_col_->rule_.GetColor();
3510 } 3510 }
3511 StyleColor OutlineColor() const { 3511 StyleColor OutlineColor() const {
3512 return rare_non_inherited_data_->outline_.GetColor(); 3512 return rare_non_inherited_data_->outline_.GetColor();
3513 } 3513 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3690 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3690 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3691 } 3691 }
3692 3692
3693 inline bool ComputedStyle::HasPseudoElementStyle() const { 3693 inline bool ComputedStyle::HasPseudoElementStyle() const {
3694 return PseudoBitsInternal() & kElementPseudoIdMask; 3694 return PseudoBitsInternal() & kElementPseudoIdMask;
3695 } 3695 }
3696 3696
3697 } // namespace blink 3697 } // namespace blink
3698 3698
3699 #endif // ComputedStyle_h 3699 #endif // ComputedStyle_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/BUILD.gn ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698