summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/font.c19
-rw-r--r--riscos/gui.c9
-rw-r--r--riscos/image.h2
-rw-r--r--riscos/plugin.c3
-rw-r--r--riscos/plugin.h3
-rw-r--r--riscos/save.c6
-rw-r--r--riscos/save_complete.c11
-rw-r--r--riscos/textselection.c3
-rw-r--r--riscos/window.c4
9 files changed, 42 insertions, 18 deletions
diff --git a/riscos/font.c b/riscos/font.c
index eef02690f..a2cf561fb 100644
--- a/riscos/font.c
+++ b/riscos/font.c
@@ -28,6 +28,7 @@
#include "oslib/wimpreadsysinfo.h"
#include "rufl.h"
#include "css/css.h"
+#include "css/utils.h"
#include "render/font.h"
#include "riscos/gui.h"
#include "riscos/options.h"
@@ -235,6 +236,10 @@ bool nsfont_width(const plot_font_style_t *fstyle,
rufl_code code;
nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
+ if (font_size == 0) {
+ *width = 0;
+ return true;
+ }
code = rufl_width(font_family, font_style, font_size,
string, length,
@@ -277,6 +282,11 @@ bool nsfont_position_in_string(const plot_font_style_t *fstyle,
rufl_code code;
nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
+ if (font_size == 0) {
+ *char_offset = 0;
+ *actual_x = 0;
+ return true;
+ }
code = rufl_x_to_offset(font_family, font_style, font_size,
string, length,
@@ -324,6 +334,11 @@ bool nsfont_split(const plot_font_style_t *fstyle,
rufl_code code;
nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
+ if (font_size == 0) {
+ *char_offset = 0;
+ *actual_x = 0;
+ return true;
+ }
code = rufl_split(font_family, font_style, font_size,
string, length,
@@ -383,6 +398,8 @@ bool nsfont_paint(const plot_font_style_t *fstyle, const char *string,
rufl_code code;
nsfont_read_style(fstyle, &font_family, &font_size, &font_style);
+ if (font_size == 0)
+ return true;
code = rufl_paint(font_family, font_style, font_size * scale,
string, length, x, y,
@@ -426,8 +443,6 @@ void nsfont_read_style(const plot_font_style_t *fstyle,
};
*font_size = (fstyle->size * 16) / FONT_SIZE_SCALE;
- if (*font_size < option_font_min_size * 1.6)
- *font_size = option_font_min_size * 1.6;
if (1600 < *font_size)
*font_size = 1600;
diff --git a/riscos/gui.c b/riscos/gui.c
index 5d70a0d8f..594488341 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -154,6 +154,7 @@ extern int __dynamic_num;
const char * NETSURF_DIR;
char *default_stylesheet_url;
+char *quirks_stylesheet_url;
char *adblock_stylesheet_url;
static const char *task_name = "NetSurf";
@@ -409,8 +410,10 @@ void gui_init(int argc, char** argv)
/* Initialise stylesheet URLs */
default_stylesheet_url = strdup("file:///NetSurf:/Resources/CSS");
+ quirks_stylesheet_url = strdup("file:///NetSurf:/Resources/Quirks");
adblock_stylesheet_url = strdup("file:///NetSurf:/Resources/AdBlock");
- if (!default_stylesheet_url || !adblock_stylesheet_url)
+ if (!default_stylesheet_url || !quirks_stylesheet_url ||
+ !adblock_stylesheet_url)
die("Failed initialising string constants.");
/* Initialise filename allocator */
@@ -771,6 +774,7 @@ void gui_quit(void)
free(gui_sprites);
xwimp_close_down(task_handle);
free(default_stylesheet_url);
+ free(quirks_stylesheet_url);
free(adblock_stylesheet_url);
/* We don't care if this fails */
hubbub_finalise(myrealloc, NULL);
@@ -2283,9 +2287,6 @@ void ro_gui_dump_content(struct content *content)
case CONTENT_HTML:
box_dump(stream, content->data.html.layout, 0);
break;
- case CONTENT_CSS:
- css_dump_stylesheet(content->data.css.css);
- break;
default:
break;
}
diff --git a/riscos/image.h b/riscos/image.h
index f0bf2fdf9..a11388c13 100644
--- a/riscos/image.h
+++ b/riscos/image.h
@@ -20,7 +20,7 @@
#define _NETSURF_RISCOS_IMAGE_H_
#include <stdbool.h>
-#include "css/css.h"
+#include "desktop/plot_style.h"
#include "oslib/osspriteop.h"
struct osspriteop_area;
diff --git a/riscos/plugin.c b/riscos/plugin.c
index 742a099b7..5778e531b 100644
--- a/riscos/plugin.c
+++ b/riscos/plugin.c
@@ -183,7 +183,8 @@ static void plugin_fetch_callback(fetch_msg msg, void *p, const void *data,
* \param params Parameters associated with the content
* \return true on success, false otherwise
*/
-bool plugin_create(struct content *c, const char *params[])
+bool plugin_create(struct content *c, struct content *parent,
+ const char *params[])
{
LOG(("plugin_create"));
c->data.plugin.bw = 0;
diff --git a/riscos/plugin.h b/riscos/plugin.h
index 39c2d1b3d..6f288235a 100644
--- a/riscos/plugin.h
+++ b/riscos/plugin.h
@@ -52,7 +52,8 @@ struct content_plugin_data {
/* function definitions */
bool plugin_handleable(const char *mime_type);
void plugin_msg_parse(wimp_message *message, int ack);
-bool plugin_create(struct content *c, const char *params[]);
+bool plugin_create(struct content *c, struct content *parent,
+ const char *params[]);
bool plugin_convert(struct content *c, int width, int height);
void plugin_reformat(struct content *c, int width, int height);
void plugin_destroy(struct content *c);
diff --git a/riscos/save.c b/riscos/save.c
index e49ce319d..292c46194 100644
--- a/riscos/save.c
+++ b/riscos/save.c
@@ -626,8 +626,10 @@ void ro_gui_save_drag_end(wimp_dragged *drag)
while (!dest_ok && (box = box_at_point(box, pos.x, pos.y,
&box_x, &box_y, &content))) {
- if (box->style &&
- box->style->visibility == CSS_VISIBILITY_HIDDEN)
+ if (box->style &&
+ css_computed_visibility(
+ box->style) ==
+ CSS_VISIBILITY_HIDDEN)
continue;
if (box->gadget) {
diff --git a/riscos/save_complete.c b/riscos/save_complete.c
index 0e9e3845d..7342a7c20 100644
--- a/riscos/save_complete.c
+++ b/riscos/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 <style> elements */
snprintf(spath, sizeof spath, "%s.%x", path,
@@ -262,7 +265,7 @@ bool save_imported_sheets(struct content *c, const char *path)
os_error *error;
for (j = 0; j != c->data.css.import_count; j++) {
- struct content *css = c->data.css.import_content[j];
+ struct content *css = c->data.css.imports[j];
if (!css)
continue;
diff --git a/riscos/textselection.c b/riscos/textselection.c
index 8da2d4e79..7b4578ad9 100644
--- a/riscos/textselection.c
+++ b/riscos/textselection.c
@@ -556,7 +556,8 @@ void ro_gui_selection_dragging(wimp_message *message)
while ((box = box_at_point(box, pos.x, pos.y,
&box_x, &box_y, &content))) {
- if (box->style && box->style->visibility ==
+ if (box->style &&
+ css_computed_visibility(box->style) ==
CSS_VISIBILITY_HIDDEN)
continue;
diff --git a/riscos/window.c b/riscos/window.c
index d8637661b..764a014ed 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -2824,8 +2824,8 @@ bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message)
box_y = box->margin[TOP];
while ((box = box_at_point(box, pos.x, pos.y, &box_x, &box_y, &content))) {
- if (box->style &&
- box->style->visibility == CSS_VISIBILITY_HIDDEN)
+ if (box->style && css_computed_visibility(box->style) ==
+ CSS_VISIBILITY_HIDDEN)
continue;
if (box->gadget) {