From ddeadd1c02880367ad786b113d352a519f45ec73 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 23 Jul 2009 23:05:34 +0000 Subject: Merge LibCSS port to trunk. svn path=/trunk/netsurf/; revision=8752 --- amiga/context_menu.c | 2 +- amiga/font.c | 10 ++++------ amiga/gui.c | 7 +++++-- amiga/resources/quirks.css | 1 + amiga/save_complete.c | 11 +++++++---- 5 files changed, 18 insertions(+), 13 deletions(-) create mode 120000 amiga/resources/quirks.css (limited to 'amiga') diff --git a/amiga/context_menu.c b/amiga/context_menu.c index 7f60d4963..24dd90f2b 100755 --- a/amiga/context_menu.c +++ b/amiga/context_menu.c @@ -92,7 +92,7 @@ void ami_context_menu_show(struct gui_window_2 *gwin,int x,int y) while(curbox = box_at_point(curbox,x,y,&box_x,&box_y,&cc)) { - if (curbox->style && curbox->style->visibility == CSS_VISIBILITY_HIDDEN) continue; + if (curbox->style && css_computed_visibility(curbox->style) == CSS_VISIBILITY_HIDDEN) continue; if(curbox->href) { diff --git a/amiga/font.c b/amiga/font.c index cd7d834e2..5c694c199 100644 --- a/amiga/font.c +++ b/amiga/font.c @@ -237,7 +237,7 @@ struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle) { struct OutlineFont *ofont; char *fontname; - WORD ysize; + ULONG ysize; int tstyle = 0; if ((fstyle->flags & FONTF_ITALIC) || (fstyle->flags & FONTF_OBLIQUE)) @@ -268,14 +268,12 @@ struct OutlineFont *ami_open_outline_font(const plot_font_style_t *fstyle) break; } - ysize = fstyle->size; - - if(ysize < (option_font_min_size / 10) * FONT_SIZE_SCALE) - ysize = (option_font_min_size / 10) * FONT_SIZE_SCALE; + /* Scale to 16.16 fixed point */ + ysize = fstyle->size * ((1 << 16) / FONT_SIZE_SCALE); if(ESetInfo(&ofont->olf_EEngine, OT_DeviceDPI,(72<<16) | 72, - OT_PointHeight,(ysize<<16)/FONT_SIZE_SCALE, + OT_PointHeight,ysize, TAG_END) == OTERR_Success) { return ofont; diff --git a/amiga/gui.c b/amiga/gui.c index f36f4a5df..62e98afdf 100755 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -27,6 +27,7 @@ #include "amiga/schedule.h" #include #include "content/urldb.h" +#include "css/utils.h" #include #include "desktop/history_core.h" #include @@ -105,6 +106,7 @@ #include char *default_stylesheet_url; +char *quirks_stylesheet_url; char *adblock_stylesheet_url; struct MsgPort *appport; @@ -324,6 +326,7 @@ void gui_init(int argc, char** argv) messages_load(lang); default_stylesheet_url = "file:///PROGDIR:Resources/amiga.css"; + quirks_stylesheet_url = "file:///PROGDIR:Resources/quirks.css"; adblock_stylesheet_url = "file:///PROGDIR:Resources/adblock.css"; if(hubbub_initialise("PROGDIR:Resources/Aliases",myrealloc,NULL) != HUBBUB_OK) @@ -331,7 +334,7 @@ void gui_init(int argc, char** argv) die(messages_get("NoMemory")); } - css_screen_dpi = 72; + nscss_screen_dpi = INTTOFIX(72); css_scrollbar_fg_colour = 0x00aaaaaa; css_scrollbar_bg_colour = 0x00833c3c; css_scrollbar_arrow_colour = 0x00d6d6d6; @@ -1303,7 +1306,7 @@ void ami_handle_appmsg(void) box = content->data.html.layout; while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) { - if (box->style && box->style->visibility == CSS_VISIBILITY_HIDDEN) continue; + if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) continue; if (box->gadget) { diff --git a/amiga/resources/quirks.css b/amiga/resources/quirks.css new file mode 120000 index 000000000..d9fb80334 --- /dev/null +++ b/amiga/resources/quirks.css @@ -0,0 +1 @@ +../../!NetSurf/Resources/Quirks,f79 \ No newline at end of file diff --git a/amiga/save_complete.c b/amiga/save_complete.c index 26b55adf5..2f5ebd584 100755 --- a/amiga/save_complete.c +++ b/amiga/save_complete.c @@ -120,17 +120,20 @@ bool save_complete_html(struct content *c, const char *path, bool index) return true; /* save stylesheets, ignoring the base and adblocking sheets */ - for (i = STYLESHEET_STYLE; i != c->data.html.stylesheet_count; i++) { + for (i = STYLESHEET_START; i != c->data.html.stylesheet_count; i++) { struct content *css = c->data.html.stylesheet_content[i]; char *source; int source_len; + bool is_style; if (!css) continue; if (save_complete_list_check(css)) continue; - if (i != STYLESHEET_STYLE) { + is_style = (strcmp(css->url, c->data.html.base_url) == 0); + + if (is_style == false) { if (!save_complete_list_add(css)) { warn_user("NoMemory", 0); return false; @@ -140,7 +143,7 @@ bool save_complete_html(struct content *c, const char *path, bool index) if (!save_imported_sheets(css, path)) return false; - if (i == STYLESHEET_STYLE) + if (is_style) continue; /* don't save