chromium/third_party/blink/renderer/core/layout/ink_overflow.h

// Copyright 2019 The Chromium Authors
// 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_INK_OVERFLOW_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INK_OVERFLOW_H_

#include <optional>

#include "base/check_op.h"
#include "base/dcheck_is_on.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/inline/text_offset_range.h"

namespace blink {

class AffineTransform;
class AppliedTextDecoration;
class ComputedStyle;
class Font;
class FragmentItem;
class InlineCursor;
class InlinePaintContext;
class ShadowList;
class Text;
struct LogicalRect;
struct TextFragmentPaintInfo;

// Represents an ink-overflow rectangle. Used for:
// - Objects without children, such as text runs.
// - Objects that has only self or contents ink-overflow.
struct SingleInkOverflow {};

// Represents two ink-overflow rectangles, to keep self and contents ink
// overflow separately. Used for objects with children, such as boxes.
struct ContainerInkOverflow : SingleInkOverflow {};

// Represents multiple types of ink overflow in a size of a pointer.
//
// When no overflow, or when overflow is small, this class does not allocate
// memory.
//
// In order to keep the instance small, callers must keep |Type| separately.
// |Set*| functions return |Type|, which callers must keep and pass to following
// function calls. Functions have DCHECKs to ensure callers pass the correct
// |Type|.
class CORE_EXPORT InkOverflow {};

#if DCHECK_IS_ON()
inline void InkOverflow::CheckType(Type type) const {}
inline InkOverflow::Type InkOverflow::SetType(Type type) {}
#else
inline void InkOverflow::CheckType(Type type) const {}
inline InkOverflow::Type InkOverflow::SetType(Type type) {
  return type;
}
#endif

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_INK_OVERFLOW_H_