#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/layout/page_container_layout_algorithm.h"
#include "third_party/blink/renderer/core/css/page_margins_style.h"
#include "third_party/blink/renderer/core/css/resolver/style_resolver.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/pagination_state.h"
#include "third_party/blink/renderer/core/layout/geometry/writing_mode_converter.h"
#include "third_party/blink/renderer/core/layout/layout_block_flow.h"
#include "third_party/blink/renderer/core/layout/layout_counter.h"
#include "third_party/blink/renderer/core/layout/layout_quote.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/layout/length_utils.h"
#include "third_party/blink/renderer/core/layout/logical_fragment.h"
#include "third_party/blink/renderer/core/layout/page_border_box_layout_algorithm.h"
#include "third_party/blink/renderer/core/layout/pagination_utils.h"
#include "third_party/blink/renderer/core/style/content_data.h"
namespace blink {
namespace {
void PrepareMarginBoxSpaceBuilder(LogicalSize available_size,
ConstraintSpaceBuilder* builder) { … }
LogicalRect SnappedBorderBoxRect(const LogicalRect& rect) { … }
}
PageContainerLayoutAlgorithm::PageContainerLayoutAlgorithm(
const LayoutAlgorithmParams& params,
wtf_size_t page_index,
wtf_size_t total_page_count,
const AtomicString& page_name,
const BlockNode& content_node,
const PageAreaLayoutParams& page_area_params,
bool ignore_author_page_style,
const PhysicalBoxFragment* existing_page_container)
: … { … }
const LayoutResult* PageContainerLayoutAlgorithm::Layout() { … }
void PageContainerLayoutAlgorithm::LayoutPageBorderBox(
LogicalSize containing_block_size,
LogicalOffset target_offset) { … }
void PageContainerLayoutAlgorithm::LayoutAllMarginBoxes(
const BoxStrut& logical_margins) { … }
void PageContainerLayoutAlgorithm::LayoutCornerMarginNode(
const ComputedStyle* corner_style,
const PhysicalRect& rect,
EdgeAdjacency edge_adjacency) { … }
void PageContainerLayoutAlgorithm::LayoutEdgeMarginNodes(
const ComputedStyle* start_box_style,
const ComputedStyle* center_box_style,
const ComputedStyle* end_box_style,
const PhysicalRect& edge_rect,
EdgeAdjacency edge_adjacency) { … }
BlockNode PageContainerLayoutAlgorithm::CreateBlockNodeIfNeeded(
const ComputedStyle* page_margin_style) { … }
PageContainerLayoutAlgorithm::PreferredSizeInfo
PageContainerLayoutAlgorithm::EdgeMarginNodePreferredSize(
const BlockNode& child,
LogicalSize containing_block_size,
ProgressionDirection dir) const { … }
void PageContainerLayoutAlgorithm::CalculateEdgeMarginBoxSizes(
PhysicalSize available_physical_size,
const BlockNode nodes[3],
ProgressionDirection dir,
LayoutUnit final_main_axis_sizes[3]) const { … }
void PageContainerLayoutAlgorithm::ResolveTwoEdgeMarginBoxLengths(
const PreferredSizeInfo preferred_main_axis_sizes[3],
LayoutUnit available_main_axis_size,
LayoutUnit* first_main_axis_size,
LayoutUnit* second_main_axis_size) { … }
void PageContainerLayoutAlgorithm::LayoutEdgeMarginNode(
const BlockNode& child,
const PhysicalRect& edge_rect,
LayoutUnit main_axis_size,
EdgeMarginType edge_margin_type,
EdgeAdjacency edge_adjacency,
ProgressionDirection dir) { … }
PhysicalBoxStrut PageContainerLayoutAlgorithm::ResolveMargins(
const ConstraintSpace& child_space,
const ComputedStyle& child_style,
PhysicalSize child_size,
PhysicalSize available_size,
EdgeAdjacency edge_adjacency) const { … }
}