OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/RarePaintData.h" | 5 #include "core/paint/RarePaintData.h" |
6 | 6 |
7 #include "core/paint/ObjectPaintProperties.h" | 7 #include "core/paint/ObjectPaintProperties.h" |
8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 RarePaintData::RarePaintData() {} | 12 RarePaintData::RarePaintData() {} |
13 | 13 |
14 RarePaintData::~RarePaintData() {} | 14 RarePaintData::~RarePaintData() {} |
15 | 15 |
16 void RarePaintData::SetLayer(std::unique_ptr<PaintLayer> layer) { | 16 void RarePaintData::SetLayer(std::unique_ptr<PaintLayer> layer) { |
17 layer_ = std::move(layer); | 17 layer_ = std::move(layer); |
18 }; | 18 }; |
19 | 19 |
20 ObjectPaintProperties& RarePaintData::EnsurePaintProperties() { | 20 ObjectPaintProperties& RarePaintData::EnsurePaintProperties() { |
21 if (!paint_properties_) | 21 if (!paint_properties_) |
22 paint_properties_ = ObjectPaintProperties::Create(); | 22 paint_properties_ = ObjectPaintProperties::Create(); |
23 return *paint_properties_.get(); | 23 return *paint_properties_.get(); |
24 } | 24 } |
25 | 25 |
| 26 void RarePaintData::ClearPaintProperties() { |
| 27 paint_properties_.reset(nullptr); |
| 28 } |
| 29 |
26 void RarePaintData::ClearLocalBorderBoxProperties() { | 30 void RarePaintData::ClearLocalBorderBoxProperties() { |
27 local_border_box_properties_ = nullptr; | 31 local_border_box_properties_ = nullptr; |
28 } | 32 } |
29 | 33 |
30 void RarePaintData::SetLocalBorderBoxProperties(PropertyTreeState& state) { | 34 void RarePaintData::SetLocalBorderBoxProperties(PropertyTreeState& state) { |
31 if (!local_border_box_properties_) | 35 if (!local_border_box_properties_) |
32 local_border_box_properties_ = WTF::MakeUnique<PropertyTreeState>(state); | 36 local_border_box_properties_ = WTF::MakeUnique<PropertyTreeState>(state); |
33 else | 37 else |
34 *local_border_box_properties_ = state; | 38 *local_border_box_properties_ = state; |
35 } | 39 } |
36 | 40 |
37 PropertyTreeState RarePaintData::ContentsProperties() const { | 41 PropertyTreeState RarePaintData::ContentsProperties() const { |
38 DCHECK(local_border_box_properties_); | 42 DCHECK(local_border_box_properties_); |
39 PropertyTreeState contents(*local_border_box_properties_); | 43 PropertyTreeState contents(*local_border_box_properties_); |
40 if (paint_properties_) { | 44 if (paint_properties_) { |
41 if (paint_properties_->ScrollTranslation()) | 45 if (paint_properties_->ScrollTranslation()) |
42 contents.SetTransform(paint_properties_->ScrollTranslation()); | 46 contents.SetTransform(paint_properties_->ScrollTranslation()); |
43 if (paint_properties_->OverflowClip()) | 47 if (paint_properties_->OverflowClip()) |
44 contents.SetClip(paint_properties_->OverflowClip()); | 48 contents.SetClip(paint_properties_->OverflowClip()); |
45 else if (paint_properties_->CssClip()) | 49 else if (paint_properties_->CssClip()) |
46 contents.SetClip(paint_properties_->CssClip()); | 50 contents.SetClip(paint_properties_->CssClip()); |
47 } | 51 } |
48 | 52 |
49 // TODO(chrishtr): cssClipFixedPosition needs to be handled somehow. | 53 // TODO(chrishtr): cssClipFixedPosition needs to be handled somehow. |
50 | 54 |
51 return contents; | 55 return contents; |
52 } | 56 } |
53 | 57 |
54 } // namespace blink | 58 } // namespace blink |
OLD | NEW |