mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-24 21:16:50 +03:00
[project @ 2003-10-10 18:13:36 by jmb]
CSS visibility support (not collapse) svn path=/import/netsurf/; revision=361
This commit is contained in:
parent
33efbb2806
commit
0e5d05b125
@ -47,6 +47,7 @@ const struct css_style css_base_style = {
|
||||
{ CSS_HEIGHT_AUTO, { 1, CSS_UNIT_EM } },
|
||||
{ CSS_LINE_HEIGHT_ABSOLUTE, { 1.3 } },
|
||||
CSS_TEXT_ALIGN_LEFT,
|
||||
CSS_VISIBILITY_VISIBLE,
|
||||
{ CSS_WIDTH_AUTO, { { 1, CSS_UNIT_EM } } },
|
||||
CSS_WHITE_SPACE_NORMAL
|
||||
};
|
||||
@ -63,6 +64,7 @@ const struct css_style css_empty_style = {
|
||||
{ CSS_HEIGHT_INHERIT, { 1, CSS_UNIT_EM } },
|
||||
{ CSS_LINE_HEIGHT_INHERIT, { 1.3 } },
|
||||
CSS_TEXT_ALIGN_INHERIT,
|
||||
CSS_VISIBILITY_INHERIT,
|
||||
{ CSS_WIDTH_INHERIT, { { 1, CSS_UNIT_EM } } },
|
||||
CSS_WHITE_SPACE_INHERIT
|
||||
};
|
||||
@ -79,6 +81,7 @@ const struct css_style css_blank_style = {
|
||||
{ CSS_HEIGHT_AUTO, { 1, CSS_UNIT_EM } },
|
||||
{ CSS_LINE_HEIGHT_INHERIT, { 1.3 } },
|
||||
CSS_TEXT_ALIGN_INHERIT,
|
||||
CSS_VISIBILITY_INHERIT,
|
||||
{ CSS_WIDTH_AUTO, { { 1, CSS_UNIT_EM } } },
|
||||
CSS_WHITE_SPACE_INHERIT
|
||||
};
|
||||
@ -613,6 +616,7 @@ void css_dump_style(const struct css_style * const style)
|
||||
}
|
||||
fprintf(stderr, "; ");
|
||||
fprintf(stderr, "text-align: %s; ", css_text_align_name[style->text_align]);
|
||||
fprintf(stderr, "visibility: %s", css_visibility_name[style->visibility]);
|
||||
fprintf(stderr, "width: ");
|
||||
switch (style->width.width) {
|
||||
case CSS_WIDTH_AUTO: fprintf(stderr, "auto"); break;
|
||||
@ -685,6 +689,8 @@ void css_cascade(struct css_style * const style, const struct css_style * const
|
||||
style->line_height = apply->line_height;
|
||||
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
|
||||
style->text_align = apply->text_align;
|
||||
if (apply->visibility != CSS_VISIBILITY_INHERIT)
|
||||
style->visibility = apply->visibility;
|
||||
if (apply->width.width != CSS_WIDTH_INHERIT)
|
||||
style->width = apply->width;
|
||||
if (apply->white_space != CSS_WHITE_SPACE_INHERIT)
|
||||
@ -754,6 +760,8 @@ void css_merge(struct css_style * const style, const struct css_style * const ap
|
||||
style->line_height = apply->line_height;
|
||||
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
|
||||
style->text_align = apply->text_align;
|
||||
if (apply->visibility != CSS_VISIBILITY_INHERIT)
|
||||
style->visibility = apply->visibility;
|
||||
if (apply->width.width != CSS_WIDTH_INHERIT)
|
||||
style->width = apply->width;
|
||||
if (apply->white_space != CSS_WHITE_SPACE_INHERIT)
|
||||
|
@ -68,6 +68,8 @@ struct css_style {
|
||||
|
||||
css_text_align text_align;
|
||||
|
||||
css_visibility visibility;
|
||||
|
||||
struct {
|
||||
enum { CSS_WIDTH_INHERIT,
|
||||
CSS_WIDTH_AUTO,
|
||||
|
@ -18,4 +18,5 @@ css_text_align inherit left right center justify
|
||||
css_text_decoration none blink line_through overline underline
|
||||
css_text_transform none capitalize lowercase uppercase
|
||||
css_vertical_align baseline bottom middle sub super text_bottom text_top top percent
|
||||
css_visibility inherit visible hidden
|
||||
css_white_space inherit normal nowrap pre
|
||||
|
@ -50,6 +50,7 @@ static void parse_font_weight(struct css_style * const s, const struct css_node
|
||||
static void parse_height(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_line_height(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_text_align(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_visibility(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_width(struct css_style * const s, const struct css_node * const v);
|
||||
static void parse_white_space(struct css_style * const s, const struct css_node * const v);
|
||||
|
||||
@ -69,6 +70,7 @@ static const struct property_entry property_table[] = {
|
||||
{ "height", parse_height },
|
||||
{ "line-height", parse_line_height },
|
||||
{ "text-align", parse_text_align },
|
||||
{ "visibility", parse_visibility },
|
||||
{ "white-space", parse_white_space },
|
||||
{ "width", parse_width },
|
||||
};
|
||||
@ -516,6 +518,16 @@ void parse_text_align(struct css_style * const s, const struct css_node * const
|
||||
s->text_align = z;
|
||||
}
|
||||
|
||||
void parse_visibility(struct css_style * const s, const struct css_node * const v)
|
||||
{
|
||||
css_visibility z;
|
||||
if (v->type != CSS_NODE_IDENT || v->next != 0)
|
||||
return;
|
||||
z = css_visibility_parse(v->data);
|
||||
if (z != CSS_VISIBILITY_UNKNOWN)
|
||||
s->visibility = z;
|
||||
}
|
||||
|
||||
void parse_width(struct css_style * const s, const struct css_node * const v)
|
||||
{
|
||||
if (v->type == CSS_NODE_IDENT && strcasecmp(v->data, "auto") == 0)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <string.h>
|
||||
#include "oslib/colourtrans.h"
|
||||
#include "oslib/font.h"
|
||||
#include "netsurf/css/css.h"
|
||||
#include "netsurf/content/content.h"
|
||||
#include "netsurf/render/html.h"
|
||||
#include "netsurf/riscos/gui.h"
|
||||
@ -90,6 +91,14 @@ void html_redraw_box(struct content *content, struct box * box,
|
||||
x1 = x0 + width - 1;
|
||||
y0 = y1 - height + 1;
|
||||
|
||||
/* return if visibility is hidden or inherited visibility is hidden
|
||||
*/
|
||||
if (box->style->visibility == CSS_VISIBILITY_HIDDEN ||
|
||||
(box->style->visibility == CSS_VISIBILITY_INHERIT &&
|
||||
box->parent->style->visibility == CSS_VISIBILITY_HIDDEN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* return if the box is completely outside the clip rectangle, except
|
||||
* for table rows which may contain cells spanning into other rows */
|
||||
if (box->type != BOX_TABLE_ROW &&
|
||||
@ -219,7 +228,7 @@ void html_redraw_box(struct content *content, struct box * box,
|
||||
wimp_plot_icon(&icon);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
} else if (box->text && box->font) {
|
||||
|
||||
if (content->data.html.text_selection.selected == 1) {
|
||||
|
Loading…
Reference in New Issue
Block a user