| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2016 The Chromium Authors. All rights reserved. | 2 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #ifndef LayoutTextItem_h | 6 #ifndef LayoutTextItem_h |
| 7 #define LayoutTextItem_h | 7 #define LayoutTextItem_h |
| 8 | 8 |
| 9 #include "core/layout/LayoutText.h" | 9 #include "core/layout/LayoutText.h" |
| 10 #include "core/layout/api/LayoutItem.h" | 10 #include "core/layout/api/LayoutItem.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class ComputedStyle; | 14 class ComputedStyle; |
| 15 | 15 |
| 16 class LayoutTextItem : public LayoutItem { | 16 class LayoutTextItem : public LayoutItem { |
| 17 public: | 17 public: |
| 18 explicit LayoutTextItem(LayoutText* layoutText) : LayoutItem(layoutText) {} | 18 explicit LayoutTextItem(LayoutText* layoutText) : LayoutItem(layoutText) {} |
| 19 | 19 |
| 20 explicit LayoutTextItem(const LayoutItem& item) : LayoutItem(item) { | 20 explicit LayoutTextItem(const LayoutItem& item) : LayoutItem(item) { |
| 21 ASSERT_WITH_SECURITY_IMPLICATION(!item || item.isText()); | 21 SECURITY_DCHECK(!item || item.isText()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 explicit LayoutTextItem(std::nullptr_t) : LayoutItem(nullptr) {} | 24 explicit LayoutTextItem(std::nullptr_t) : LayoutItem(nullptr) {} |
| 25 | 25 |
| 26 LayoutTextItem() {} | 26 LayoutTextItem() {} |
| 27 | 27 |
| 28 void setStyle(PassRefPtr<ComputedStyle> style) { | 28 void setStyle(PassRefPtr<ComputedStyle> style) { |
| 29 toText()->setStyle(std::move(style)); | 29 toText()->setStyle(std::move(style)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void setText(PassRefPtr<StringImpl> text, bool force = false) { | 32 void setText(PassRefPtr<StringImpl> text, bool force = false) { |
| 33 toText()->setText(std::move(text), force); | 33 toText()->setText(std::move(text), force); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool isTextFragment() const { return toText()->isTextFragment(); } | 36 bool isTextFragment() const { return toText()->isTextFragment(); } |
| 37 | 37 |
| 38 void dirtyLineBoxes() { toText()->dirtyLineBoxes(); } | 38 void dirtyLineBoxes() { toText()->dirtyLineBoxes(); } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 LayoutText* toText() { return toLayoutText(layoutObject()); } | 41 LayoutText* toText() { return toLayoutText(layoutObject()); } |
| 42 const LayoutText* toText() const { return toLayoutText(layoutObject()); } | 42 const LayoutText* toText() const { return toLayoutText(layoutObject()); } |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 } // namespace blink | 45 } // namespace blink |
| 46 | 46 |
| 47 #endif // LayoutTextItem_h | 47 #endif // LayoutTextItem_h |
| OLD | NEW |