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

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

Issue 2912043002: Remove PassRefPtr in ComputedStyle. (Closed)
Patch Set: Created 3 years, 6 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // failed to produce the optimal packed size. To fix, update the algorithm to 85 // failed to produce the optimal packed size. To fix, update the algorithm to
86 // ensure that the buckets are placed so that each takes up at most 1 word. 86 // ensure that the buckets are placed so that each takes up at most 1 word.
87 ASSERT_SIZE(ComputedStyleBase<ComputedStyle>, SameSizeAsComputedStyleBase); 87 ASSERT_SIZE(ComputedStyleBase<ComputedStyle>, SameSizeAsComputedStyleBase);
88 88
89 // If this assert fails, it means that size of ComputedStyle has changed. Please 89 // If this assert fails, it means that size of ComputedStyle has changed. Please
90 // check that you really *do* what to increase the size of ComputedStyle, then 90 // check that you really *do* what to increase the size of ComputedStyle, then
91 // update the SameSizeAsComputedStyle struct to match the updated storage of 91 // update the SameSizeAsComputedStyle struct to match the updated storage of
92 // ComputedStyle. 92 // ComputedStyle.
93 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle); 93 ASSERT_SIZE(ComputedStyle, SameSizeAsComputedStyle);
94 94
95 PassRefPtr<ComputedStyle> ComputedStyle::Create() { 95 RefPtr<ComputedStyle> ComputedStyle::Create() {
96 return AdoptRef(new ComputedStyle(InitialStyle())); 96 return AdoptRef(new ComputedStyle(InitialStyle()));
97 } 97 }
98 98
99 PassRefPtr<ComputedStyle> ComputedStyle::CreateInitialStyle() { 99 RefPtr<ComputedStyle> ComputedStyle::CreateInitialStyle() {
100 return AdoptRef(new ComputedStyle()); 100 return AdoptRef(new ComputedStyle());
101 } 101 }
102 102
103 ComputedStyle& ComputedStyle::MutableInitialStyle() { 103 ComputedStyle& ComputedStyle::MutableInitialStyle() {
104 LEAK_SANITIZER_DISABLED_SCOPE; 104 LEAK_SANITIZER_DISABLED_SCOPE;
105 DEFINE_STATIC_REF(ComputedStyle, initial_style, 105 DEFINE_STATIC_REF(ComputedStyle, initial_style,
106 (ComputedStyle::CreateInitialStyle())); 106 (ComputedStyle::CreateInitialStyle()));
107 return *initial_style; 107 return *initial_style;
108 } 108 }
109 109
110 void ComputedStyle::InvalidateInitialStyle() { 110 void ComputedStyle::InvalidateInitialStyle() {
111 MutableInitialStyle().SetTapHighlightColor(InitialTapHighlightColor()); 111 MutableInitialStyle().SetTapHighlightColor(InitialTapHighlightColor());
112 } 112 }
113 113
114 PassRefPtr<ComputedStyle> ComputedStyle::CreateAnonymousStyleWithDisplay( 114 RefPtr<ComputedStyle> ComputedStyle::CreateAnonymousStyleWithDisplay(
115 const ComputedStyle& parent_style, 115 const ComputedStyle& parent_style,
116 EDisplay display) { 116 EDisplay display) {
117 RefPtr<ComputedStyle> new_style = ComputedStyle::Create(); 117 RefPtr<ComputedStyle> new_style = ComputedStyle::Create();
118 new_style->InheritFrom(parent_style); 118 new_style->InheritFrom(parent_style);
119 new_style->SetUnicodeBidi(parent_style.GetUnicodeBidi()); 119 new_style->SetUnicodeBidi(parent_style.GetUnicodeBidi());
120 new_style->SetDisplay(display); 120 new_style->SetDisplay(display);
121 return new_style; 121 return new_style;
122 } 122 }
123 123
124 PassRefPtr<ComputedStyle> ComputedStyle::Clone(const ComputedStyle& other) { 124 RefPtr<ComputedStyle> ComputedStyle::Clone(const ComputedStyle& other) {
125 return AdoptRef(new ComputedStyle(other)); 125 return AdoptRef(new ComputedStyle(other));
126 } 126 }
127 127
128 ALWAYS_INLINE ComputedStyle::ComputedStyle() 128 ALWAYS_INLINE ComputedStyle::ComputedStyle()
129 : ComputedStyleBase(), RefCounted<ComputedStyle>() { 129 : ComputedStyleBase(), RefCounted<ComputedStyle>() {
130 rare_non_inherited_data_.Init(); 130 rare_non_inherited_data_.Init();
131 rare_non_inherited_data_.Access()->deprecated_flexible_box_.Init(); 131 rare_non_inherited_data_.Access()->deprecated_flexible_box_.Init();
132 rare_non_inherited_data_.Access()->flexible_box_.Init(); 132 rare_non_inherited_data_.Access()->flexible_box_.Init();
133 rare_non_inherited_data_.Access()->multi_col_.Init(); 133 rare_non_inherited_data_.Access()->multi_col_.Init();
134 rare_non_inherited_data_.Access()->transform_.Init(); 134 rare_non_inherited_data_.Access()->transform_.Init();
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 if (value < 0) 2348 if (value < 0)
2349 fvalue -= 0.5f; 2349 fvalue -= 0.5f;
2350 else 2350 else
2351 fvalue += 0.5f; 2351 fvalue += 0.5f;
2352 } 2352 }
2353 2353
2354 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); 2354 return RoundForImpreciseConversion<int>(fvalue / zoom_factor);
2355 } 2355 }
2356 2356
2357 } // namespace blink 2357 } // 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