From 2fe0db0f29a37143ccd694ce1aa8912b26f18408 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sat, 3 Jun 2023 13:03:08 +1200 Subject: [PATCH] Handle property on containing blocks. --- Graphics/Layout/CSS.hs | 9 +++++++-- Graphics/Layout/Inline/CSS.hs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Graphics/Layout/CSS.hs b/Graphics/Layout/CSS.hs index b7fcd3b..357b954 100644 --- a/Graphics/Layout/CSS.hs +++ b/Graphics/Layout/CSS.hs @@ -89,8 +89,13 @@ finalizeChilds root parent style' childs@(child:childs') }:blocks)) -> let (inlines', blocks') = spanInlines tail in (inlines ++ inlines', blocks' ++ blocks) ret -> ret - flattenTree0 childs = RootBox $ Box (map (flattenTree parent) $ - enumerate childs) $ flip applyFontInline parent $ txtOpts style' + flattenTree0 childs + | iStyle@(CSSInline _ _ bidi) <- inlineStyles style', + bidi `elem` [BdOverride, BdIsolateOverride] = RootBox $ Box + (applyBidi iStyle $ map (flattenTree parent) $ enumerate childs) + $ flip applyFontInline parent $ txtOpts style' + | otherwise = RootBox $ Box (map (flattenTree parent) $ enumerate childs) + $ flip applyFontInline parent $ txtOpts style' flattenTree p (i, StyleTree { children = child@(_:_), style = self }) = buildInline f i self $ map (flattenTree f) $ enumerate child where f = pattern2font (font self) (font' self) p root diff --git a/Graphics/Layout/Inline/CSS.hs b/Graphics/Layout/Inline/CSS.hs index 7d3bdc9..56a5dc6 100644 --- a/Graphics/Layout/Inline/CSS.hs +++ b/Graphics/Layout/Inline/CSS.hs @@ -1,7 +1,7 @@ {-# LANGUAGE OverloadedStrings, ViewPatterns #-} -- | Infrastructure for parsing & desugaring text related CSS properties. module Graphics.Layout.Inline.CSS( - CSSInline(..), Default(..), applyFontInline, applyBidi) where + CSSInline(..), Default(..), UnicodeBidi(..), applyFontInline, applyBidi) where import Data.CSS.Syntax.Tokens (Token(..)) import Stylist (PropertyParser(..)) -- 2.30.2