~alcinnz/CatTrap

013c14e7e083341dbf7e1b08df58049caea2b95b — Adrian Cochrane 1 year, 9 months ago 83daa6d
Revert false-fix skipping inline layout if empty, set display: inline upon inherit.
2 files changed, 1 insertions(+), 9 deletions(-)

M Graphics/Layout/CSS.hs
M Graphics/Layout/Inline.hs
M Graphics/Layout/CSS.hs => Graphics/Layout/CSS.hs +1 -1
@@ 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,

M Graphics/Layout/Inline.hs => Graphics/Layout/Inline.hs +0 -8
@@ 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