| 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 LayoutTextFragmentItem_h | 5 #ifndef LayoutTextFragmentItem_h |
| 6 #define LayoutTextFragmentItem_h | 6 #define LayoutTextFragmentItem_h |
| 7 | 7 |
| 8 #include "core/layout/LayoutTextFragment.h" | 8 #include "core/layout/LayoutTextFragment.h" |
| 9 #include "core/layout/api/LayoutTextItem.h" | 9 #include "core/layout/api/LayoutTextItem.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class FirstLetterPseudoElement; | 13 class FirstLetterPseudoElement; |
| 14 | 14 |
| 15 class LayoutTextFragmentItem : public LayoutTextItem { | 15 class LayoutTextFragmentItem : public LayoutTextItem { |
| 16 public: | 16 public: |
| 17 explicit LayoutTextFragmentItem(LayoutTextFragment* layoutTextFragment) | 17 explicit LayoutTextFragmentItem(LayoutTextFragment* layoutTextFragment) |
| 18 : LayoutTextItem(layoutTextFragment) {} | 18 : LayoutTextItem(layoutTextFragment) {} |
| 19 | 19 |
| 20 explicit LayoutTextFragmentItem(const LayoutTextItem& item) | 20 explicit LayoutTextFragmentItem(const LayoutTextItem& item) |
| 21 : LayoutTextItem(item) { | 21 : LayoutTextItem(item) { |
| 22 ASSERT_WITH_SECURITY_IMPLICATION(!item || item.isTextFragment()); | 22 SECURITY_DCHECK(!item || item.isTextFragment()); |
| 23 } | 23 } |
| 24 | 24 |
| 25 explicit LayoutTextFragmentItem(std::nullptr_t) : LayoutTextItem(nullptr) {} | 25 explicit LayoutTextFragmentItem(std::nullptr_t) : LayoutTextItem(nullptr) {} |
| 26 | 26 |
| 27 LayoutTextFragmentItem() {} | 27 LayoutTextFragmentItem() {} |
| 28 | 28 |
| 29 void setTextFragment(PassRefPtr<StringImpl> text, | 29 void setTextFragment(PassRefPtr<StringImpl> text, |
| 30 unsigned start, | 30 unsigned start, |
| 31 unsigned length) { | 31 unsigned length) { |
| 32 toTextFragment()->setTextFragment(std::move(text), start, length); | 32 toTextFragment()->setTextFragment(std::move(text), start, length); |
| 33 } | 33 } |
| 34 | 34 |
| 35 FirstLetterPseudoElement* firstLetterPseudoElement() const { | 35 FirstLetterPseudoElement* firstLetterPseudoElement() const { |
| 36 return toTextFragment()->firstLetterPseudoElement(); | 36 return toTextFragment()->firstLetterPseudoElement(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 LayoutTextFragment* toTextFragment() { | 40 LayoutTextFragment* toTextFragment() { |
| 41 return toLayoutTextFragment(layoutObject()); | 41 return toLayoutTextFragment(layoutObject()); |
| 42 } | 42 } |
| 43 const LayoutTextFragment* toTextFragment() const { | 43 const LayoutTextFragment* toTextFragment() const { |
| 44 return toLayoutTextFragment(layoutObject()); | 44 return toLayoutTextFragment(layoutObject()); |
| 45 } | 45 } |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 } // namespace blink | 48 } // namespace blink |
| 49 | 49 |
| 50 #endif // LayoutTextFragmentItem_h | 50 #endif // LayoutTextFragmentItem_h |
| OLD | NEW |