summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/layout_object_inlines.h
blob: d5cb8e32545830bc803b4bfc412d9aea9d61951f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_OBJECT_INLINES_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_OBJECT_INLINES_H_

#include "third_party/blink/renderer/core/css/style_engine.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"

namespace blink {

// The following methods are inlined for performance but not put in
// LayoutObject.h because that would unnecessarily tie LayoutObject.h
// to StyleEngine.h for all users of LayoutObject.h that don't use
// these methods.

inline const ComputedStyle* LayoutObject::FirstLineStyle() const {
  return GetDocument().GetStyleEngine().UsesFirstLineRules()
             ? CachedFirstLineStyle()
             : Style();
}

inline const ComputedStyle& LayoutObject::FirstLineStyleRef() const {
  const ComputedStyle* style = FirstLineStyle();
  DCHECK(style);
  return *style;
}

inline const ComputedStyle* LayoutObject::Style(bool first_line) const {
  return first_line ? FirstLineStyle() : Style();
}

inline const ComputedStyle& LayoutObject::StyleRef(bool first_line) const {
  const ComputedStyle* style = Style(first_line);
  DCHECK(style);
  return *style;
}

}  // namespace blink

#endif