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

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

Issue 2830573002: Use generated getters/setters in ComputedStyle instead of directly accessing fields (Closed)
Patch Set: Comments 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 StyleSelfAlignmentData ResolvedJustifySelf( 250 StyleSelfAlignmentData ResolvedJustifySelf(
251 ItemPosition normal_value_behaviour, 251 ItemPosition normal_value_behaviour,
252 const ComputedStyle* parent_style = nullptr) const; 252 const ComputedStyle* parent_style = nullptr) const;
253 253
254 StyleDifference VisualInvalidationDiff(const ComputedStyle&) const; 254 StyleDifference VisualInvalidationDiff(const ComputedStyle&) const;
255 255
256 void InheritFrom(const ComputedStyle& inherit_parent, 256 void InheritFrom(const ComputedStyle& inherit_parent,
257 IsAtShadowBoundary = kNotAtShadowBoundary); 257 IsAtShadowBoundary = kNotAtShadowBoundary);
258 void CopyNonInheritedFromCached(const ComputedStyle&); 258 void CopyNonInheritedFromCached(const ComputedStyle&);
259 259
260 PseudoId StyleType() const { return static_cast<PseudoId>(style_type_); } 260 PseudoId StyleType() const { return StyleTypeInternal(); }
261 void SetStyleType(PseudoId style_type) { style_type_ = style_type; } 261 void SetStyleType(PseudoId style_type) { SetStyleTypeInternal(style_type); }
262 262
263 ComputedStyle* GetCachedPseudoStyle(PseudoId) const; 263 ComputedStyle* GetCachedPseudoStyle(PseudoId) const;
264 ComputedStyle* AddCachedPseudoStyle(PassRefPtr<ComputedStyle>); 264 ComputedStyle* AddCachedPseudoStyle(PassRefPtr<ComputedStyle>);
265 void RemoveCachedPseudoStyle(PseudoId); 265 void RemoveCachedPseudoStyle(PseudoId);
266 266
267 const PseudoStyleCache* CachedPseudoStyles() const { 267 const PseudoStyleCache* CachedPseudoStyles() const {
268 return cached_pseudo_styles_.get(); 268 return cached_pseudo_styles_.get();
269 } 269 }
270 270
271 /** 271 /**
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 return static_cast<TouchAction>(rare_non_inherited_data_->touch_action_); 1632 return static_cast<TouchAction>(rare_non_inherited_data_->touch_action_);
1633 } 1633 }
1634 void SetTouchAction(TouchAction t) { 1634 void SetTouchAction(TouchAction t) {
1635 SET_VAR(rare_non_inherited_data_, touch_action_, t); 1635 SET_VAR(rare_non_inherited_data_, touch_action_, t);
1636 } 1636 }
1637 1637
1638 // vertical-align 1638 // vertical-align
1639 static EVerticalAlign InitialVerticalAlign() { 1639 static EVerticalAlign InitialVerticalAlign() {
1640 return EVerticalAlign::kBaseline; 1640 return EVerticalAlign::kBaseline;
1641 } 1641 }
1642 EVerticalAlign VerticalAlign() const { 1642 EVerticalAlign VerticalAlign() const { return VerticalAlignInternal(); }
1643 return static_cast<EVerticalAlign>(vertical_align_);
1644 }
1645 const Length& GetVerticalAlignLength() const { return box_->VerticalAlign(); } 1643 const Length& GetVerticalAlignLength() const { return box_->VerticalAlign(); }
1646 void SetVerticalAlign(EVerticalAlign v) { 1644 void SetVerticalAlign(EVerticalAlign v) { SetVerticalAlignInternal(v); }
1647 vertical_align_ = static_cast<unsigned>(v);
1648 }
1649 void SetVerticalAlignLength(const Length& length) { 1645 void SetVerticalAlignLength(const Length& length) {
1650 SetVerticalAlign(EVerticalAlign::kLength); 1646 SetVerticalAlignInternal(EVerticalAlign::kLength);
1651 SET_VAR(box_, vertical_align_, length); 1647 SET_VAR(box_, vertical_align_, length);
1652 } 1648 }
1653 1649
1654 // will-change 1650 // will-change
1655 const Vector<CSSPropertyID>& WillChangeProperties() const { 1651 const Vector<CSSPropertyID>& WillChangeProperties() const {
1656 return rare_non_inherited_data_->will_change_->properties_; 1652 return rare_non_inherited_data_->will_change_->properties_;
1657 } 1653 }
1658 bool WillChangeContents() const { 1654 bool WillChangeContents() const {
1659 return rare_non_inherited_data_->will_change_->contents_; 1655 return rare_non_inherited_data_->will_change_->contents_;
1660 } 1656 }
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 } 2233 }
2238 2234
2239 bool InheritedEqual(const ComputedStyle&) const; 2235 bool InheritedEqual(const ComputedStyle&) const;
2240 bool NonInheritedEqual(const ComputedStyle&) const; 2236 bool NonInheritedEqual(const ComputedStyle&) const;
2241 inline bool IndependentInheritedEqual(const ComputedStyle&) const; 2237 inline bool IndependentInheritedEqual(const ComputedStyle&) const;
2242 inline bool NonIndependentInheritedEqual(const ComputedStyle&) const; 2238 inline bool NonIndependentInheritedEqual(const ComputedStyle&) const;
2243 bool LoadingCustomFontsEqual(const ComputedStyle&) const; 2239 bool LoadingCustomFontsEqual(const ComputedStyle&) const;
2244 bool InheritedDataShared(const ComputedStyle&) const; 2240 bool InheritedDataShared(const ComputedStyle&) const;
2245 2241
2246 bool HasChildDependentFlags() const { 2242 bool HasChildDependentFlags() const {
2247 return EmptyState() || HasExplicitlyInheritedProperties(); 2243 return EmptyStateInternal() || HasExplicitlyInheritedProperties();
2248 } 2244 }
2249 void CopyChildDependentFlagsFrom(const ComputedStyle&); 2245 void CopyChildDependentFlagsFrom(const ComputedStyle&);
2250 2246
2251 // Counters. 2247 // Counters.
2252 const CounterDirectiveMap* GetCounterDirectives() const; 2248 const CounterDirectiveMap* GetCounterDirectives() const;
2253 CounterDirectiveMap& AccessCounterDirectives(); 2249 CounterDirectiveMap& AccessCounterDirectives();
2254 const CounterDirectives GetCounterDirectives( 2250 const CounterDirectives GetCounterDirectives(
2255 const AtomicString& identifier) const; 2251 const AtomicString& identifier) const;
2256 void ClearIncrementDirectives(); 2252 void ClearIncrementDirectives();
2257 void ClearResetDirectives(); 2253 void ClearResetDirectives();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 } 2302 }
2307 CSSTransitionData& AccessTransitions(); 2303 CSSTransitionData& AccessTransitions();
2308 2304
2309 // Callback selectors. 2305 // Callback selectors.
2310 const Vector<String>& CallbackSelectors() const { 2306 const Vector<String>& CallbackSelectors() const {
2311 return rare_non_inherited_data_->callback_selectors_; 2307 return rare_non_inherited_data_->callback_selectors_;
2312 } 2308 }
2313 void AddCallbackSelector(const String& selector); 2309 void AddCallbackSelector(const String& selector);
2314 2310
2315 // Non-property flags. 2311 // Non-property flags.
2316 bool EmptyState() const { return empty_state_; } 2312 bool EmptyState() const { return EmptyStateInternal(); }
2317 void SetEmptyState(bool b) { 2313 void SetEmptyState(bool b) {
2318 SetUnique(); 2314 SetUnique();
2319 empty_state_ = b; 2315 SetEmptyStateInternal(b);
2320 } 2316 }
2321 2317
2322 bool HasInlineTransform() const { 2318 bool HasInlineTransform() const {
2323 return rare_non_inherited_data_->has_inline_transform_; 2319 return rare_non_inherited_data_->has_inline_transform_;
2324 } 2320 }
2325 void SetHasInlineTransform(bool b) { 2321 void SetHasInlineTransform(bool b) {
2326 SET_VAR(rare_non_inherited_data_, has_inline_transform_, b); 2322 SET_VAR(rare_non_inherited_data_, has_inline_transform_, b);
2327 } 2323 }
2328 2324
2329 bool HasCompositorProxy() const { 2325 bool HasCompositorProxy() const {
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3687 inline bool ComputedStyle::SetTextOrientation( 3683 inline bool ComputedStyle::SetTextOrientation(
3688 TextOrientation text_orientation) { 3684 TextOrientation text_orientation) {
3689 if (compareEqual(rare_inherited_data_->text_orientation_, text_orientation)) 3685 if (compareEqual(rare_inherited_data_->text_orientation_, text_orientation))
3690 return false; 3686 return false;
3691 3687
3692 rare_inherited_data_.Access()->text_orientation_ = text_orientation; 3688 rare_inherited_data_.Access()->text_orientation_ = text_orientation;
3693 return true; 3689 return true;
3694 } 3690 }
3695 3691
3696 inline bool ComputedStyle::HasAnyPublicPseudoStyles() const { 3692 inline bool ComputedStyle::HasAnyPublicPseudoStyles() const {
3697 return pseudo_bits_; 3693 return PseudoBitsInternal() != kPseudoIdNone
3698 } 3694 }
3699 3695
3700 inline bool ComputedStyle::HasPseudoStyle(PseudoId pseudo) const { 3696 inline bool ComputedStyle::HasPseudoStyle(PseudoId pseudo) const {
3701 DCHECK(pseudo >= kFirstPublicPseudoId); 3697 DCHECK(pseudo >= kFirstPublicPseudoId);
3702 DCHECK(pseudo < kFirstInternalPseudoId); 3698 DCHECK(pseudo < kFirstInternalPseudoId);
3703 return (1 << (pseudo - kFirstPublicPseudoId)) & pseudo_bits_; 3699 return (1 << (pseudo - kFirstPublicPseudoId)) & PseudoBitsInternal();
3704 } 3700 }
3705 3701
3706 inline void ComputedStyle::SetHasPseudoStyle(PseudoId pseudo) { 3702 inline void ComputedStyle::SetHasPseudoStyle(PseudoId pseudo) {
3707 DCHECK(pseudo >= kFirstPublicPseudoId); 3703 DCHECK(pseudo >= kFirstPublicPseudoId);
3708 DCHECK(pseudo < kFirstInternalPseudoId); 3704 DCHECK(pseudo < kFirstInternalPseudoId);
3709 pseudo_bits_ |= 1 << (pseudo - kFirstPublicPseudoId); 3705 // TODO: Fix up this code it is hard to understand
suzyh_UTC10 (ex-contributor) 2017/04/20 06:18:27 Grammar nit: "code it" -> "code; it"
nainar 2017/04/20 06:47:12 Done.
3706 SetPseudoBitsInternal(static_cast<PseudoId>(
3707 PseudoBitsInternal() | 1 << (pseudo - kFirstPublicPseudoId)));
3710 } 3708 }
3711 3709
3712 inline bool ComputedStyle::HasPseudoElementStyle() const { 3710 inline bool ComputedStyle::HasPseudoElementStyle() const {
3713 return pseudo_bits_ & kElementPseudoIdMask; 3711 return PseudoBitsInternal() & kElementPseudoIdMask;
3714 } 3712 }
3715 3713
3716 } // namespace blink 3714 } // namespace blink
3717 3715
3718 #endif // ComputedStyle_h 3716 #endif // ComputedStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698