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

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

Issue 2786883002: Generate subgroup StyleSurroundData in ComputedStyle. (Closed)
Patch Set: Rebase 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/style/StyleFlexibleBoxData.h" 46 #include "core/style/StyleFlexibleBoxData.h"
47 #include "core/style/StyleGridData.h" 47 #include "core/style/StyleGridData.h"
48 #include "core/style/StyleGridItemData.h" 48 #include "core/style/StyleGridItemData.h"
49 #include "core/style/StyleInheritedData.h" 49 #include "core/style/StyleInheritedData.h"
50 #include "core/style/StyleMultiColData.h" 50 #include "core/style/StyleMultiColData.h"
51 #include "core/style/StyleOffsetRotation.h" 51 #include "core/style/StyleOffsetRotation.h"
52 #include "core/style/StyleRareInheritedData.h" 52 #include "core/style/StyleRareInheritedData.h"
53 #include "core/style/StyleRareNonInheritedData.h" 53 #include "core/style/StyleRareNonInheritedData.h"
54 #include "core/style/StyleReflection.h" 54 #include "core/style/StyleReflection.h"
55 #include "core/style/StyleSelfAlignmentData.h" 55 #include "core/style/StyleSelfAlignmentData.h"
56 #include "core/style/StyleSurroundData.h"
57 #include "core/style/StyleTransformData.h" 56 #include "core/style/StyleTransformData.h"
58 #include "core/style/StyleVisualData.h" 57 #include "core/style/StyleVisualData.h"
59 #include "core/style/StyleWillChangeData.h" 58 #include "core/style/StyleWillChangeData.h"
60 #include "core/style/TransformOrigin.h" 59 #include "core/style/TransformOrigin.h"
61 #include "platform/Length.h" 60 #include "platform/Length.h"
62 #include "platform/LengthBox.h" 61 #include "platform/LengthBox.h"
63 #include "platform/LengthPoint.h" 62 #include "platform/LengthPoint.h"
64 #include "platform/LengthSize.h" 63 #include "platform/LengthSize.h"
65 #include "platform/RuntimeEnabledFeatures.h" 64 #include "platform/RuntimeEnabledFeatures.h"
66 #include "platform/ThemeTypes.h" 65 #include "platform/ThemeTypes.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 friend class FilterOperationResolver; 180 friend class FilterOperationResolver;
182 friend class StyleBuilderConverter; 181 friend class StyleBuilderConverter;
183 friend class StyleResolverState; 182 friend class StyleResolverState;
184 friend class StyleResolver; 183 friend class StyleResolver;
185 184
186 protected: 185 protected:
187 // non-inherited attributes 186 // non-inherited attributes
188 DataRef<StyleBoxData> box_data_; 187 DataRef<StyleBoxData> box_data_;
189 DataRef<StyleVisualData> visual_data_; 188 DataRef<StyleVisualData> visual_data_;
190 DataRef<StyleBackgroundData> background_data_; 189 DataRef<StyleBackgroundData> background_data_;
191 DataRef<StyleSurroundData> surround_data_;
192 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_; 190 DataRef<StyleRareNonInheritedData> rare_non_inherited_data_;
193 191
194 // inherited attributes 192 // inherited attributes
195 DataRef<StyleRareInheritedData> rare_inherited_data_; 193 DataRef<StyleRareInheritedData> rare_inherited_data_;
196 DataRef<StyleInheritedData> style_inherited_data_; 194 DataRef<StyleInheritedData> style_inherited_data_;
197 195
198 // list of associated pseudo styles 196 // list of associated pseudo styles
199 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_; 197 std::unique_ptr<PseudoStyleCache> cached_pseudo_styles_;
200 198
201 DataRef<SVGComputedStyle> svg_style_; 199 DataRef<SVGComputedStyle> svg_style_;
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 590 }
593 591
594 // border-bottom-right-radius (aka -webkit-border-bottom-right-radius) 592 // border-bottom-right-radius (aka -webkit-border-bottom-right-radius)
595 const LengthSize& BorderBottomRightRadius() const { 593 const LengthSize& BorderBottomRightRadius() const {
596 return surround_data_->border_.BottomRight(); 594 return surround_data_->border_.BottomRight();
597 } 595 }
598 void SetBorderBottomRightRadius(const LengthSize& s) { 596 void SetBorderBottomRightRadius(const LengthSize& s) {
599 SET_VAR(surround_data_, border_.bottom_right_, s); 597 SET_VAR(surround_data_, border_.bottom_right_, s);
600 } 598 }
601 599
602 // Offset properties.
603 // left
604 static Length InitialLeft() { return Length(); }
605 const Length& Left() const { return surround_data_->left_; }
606 void SetLeft(const Length& v) { SET_VAR(surround_data_, left_, v); }
607
608 // right
609 static Length InitialRight() { return Length(); }
610 const Length& Right() const { return surround_data_->right_; }
611 void SetRight(const Length& v) { SET_VAR(surround_data_, right_, v); }
612
613 // top
614 static Length InitialTop() { return Length(); }
615 const Length& Top() const { return surround_data_->top_; }
616 void SetTop(const Length& v) { SET_VAR(surround_data_, top_, v); }
617
618 // bottom
619 static Length InitialBottom() { return Length(); }
620 const Length& Bottom() const { return surround_data_->bottom_; }
621 void SetBottom(const Length& v) { SET_VAR(surround_data_, bottom_, v); }
622
623 // box-shadow (aka -webkit-box-shadow) 600 // box-shadow (aka -webkit-box-shadow)
624 static ShadowList* InitialBoxShadow() { return 0; } 601 static ShadowList* InitialBoxShadow() { return 0; }
625 ShadowList* BoxShadow() const { 602 ShadowList* BoxShadow() const {
626 return rare_non_inherited_data_->box_shadow_.Get(); 603 return rare_non_inherited_data_->box_shadow_.Get();
627 } 604 }
628 void SetBoxShadow(PassRefPtr<ShadowList>); 605 void SetBoxShadow(PassRefPtr<ShadowList>);
629 606
630 // box-sizing (aka -webkit-box-sizing) 607 // box-sizing (aka -webkit-box-sizing)
631 static EBoxSizing InitialBoxSizing() { return EBoxSizing::kContentBox; } 608 static EBoxSizing InitialBoxSizing() { return EBoxSizing::kContentBox; }
632 EBoxSizing BoxSizing() const { return box_data_->BoxSizing(); } 609 EBoxSizing BoxSizing() const { return box_data_->BoxSizing(); }
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 1064
1088 // isolation 1065 // isolation
1089 static EIsolation InitialIsolation() { return kIsolationAuto; } 1066 static EIsolation InitialIsolation() { return kIsolationAuto; }
1090 EIsolation Isolation() const { 1067 EIsolation Isolation() const {
1091 return static_cast<EIsolation>(rare_non_inherited_data_->isolation_); 1068 return static_cast<EIsolation>(rare_non_inherited_data_->isolation_);
1092 } 1069 }
1093 void SetIsolation(EIsolation v) { 1070 void SetIsolation(EIsolation v) {
1094 rare_non_inherited_data_.Access()->isolation_ = v; 1071 rare_non_inherited_data_.Access()->isolation_ = v;
1095 } 1072 }
1096 1073
1097 // Margin properties.
1098
1099 // margin-top
1100 static Length InitialMarginTop() { return Length(kFixed); }
1101 const Length& MarginTop() const { return surround_data_->margin_top_; }
1102 void SetMarginTop(const Length& v) {
1103 SET_VAR(surround_data_, margin_top_, v);
1104 }
1105
1106 // margin-bottom
1107 static Length InitialMarginBottom() { return Length(kFixed); }
1108 const Length& MarginBottom() const { return surround_data_->margin_bottom_; }
1109 void SetMarginBottom(const Length& v) {
1110 SET_VAR(surround_data_, margin_bottom_, v);
1111 }
1112
1113 // margin-left
1114 static Length InitialMarginLeft() { return Length(kFixed); }
1115 const Length& MarginLeft() const { return surround_data_->margin_left_; }
1116 void SetMarginLeft(const Length& v) {
1117 SET_VAR(surround_data_, margin_left_, v);
1118 }
1119
1120 // margin-right
1121 static Length InitialMarginRight() { return Length(kFixed); }
1122 const Length& MarginRight() const { return surround_data_->margin_right_; }
1123 void SetMarginRight(const Length& v) {
1124 SET_VAR(surround_data_, margin_right_, v);
1125 }
1126
1127 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse) 1074 // -webkit-margin-before-collapse (aka -webkit-margin-top-collapse)
1128 static EMarginCollapse InitialMarginBeforeCollapse() { 1075 static EMarginCollapse InitialMarginBeforeCollapse() {
1129 return kMarginCollapseCollapse; 1076 return kMarginCollapseCollapse;
1130 } 1077 }
1131 EMarginCollapse MarginAfterCollapse() const { 1078 EMarginCollapse MarginAfterCollapse() const {
1132 return static_cast<EMarginCollapse>( 1079 return static_cast<EMarginCollapse>(
1133 rare_non_inherited_data_->margin_after_collapse); 1080 rare_non_inherited_data_->margin_after_collapse);
1134 } 1081 }
1135 void SetMarginBeforeCollapse(EMarginCollapse c) { 1082 void SetMarginBeforeCollapse(EMarginCollapse c) {
1136 SET_VAR(rare_non_inherited_data_, margin_before_collapse, c); 1083 SET_VAR(rare_non_inherited_data_, margin_before_collapse, c);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 static int InitialOutlineOffset() { return 0; } 1242 static int InitialOutlineOffset() { return 0; }
1296 int OutlineOffset() const { 1243 int OutlineOffset() const {
1297 if (rare_non_inherited_data_->outline_.Style() == kBorderStyleNone) 1244 if (rare_non_inherited_data_->outline_.Style() == kBorderStyleNone)
1298 return 0; 1245 return 0;
1299 return rare_non_inherited_data_->outline_.Offset(); 1246 return rare_non_inherited_data_->outline_.Offset();
1300 } 1247 }
1301 void SetOutlineOffset(int v) { 1248 void SetOutlineOffset(int v) {
1302 SET_VAR(rare_non_inherited_data_, outline_.offset_, v); 1249 SET_VAR(rare_non_inherited_data_, outline_.offset_, v);
1303 } 1250 }
1304 1251
1305 // Padding properties.
1306
1307 // padding-bottom
1308 static Length InitialPaddingBottom() { return Length(kFixed); }
1309 const Length& PaddingBottom() const {
1310 return surround_data_->padding_bottom_;
1311 }
1312 void SetPaddingBottom(const Length& v) {
1313 SET_VAR(surround_data_, padding_bottom_, v);
1314 }
1315
1316 // padding-left
1317 static Length InitialPaddingLeft() { return Length(kFixed); }
1318 const Length& PaddingLeft() const { return surround_data_->padding_left_; }
1319 void SetPaddingLeft(const Length& v) {
1320 SET_VAR(surround_data_, padding_left_, v);
1321 }
1322
1323 // padding-right
1324 static Length InitialPaddingRight() { return Length(kFixed); }
1325 const Length& PaddingRight() const { return surround_data_->padding_right_; }
1326 void SetPaddingRight(const Length& v) {
1327 SET_VAR(surround_data_, padding_right_, v);
1328 }
1329
1330 // padding-top
1331 static Length InitialPaddingTop() { return Length(kFixed); }
1332 const Length& PaddingTop() const { return surround_data_->padding_top_; }
1333 void SetPaddingTop(const Length& v) {
1334 SET_VAR(surround_data_, padding_top_, v);
1335 }
1336
1337 // perspective (aka -webkit-perspective) 1252 // perspective (aka -webkit-perspective)
1338 static float InitialPerspective() { return 0; } 1253 static float InitialPerspective() { return 0; }
1339 float Perspective() const { return rare_non_inherited_data_->perspective_; } 1254 float Perspective() const { return rare_non_inherited_data_->perspective_; }
1340 void SetPerspective(float p) { 1255 void SetPerspective(float p) {
1341 SET_VAR(rare_non_inherited_data_, perspective_, p); 1256 SET_VAR(rare_non_inherited_data_, perspective_, p);
1342 } 1257 }
1343 1258
1344 // perspective-origin (aka -webkit-perspective-origin) 1259 // perspective-origin (aka -webkit-perspective-origin)
1345 static LengthPoint InitialPerspectiveOrigin() { 1260 static LengthPoint InitialPerspectiveOrigin() {
1346 return LengthPoint(Length(50.0, kPercent), Length(50.0, kPercent)); 1261 return LengthPoint(Length(50.0, kPercent), Length(50.0, kPercent));
(...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after
3769 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId))); 3684 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3770 } 3685 }
3771 3686
3772 inline bool ComputedStyle::HasPseudoElementStyle() const { 3687 inline bool ComputedStyle::HasPseudoElementStyle() const {
3773 return PseudoBitsInternal() & kElementPseudoIdMask; 3688 return PseudoBitsInternal() & kElementPseudoIdMask;
3774 } 3689 }
3775 3690
3776 } // namespace blink 3691 } // namespace blink
3777 3692
3778 #endif // ComputedStyle_h 3693 #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