OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 LayoutObjectInlines_h | 5 #ifndef LayoutObjectInlines_h |
6 #define LayoutObjectInlines_h | 6 #define LayoutObjectInlines_h |
7 | 7 |
8 #include "core/dom/StyleEngine.h" | 8 #include "core/dom/StyleEngine.h" |
9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 // The following methods are inlined for performance but not put in | 13 // The following methods are inlined for performance but not put in |
14 // LayoutObject.h because that would unnecessarily tie LayoutObject.h | 14 // LayoutObject.h because that would unnecessarily tie LayoutObject.h |
15 // to StyleEngine.h for all users of LayoutObject.h that don't use | 15 // to StyleEngine.h for all users of LayoutObject.h that don't use |
16 // these methods. | 16 // these methods. |
17 | 17 |
18 inline const ComputedStyle* LayoutObject::firstLineStyle() const { | 18 inline const ComputedStyle* LayoutObject::firstLineStyle() const { |
19 return document().styleEngine().usesFirstLineRules() ? cachedFirstLineStyle() | 19 return document().styleEngine().usesFirstLineRules() ? cachedFirstLineStyle() |
20 : style(); | 20 : style(); |
21 } | 21 } |
22 | 22 |
23 inline const ComputedStyle& LayoutObject::firstLineStyleRef() const { | 23 inline const ComputedStyle& LayoutObject::firstLineStyleRef() const { |
24 const ComputedStyle* style = firstLineStyle(); | 24 const ComputedStyle* style = firstLineStyle(); |
25 ASSERT(style); | 25 DCHECK(style); |
26 return *style; | 26 return *style; |
27 } | 27 } |
28 | 28 |
29 inline const ComputedStyle* LayoutObject::style(bool firstLine) const { | 29 inline const ComputedStyle* LayoutObject::style(bool firstLine) const { |
30 return firstLine ? firstLineStyle() : style(); | 30 return firstLine ? firstLineStyle() : style(); |
31 } | 31 } |
32 | 32 |
33 inline const ComputedStyle& LayoutObject::styleRef(bool firstLine) const { | 33 inline const ComputedStyle& LayoutObject::styleRef(bool firstLine) const { |
34 const ComputedStyle* style = this->style(firstLine); | 34 const ComputedStyle* style = this->style(firstLine); |
35 ASSERT(style); | 35 DCHECK(style); |
36 return *style; | 36 return *style; |
37 } | 37 } |
38 | 38 |
39 } // namespace blink | 39 } // namespace blink |
40 | 40 |
41 #endif | 41 #endif |
OLD | NEW |