diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-08-23 20:12:41 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-08-23 20:12:41 +0000 |
commit | 0b6d7198f4fc46961c57530e654691b5a66b36f0 (patch) | |
tree | 3e2a25ec514b4d9c34ea92dd79c4eafdc6008b76 /src/select/propget.h | |
parent | da47188a8369bb79884d37f3222c8bf8fabb7ea4 (diff) | |
download | libcss-0b6d7198f4fc46961c57530e654691b5a66b36f0.tar.gz libcss-0b6d7198f4fc46961c57530e654691b5a66b36f0.tar.bz2 |
Add support for selecting page-break-{before, after, inside}
Credit: James Montgomerie
svn path=/trunk/libcss/; revision=12645
Diffstat (limited to 'src/select/propget.h')
-rw-r--r-- | src/select/propget.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/select/propget.h b/src/select/propget.h index 05bdba6..d1350ee 100644 --- a/src/select/propget.h +++ b/src/select/propget.h @@ -1744,4 +1744,67 @@ static inline uint8_t get_text_align( #undef TEXT_ALIGN_SHIFT #undef TEXT_ALIGN_INDEX +#define PAGE_BREAK_AFTER_INDEX 0 +#define PAGE_BREAK_AFTER_SHIFT 0 +#define PAGE_BREAK_AFTER_MASK 0x7 +static inline uint8_t get_page_break_after( + const css_computed_style *style) +{ + if (style->page != NULL) { + uint8_t bits = style->page->bits[PAGE_BREAK_AFTER_INDEX]; + bits &= PAGE_BREAK_AFTER_MASK; + bits >>= PAGE_BREAK_AFTER_SHIFT; + + /* 3bits: type */ + return bits; + } + + return CSS_PAGE_BREAK_AFTER_AUTO; +} +#undef PAGE_BREAK_AFTER_MASK +#undef PAGE_BREAK_AFTER_SHIFT +#undef PAGE_BREAK_AFTER_INDEX + +#define PAGE_BREAK_BEFORE_INDEX 0 +#define PAGE_BREAK_BEFORE_SHIFT 3 +#define PAGE_BREAK_BEFORE_MASK 0x38 +static inline uint8_t get_page_break_before( + const css_computed_style *style) +{ + if (style->page != NULL) { + uint8_t bits = style->page->bits[PAGE_BREAK_BEFORE_INDEX]; + bits &= PAGE_BREAK_BEFORE_MASK; + bits >>= PAGE_BREAK_BEFORE_SHIFT; + + /* 3bits: type */ + return bits; + } + + return CSS_PAGE_BREAK_BEFORE_AUTO; +} +#undef PAGE_BREAK_BEFORE_MASK +#undef PAGE_BREAK_BEFORE_SHIFT +#undef PAGE_BREAK_BEFORE_INDEX + +#define PAGE_BREAK_INSIDE_INDEX 0 +#define PAGE_BREAK_INSIDE_SHIFT 6 +#define PAGE_BREAK_INSIDE_MASK 0xc0 +static inline uint8_t get_page_break_inside( + const css_computed_style *style) +{ + if (style->page != NULL) { + uint8_t bits = style->page->bits[PAGE_BREAK_INSIDE_INDEX]; + bits &= PAGE_BREAK_INSIDE_MASK; + bits >>= PAGE_BREAK_INSIDE_SHIFT; + + /* 2bits: type */ + return bits; + } + + return CSS_PAGE_BREAK_INSIDE_AUTO; +} +#undef PAGE_BREAK_INSIDE_MASK +#undef PAGE_BREAK_INSIDE_SHIFT +#undef PAGE_BREAK_INSIDE_INDEX + #endif |