From 013c14e7e083341dbf7e1b08df58049caea2b95b Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Fri, 17 Mar 2023 12:01:19 +1300 Subject: [PATCH] Revert false-fix skipping inline layout if empty, set display: inline upon inherit. --- Graphics/Layout/CSS.hs | 2 +- Graphics/Layout/Inline.hs | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/Graphics/Layout/CSS.hs b/Graphics/Layout/CSS.hs index c51e8a9..9e6414b 100644 --- a/Graphics/Layout/CSS.hs +++ b/Graphics/Layout/CSS.hs @@ -56,7 +56,7 @@ instance PropertyParser a => PropertyParser (CSSBox a) where } inherit parent = CSSBox { boxSizing = boxSizing parent, - display = Block, + display = Inline, cssBox = cssBox (temp :: CSSBox TrivialPropertyParser), font = inherit $ font parent, font' = inherit $ font' parent, diff --git a/Graphics/Layout/Inline.hs b/Graphics/Layout/Inline.hs index 949cf4b..e8770a5 100644 --- a/Graphics/Layout/Inline.hs +++ b/Graphics/Layout/Inline.hs @@ -25,19 +25,13 @@ inlineHeight font width self = hbScale' font $ height $ layoutPlain' self $ round (hbScale font * width) inlineSize :: (CastDouble x, CastDouble y) => Font' -> Paragraph -> Size x y -inlineSize _ self | Txt.all isSpace txt || Txt.null txt = Size (fromDouble 0) (fromDouble 0) - where txt = paragraph2text self inlineSize font self = Size (c font $ width r) (c font $ height r) where r = paragraphRect $ layoutPlain self inlineChildren :: [x] -> Paragraph -> [(x, Fragment)] -inlineChildren _ self | Txt.all isSpace txt || Txt.null txt = [] - where txt = paragraph2text self inlineChildren vals self = concat $ map inner $ zip vals $ spanLayouts $ layoutPlain self where inner (x, SpanLayout y) = map (x,) y layoutPlain' :: Paragraph -> Int32 -> Rect Int32 -layoutPlain' paragraph _ | Txt.all isSpace txt || Txt.null txt = Rect 0 0 0 0 - where txt = paragraph2text paragraph layoutPlain' (Paragraph a b c d) width = paragraphRect $ layoutPlain $ Paragraph a b c d { paragraphMaxWidth = width } @@ -50,5 +44,3 @@ fragmentPos :: Font' -> (Double, Double) -> Fragment -> (Double, Double) fragmentPos font (x, y) self = (x + hbScale' font (x_min r), y + hbScale' font (y_min r)) where r = fragmentRect self - -paragraph2text (Paragraph array off spans _) = Text array off $ sum $ map spanLength spans -- 2.30.2