summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/paint/box_clipper_base.cc
blob: 5b3acb31ded7b739b1b7ecd749a20e04ef1ffcd5 (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
// Copyright 2017 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.

#include "third_party/blink/renderer/core/paint/box_clipper_base.h"

#include "third_party/blink/renderer/core/paint/object_paint_properties.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
#include "third_party/blink/renderer/platform/graphics/paint/clip_display_item.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_controller.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"

namespace blink {

DISABLE_CFI_PERF
void BoxClipperBase::InitializeScopedClipProperty(
    const FragmentData* fragment,
    const DisplayItemClient& client,
    const PaintInfo& paint_info) {
  DCHECK(RuntimeEnabledFeatures::SlimmingPaintV175Enabled());

  if (!fragment)
    return;
  const auto* properties = fragment->PaintProperties();
  if (!properties)
    return;

  const auto* clip = properties->OverflowClip()
                         ? properties->OverflowClip()
                         : properties->InnerBorderRadiusClip();
  if (!clip)
    return;

  scoped_clip_property_.emplace(paint_info.context.GetPaintController(), clip,
                                client,
                                paint_info.DisplayItemTypeForClipping());
}

}  // namespace blink