diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2012-04-13 11:43:13 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2012-04-13 11:43:13 +0000 |
commit | 89ef7a8acf13143ac0283aa1cfa5ea504b92324b (patch) | |
tree | 26564857b03f2c495a05073d3418af7f7a4a5d99 /src/select/propget.h | |
parent | 3f008ebef592b39c93b21dd66dfbe2fd23b6860e (diff) | |
download | libcss-89ef7a8acf13143ac0283aa1cfa5ea504b92324b.tar.gz libcss-89ef7a8acf13143ac0283aa1cfa5ea504b92324b.tar.bz2 |
Complete widows and orphans support. Thanks to James Montgomerie.
svn path=/trunk/libcss/; revision=13864
Diffstat (limited to 'src/select/propget.h')
-rw-r--r-- | src/select/propget.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/select/propget.h b/src/select/propget.h index d1350ee..41f6315 100644 --- a/src/select/propget.h +++ b/src/select/propget.h @@ -1807,4 +1807,54 @@ static inline uint8_t get_page_break_inside( #undef PAGE_BREAK_INSIDE_SHIFT #undef PAGE_BREAK_INSIDE_INDEX +#define ORPHANS_INDEX 1 +#define ORPHANS_SHIFT 0 +#define ORPHANS_MASK 0x1 +static inline uint8_t get_orphans( + const css_computed_style *style, + css_fixed *count) +{ + if (style->page != NULL) { + uint8_t bits = style->page->bits[ORPHANS_INDEX]; + bits &= ORPHANS_MASK; + bits >>= ORPHANS_SHIFT; + + *count = style->page->orphans; + + /* 1bit: type */ + return bits; + } + + *count = INTTOFIX(2); + return CSS_ORPHANS_SET; +} +#undef ORPHANS_MASK +#undef ORPHANS_SHIFT +#undef ORPHANS_INDEX + +#define WIDOWS_INDEX 1 +#define WIDOWS_SHIFT 1 +#define WIDOWS_MASK 0x2 +static inline uint8_t get_widows( + const css_computed_style *style, + css_fixed *count) +{ + if (style->page != NULL) { + uint8_t bits = style->page->bits[WIDOWS_INDEX]; + bits &= WIDOWS_MASK; + bits >>= WIDOWS_SHIFT; + + *count = style->page->orphans; + + /* 1bit: type */ + return bits; + } + + *count = INTTOFIX(2); + return CSS_WIDOWS_SET; +} +#undef WIDOWS_MASK +#undef WIDOWS_SHIFT +#undef WIDOWS_INDEX + #endif |