summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 20:05:04 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 20:05:04 +0000
commit5429e0ccc289a4538f81fcde0495d27f0cb7a758 (patch)
tree1ec98a93dfdf2986011aa012e7980fb48304d378 /src
parentca3293e0332bbd9fe63d6cd6bc215f048132bd08 (diff)
downloadlibcss-5429e0ccc289a4538f81fcde0495d27f0cb7a758.tar.gz
libcss-5429e0ccc289a4538f81fcde0495d27f0cb7a758.tar.bz2
Fix clip: rect() with auto sides
svn path=/trunk/libcss/; revision=6514
Diffstat (limited to 'src')
-rw-r--r--src/select/properties.c11
-rw-r--r--src/select/propset.h13
2 files changed, 17 insertions, 7 deletions
diff --git a/src/select/properties.c b/src/select/properties.c
index ea81120..d084bc5 100644
--- a/src/select/properties.c
+++ b/src/select/properties.c
@@ -540,13 +540,14 @@ static css_error cascade_clip(uint32_t opv, css_style *style,
{
uint16_t value = CSS_CLIP_INHERIT;
css_computed_clip_rect rect = { 0, 0, 0, 0,
- CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX };
+ CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
+ false, false, false, false };
if (isInherit(opv) == false) {
switch (getValue(opv) & CLIP_SHAPE_MASK) {
case CLIP_SHAPE_RECT:
- /** \todo clip rect can't store auto values */
if (getValue(opv) & CLIP_RECT_TOP_AUTO) {
+ rect.top_auto = true;
} else {
rect.top = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(css_fixed));
@@ -554,6 +555,7 @@ static css_error cascade_clip(uint32_t opv, css_style *style,
advance_bytecode(style, sizeof(uint32_t));
}
if (getValue(opv) & CLIP_RECT_RIGHT_AUTO) {
+ rect.right_auto = true;
} else {
rect.right = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(css_fixed));
@@ -561,6 +563,7 @@ static css_error cascade_clip(uint32_t opv, css_style *style,
advance_bytecode(style, sizeof(uint32_t));
}
if (getValue(opv) & CLIP_RECT_BOTTOM_AUTO) {
+ rect.bottom_auto = true;
} else {
rect.bottom = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(css_fixed));
@@ -568,6 +571,7 @@ static css_error cascade_clip(uint32_t opv, css_style *style,
advance_bytecode(style, sizeof(uint32_t));
}
if (getValue(opv) & CLIP_RECT_LEFT_AUTO) {
+ rect.left_auto = true;
} else {
rect.left = *((css_fixed *) style->bytecode);
advance_bytecode(style, sizeof(css_fixed));
@@ -591,7 +595,8 @@ static css_error cascade_clip(uint32_t opv, css_style *style,
static css_error initial_clip(css_computed_style *style)
{
css_computed_clip_rect rect = { 0, 0, 0, 0,
- CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX };
+ CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX,
+ false, false, false, false };
return set_clip(style, CSS_CLIP_AUTO, &rect);
}
diff --git a/src/select/propset.h b/src/select/propset.h
index bdc85bb..661913b 100644
--- a/src/select/propset.h
+++ b/src/select/propset.h
@@ -265,8 +265,8 @@ static inline css_error set_quotes(
#undef QUOTES_INDEX
#define CLIP_INDEX 7
-#define CLIP_SHIFT 6
-#define CLIP_MASK 0xc0
+#define CLIP_SHIFT 2
+#define CLIP_MASK 0xfc
#define CLIP_INDEX1 5
#define CLIP_SHIFT1 0
#define CLIP_MASK1 0xff
@@ -283,11 +283,16 @@ static inline css_error set_clip(
bits = &style->uncommon->bits[CLIP_INDEX];
- /* 2bits: type */
- *bits = (*bits & ~CLIP_MASK) |
+ /* 6bits: trblyy : top | right | bottom | left | type */
+ *bits = (*bits & ~CLIP_MASK) |
((type & 0x3) << CLIP_SHIFT);
if (type == CSS_CLIP_RECT) {
+ *bits |= (rect->top_auto ? 0x20 : 0) |
+ (rect->right_auto ? 0x10 : 0) |
+ (rect->bottom_auto ? 0x8 : 0) |
+ (rect->left_auto ? 0x4 : 0);
+
bits = &style->uncommon->bits[CLIP_INDEX1];
/* 8bits: ttttrrrr : top | right */