| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef LayoutImageItem_h | 5 #ifndef LayoutImageItem_h |
| 6 #define LayoutImageItem_h | 6 #define LayoutImageItem_h |
| 7 | 7 |
| 8 #include "core/layout/LayoutImage.h" | 8 #include "core/layout/LayoutImage.h" |
| 9 #include "core/layout/api/LayoutBoxItem.h" | 9 #include "core/layout/api/LayoutBoxItem.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class LayoutImageItem : public LayoutBoxItem { | 13 class LayoutImageItem : public LayoutBoxItem { |
| 14 public: | 14 public: |
| 15 explicit LayoutImageItem(LayoutImage* layoutImage) | 15 explicit LayoutImageItem(LayoutImage* layoutImage) |
| 16 : LayoutBoxItem(layoutImage) {} | 16 : LayoutBoxItem(layoutImage) {} |
| 17 | 17 |
| 18 explicit LayoutImageItem(const LayoutItem& item) : LayoutBoxItem(item) { | 18 explicit LayoutImageItem(const LayoutItem& item) : LayoutBoxItem(item) { |
| 19 ASSERT_WITH_SECURITY_IMPLICATION(!item || item.isImage()); | 19 SECURITY_DCHECK(!item || item.isImage()); |
| 20 } | 20 } |
| 21 | 21 |
| 22 explicit LayoutImageItem(std::nullptr_t) : LayoutBoxItem(nullptr) {} | 22 explicit LayoutImageItem(std::nullptr_t) : LayoutBoxItem(nullptr) {} |
| 23 | 23 |
| 24 LayoutImageItem() {} | 24 LayoutImageItem() {} |
| 25 | 25 |
| 26 void setImageDevicePixelRatio(float factor) { | 26 void setImageDevicePixelRatio(float factor) { |
| 27 toImage()->setImageDevicePixelRatio(factor); | 27 toImage()->setImageDevicePixelRatio(factor); |
| 28 } | 28 } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 LayoutImage* toImage() { return toLayoutImage(layoutObject()); } | 31 LayoutImage* toImage() { return toLayoutImage(layoutObject()); } |
| 32 | 32 |
| 33 const LayoutImage* toImage() const { return toLayoutImage(layoutObject()); } | 33 const LayoutImage* toImage() const { return toLayoutImage(layoutObject()); } |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 } // namespace blink | 36 } // namespace blink |
| 37 | 37 |
| 38 #endif // LayoutImageItem_h | 38 #endif // LayoutImageItem_h |
| OLD | NEW |