Skip to content

Conversation

@sleepy-monax
Copy link
Member

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the pagination system in the Vaev driver. The main changes involve consolidating pagination logic into a new PaginationContext class and renaming identifiers for better clarity regarding page indexing.

  • Renamed pageNumber to pageIndex throughout the codebase to reflect 0-based indexing
  • Changed Font::Database from a reference to a value member in Computer to support move semantics
  • Introduced PaginationContext class to encapsulate all pagination-related state and operations
  • Renamed RunningPositionMap to Runnings for consistency

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/vaev-engine/style/computer.cpp Changed fontBook to _database (value instead of reference) and updated all references
src/vaev-engine/layout/positioned.cpp Updated to use pageIndex instead of pageNumber
src/vaev-engine/layout/inline.cpp Updated to use pageIndex instead of pageNumber
src/vaev-engine/layout/flex.cpp Updated to use pageIndex instead of pageNumber
src/vaev-engine/layout/builder/mod.cpp Changed parameter type from RunningPositionMap to Runnings
src/vaev-engine/layout/block.cpp Updated to use pageIndex instead of pageNumber
src/vaev-engine/layout/base/running-position.cpp Renamed struct to Runnings, removed page increment logic, added documentation
src/vaev-engine/layout/base/input.cpp Updated field names: pageNumberpageIndex, RunningPositionMapRunnings
src/vaev-engine/layout/base/breaks.cpp Added static constants for document boundaries, changed MutCursor to Cursor for breakpoint traversal
src/vaev-engine/driver/render.cpp Updated to use move semantics for Font::Database
src/vaev-engine/driver/print.cpp Complete refactor with new PaginationContext class and Page struct
src/vaev-engine/dom/window.cpp Updated to use PaginationContext for printing and changed print method to non-const


// FIXME: use attrs from style::FontFace
if (fontBook.load(resolvedUrl.unwrap()))
if (_database.load(resolvedUrl.unwrap()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk about "database" it's not clear that we're talking about fonts

.containingBlock = {inlineSize, input.knownSize.y.unwrapOr(0_au)},
.runningPosition = input.runningPosition,
.pageNumber = input.pageNumber,
.pageIndex = input.pageIndex,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why pageIndex ?

}
};

Breakpoint const Breakpoint::START_OF_DOCUMENT = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YES ! THANK GOD

.name = ""s,
.number = pageNumber++,
.blank = false,
export struct PaginationContext {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not, a bit java core but make sense

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well you are the one who named it like this ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was talkin about the whole Object/it's architecture 😄

Print::Settings _settings;
Style::Computer _computer;
Style::SpecifiedValues _style;
Layout::Runnings _runnings = {};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a comment saying that we're talking about running pos, they're a shady corner of the specs so we cant be sure the one reading the code knows about it (or keep the old name)

page.breakpoint = std::move(breakpoint);
_pages.pushBack(page);
if (done)
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great

Copy link
Member

@Louciole Louciole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the structure is clearer, really OO but eager to see the final version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants