mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Implement text-align
(except justify
)
This commit is contained in:
parent
6d91d77fba
commit
9f4b1a0f14
5 changed files with 84 additions and 13 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::geom::flow_relative::{Rect, Sides};
|
||||
use crate::geom::flow_relative::{Rect, Sides, Vec2};
|
||||
use gfx::text::glyph::GlyphStore;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use std::sync::Arc;
|
||||
|
@ -68,6 +68,17 @@ pub(crate) struct ImageFragment {
|
|||
pub image_key: ImageKey,
|
||||
}
|
||||
|
||||
impl Fragment {
|
||||
pub fn position_mut(&mut self) -> &mut Vec2<Length> {
|
||||
match self {
|
||||
Fragment::Box(f) => &mut f.content_rect.start_corner,
|
||||
Fragment::Anonymous(f) => &mut f.rect.start_corner,
|
||||
Fragment::Text(f) => &mut f.rect.start_corner,
|
||||
Fragment::Image(f) => &mut f.rect.start_corner,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AnonymousFragment {
|
||||
pub fn no_op(mode: WritingMode) -> Self {
|
||||
Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue