mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
LibWeb+Browser+WebContent: Convert BoxModelMetrics to new pixel units
This commit is contained in:
parent
5d8e3f5122
commit
02cd853eee
4 changed files with 23 additions and 22 deletions
|
@ -7,14 +7,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
||||
namespace Web::Layout {
|
||||
|
||||
struct PixelBox {
|
||||
float top { 0 };
|
||||
float right { 0 };
|
||||
float bottom { 0 };
|
||||
float left { 0 };
|
||||
CSSPixels top { 0 };
|
||||
CSSPixels right { 0 };
|
||||
CSSPixels bottom { 0 };
|
||||
CSSPixels left { 0 };
|
||||
};
|
||||
|
||||
struct BoxModelMetrics {
|
||||
|
|
|
@ -44,13 +44,13 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
|||
CSSPixelRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() };
|
||||
|
||||
if (is_first_fragment) {
|
||||
float extra_start_width = box_model().padding.left;
|
||||
auto extra_start_width = box_model().padding.left;
|
||||
absolute_fragment_rect.translate_by(-extra_start_width, 0);
|
||||
absolute_fragment_rect.set_width(absolute_fragment_rect.width() + extra_start_width);
|
||||
}
|
||||
|
||||
if (is_last_fragment) {
|
||||
float extra_end_width = box_model().padding.right;
|
||||
auto extra_end_width = box_model().padding.right;
|
||||
absolute_fragment_rect.set_width(absolute_fragment_rect.width() + extra_end_width);
|
||||
}
|
||||
|
||||
|
@ -95,13 +95,13 @@ void InlinePaintable::paint(PaintContext& context, Painting::PaintPhase phase) c
|
|||
CSSPixelRect absolute_fragment_rect { containing_block_position_in_absolute_coordinates.translated(fragment.offset()), fragment.size() };
|
||||
|
||||
if (is_first_fragment) {
|
||||
float extra_start_width = box_model().padding.left;
|
||||
auto extra_start_width = box_model().padding.left;
|
||||
absolute_fragment_rect.translate_by(-extra_start_width, 0);
|
||||
absolute_fragment_rect.set_width(absolute_fragment_rect.width() + extra_start_width);
|
||||
}
|
||||
|
||||
if (is_last_fragment) {
|
||||
float extra_end_width = box_model().padding.right;
|
||||
auto extra_end_width = box_model().padding.right;
|
||||
absolute_fragment_rect.set_width(absolute_fragment_rect.width() + extra_end_width);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue