OLD | NEW |
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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 PassRefPtr<ComputedStyle> ComputedStyle::Clone(const ComputedStyle& other) { | 111 PassRefPtr<ComputedStyle> ComputedStyle::Clone(const ComputedStyle& other) { |
112 return AdoptRef(new ComputedStyle(other)); | 112 return AdoptRef(new ComputedStyle(other)); |
113 } | 113 } |
114 | 114 |
115 ALWAYS_INLINE ComputedStyle::ComputedStyle() | 115 ALWAYS_INLINE ComputedStyle::ComputedStyle() |
116 : ComputedStyleBase(), RefCounted<ComputedStyle>() { | 116 : ComputedStyleBase(), RefCounted<ComputedStyle>() { |
117 box_.Init(); | 117 box_.Init(); |
118 visual_.Init(); | 118 visual_.Init(); |
119 background_.Init(); | 119 background_.Init(); |
120 surround_.Init(); | |
121 rare_non_inherited_data_.Init(); | 120 rare_non_inherited_data_.Init(); |
122 rare_non_inherited_data_.Access()->deprecated_flexible_box_.Init(); | 121 rare_non_inherited_data_.Access()->deprecated_flexible_box_.Init(); |
123 rare_non_inherited_data_.Access()->flexible_box_.Init(); | 122 rare_non_inherited_data_.Access()->flexible_box_.Init(); |
124 rare_non_inherited_data_.Access()->multi_col_.Init(); | 123 rare_non_inherited_data_.Access()->multi_col_.Init(); |
125 rare_non_inherited_data_.Access()->transform_.Init(); | 124 rare_non_inherited_data_.Access()->transform_.Init(); |
126 rare_non_inherited_data_.Access()->will_change_.Init(); | 125 rare_non_inherited_data_.Access()->will_change_.Init(); |
127 rare_non_inherited_data_.Access()->filter_.Init(); | 126 rare_non_inherited_data_.Access()->filter_.Init(); |
128 rare_non_inherited_data_.Access()->backdrop_filter_.Init(); | 127 rare_non_inherited_data_.Access()->backdrop_filter_.Init(); |
129 rare_non_inherited_data_.Access()->grid_.Init(); | 128 rare_non_inherited_data_.Access()->grid_.Init(); |
130 rare_non_inherited_data_.Access()->grid_item_.Init(); | 129 rare_non_inherited_data_.Access()->grid_item_.Init(); |
131 rare_non_inherited_data_.Access()->scroll_snap_.Init(); | 130 rare_non_inherited_data_.Access()->scroll_snap_.Init(); |
132 rare_inherited_data_.Init(); | 131 rare_inherited_data_.Init(); |
133 style_inherited_data_.Init(); | 132 style_inherited_data_.Init(); |
134 svg_style_.Init(); | 133 svg_style_.Init(); |
135 } | 134 } |
136 | 135 |
137 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) | 136 ALWAYS_INLINE ComputedStyle::ComputedStyle(const ComputedStyle& o) |
138 : ComputedStyleBase(o), | 137 : ComputedStyleBase(o), |
139 RefCounted<ComputedStyle>(), | 138 RefCounted<ComputedStyle>(), |
140 box_(o.box_), | 139 box_(o.box_), |
141 visual_(o.visual_), | 140 visual_(o.visual_), |
142 background_(o.background_), | 141 background_(o.background_), |
143 surround_(o.surround_), | |
144 rare_non_inherited_data_(o.rare_non_inherited_data_), | 142 rare_non_inherited_data_(o.rare_non_inherited_data_), |
145 rare_inherited_data_(o.rare_inherited_data_), | 143 rare_inherited_data_(o.rare_inherited_data_), |
146 style_inherited_data_(o.style_inherited_data_), | 144 style_inherited_data_(o.style_inherited_data_), |
147 svg_style_(o.svg_style_) {} | 145 svg_style_(o.svg_style_) {} |
148 | 146 |
149 static StyleRecalcChange DiffPseudoStyles(const ComputedStyle& old_style, | 147 static StyleRecalcChange DiffPseudoStyles(const ComputedStyle& old_style, |
150 const ComputedStyle& new_style) { | 148 const ComputedStyle& new_style) { |
151 // If the pseudoStyles have changed, ensure layoutObject triggers setStyle. | 149 // If the pseudoStyles have changed, ensure layoutObject triggers setStyle. |
152 if (!old_style.HasAnyPublicPseudoStyles() && | 150 if (!old_style.HasAnyPublicPseudoStyles() && |
153 !new_style.HasAnyPublicPseudoStyles()) | 151 !new_style.HasAnyPublicPseudoStyles()) |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 style_inherited_data_ = inherit_parent.style_inherited_data_; | 327 style_inherited_data_ = inherit_parent.style_inherited_data_; |
330 if (svg_style_ != inherit_parent.svg_style_) | 328 if (svg_style_ != inherit_parent.svg_style_) |
331 svg_style_.Access()->InheritFrom(inherit_parent.svg_style_.Get()); | 329 svg_style_.Access()->InheritFrom(inherit_parent.svg_style_.Get()); |
332 } | 330 } |
333 | 331 |
334 void ComputedStyle::CopyNonInheritedFromCached(const ComputedStyle& other) { | 332 void ComputedStyle::CopyNonInheritedFromCached(const ComputedStyle& other) { |
335 ComputedStyleBase::CopyNonInheritedFromCached(other); | 333 ComputedStyleBase::CopyNonInheritedFromCached(other); |
336 box_ = other.box_; | 334 box_ = other.box_; |
337 visual_ = other.visual_; | 335 visual_ = other.visual_; |
338 background_ = other.background_; | 336 background_ = other.background_; |
339 surround_ = other.surround_; | |
340 rare_non_inherited_data_ = other.rare_non_inherited_data_; | 337 rare_non_inherited_data_ = other.rare_non_inherited_data_; |
341 | 338 |
342 // The flags are copied one-by-one because they contain | 339 // The flags are copied one-by-one because they contain |
343 // bunch of stuff other than real style data. | 340 // bunch of stuff other than real style data. |
344 // See comments for each skipped flag below. | 341 // See comments for each skipped flag below. |
345 | 342 |
346 // These are not generated in ComputedStyleBase | 343 // These are not generated in ComputedStyleBase |
347 SetOriginalDisplay(other.OriginalDisplay()); | 344 SetOriginalDisplay(other.OriginalDisplay()); |
348 SetVerticalAlign(other.VerticalAlign()); | 345 SetVerticalAlign(other.VerticalAlign()); |
349 SetHasViewportUnits(other.HasViewportUnits()); | 346 SetHasViewportUnits(other.HasViewportUnits()); |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 474 |
478 bool ComputedStyle::NonInheritedEqual(const ComputedStyle& other) const { | 475 bool ComputedStyle::NonInheritedEqual(const ComputedStyle& other) const { |
479 // compare everything except the pseudoStyle pointer | 476 // compare everything except the pseudoStyle pointer |
480 return ComputedStyleBase::NonInheritedEqual(other) && | 477 return ComputedStyleBase::NonInheritedEqual(other) && |
481 OriginalDisplay() == | 478 OriginalDisplay() == |
482 other.OriginalDisplay() && // Not generated in ComputedStyleBase | 479 other.OriginalDisplay() && // Not generated in ComputedStyleBase |
483 VerticalAlign() == | 480 VerticalAlign() == |
484 other.VerticalAlign() && // Not generated in ComputedStyleBase | 481 other.VerticalAlign() && // Not generated in ComputedStyleBase |
485 box_ == other.box_ && | 482 box_ == other.box_ && |
486 visual_ == other.visual_ && background_ == other.background_ && | 483 visual_ == other.visual_ && background_ == other.background_ && |
487 surround_ == other.surround_ && | |
488 rare_non_inherited_data_ == other.rare_non_inherited_data_ && | 484 rare_non_inherited_data_ == other.rare_non_inherited_data_ && |
489 svg_style_->NonInheritedEqual(*other.svg_style_); | 485 svg_style_->NonInheritedEqual(*other.svg_style_); |
490 } | 486 } |
491 | 487 |
492 bool ComputedStyle::InheritedDataShared(const ComputedStyle& other) const { | 488 bool ComputedStyle::InheritedDataShared(const ComputedStyle& other) const { |
493 // This is a fast check that only looks if the data structures are shared. | 489 // This is a fast check that only looks if the data structures are shared. |
494 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? | 490 // TODO(sashab): Should ComputedStyleBase have an inheritedDataShared method? |
495 return ComputedStyleBase::InheritedEqual(other) && | 491 return ComputedStyleBase::InheritedEqual(other) && |
496 style_inherited_data_.Get() == other.style_inherited_data_.Get() && | 492 style_inherited_data_.Get() == other.style_inherited_data_.Get() && |
497 svg_style_.Get() == other.svg_style_.Get() && | 493 svg_style_.Get() == other.svg_style_.Get() && |
(...skipping 2005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2503 if (value < 0) | 2499 if (value < 0) |
2504 fvalue -= 0.5f; | 2500 fvalue -= 0.5f; |
2505 else | 2501 else |
2506 fvalue += 0.5f; | 2502 fvalue += 0.5f; |
2507 } | 2503 } |
2508 | 2504 |
2509 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); | 2505 return RoundForImpreciseConversion<int>(fvalue / zoom_factor); |
2510 } | 2506 } |
2511 | 2507 |
2512 } // namespace blink | 2508 } // namespace blink |
OLD | NEW |