fix quirks mode setting with libdom hubbub parser
This commit is contained in:
parent
d7289f6701
commit
394357b7c9
|
@ -1445,7 +1445,7 @@ css_select_results *box_get_style(html_content *c,
|
||||||
dom_string_byte_length(s),
|
dom_string_byte_length(s),
|
||||||
c->encoding,
|
c->encoding,
|
||||||
nsurl_access(content_get_url(&c->base)),
|
nsurl_access(content_get_url(&c->base)),
|
||||||
c->quirks != BINDING_QUIRKS_MODE_NONE,
|
c->quirks != DOM_DOCUMENT_QUIRKS_MODE_NONE,
|
||||||
box_style_alloc, NULL);
|
box_style_alloc, NULL);
|
||||||
|
|
||||||
dom_string_unref(s);
|
dom_string_unref(s);
|
||||||
|
@ -1456,7 +1456,7 @@ css_select_results *box_get_style(html_content *c,
|
||||||
|
|
||||||
/* Populate selection context */
|
/* Populate selection context */
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ bool box_normalise_block(struct box *block, html_content *c)
|
||||||
assert(block->style != NULL);
|
assert(block->style != NULL);
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ bool box_normalise_table(struct box *table, html_content * c)
|
||||||
assert(table->style != NULL);
|
assert(table->style != NULL);
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ bool box_normalise_table(struct box *table, html_content * c)
|
||||||
assert(table->style != NULL);
|
assert(table->style != NULL);
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ bool box_normalise_table_spans(struct box *table, struct span_info *spans,
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks ==
|
ctx.quirks = (c->quirks ==
|
||||||
BINDING_QUIRKS_MODE_FULL);
|
DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
@ -587,7 +587,7 @@ bool box_normalise_table_row_group(struct box *row_group,
|
||||||
assert(row_group->style != NULL);
|
assert(row_group->style != NULL);
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ bool box_normalise_table_row_group(struct box *row_group,
|
||||||
assert(row_group->style != NULL);
|
assert(row_group->style != NULL);
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ bool box_normalise_table_row(struct box *row,
|
||||||
assert(row->style != NULL);
|
assert(row->style != NULL);
|
||||||
|
|
||||||
ctx.ctx = c->select_ctx;
|
ctx.ctx = c->select_ctx;
|
||||||
ctx.quirks = (c->quirks == BINDING_QUIRKS_MODE_FULL);
|
ctx.quirks = (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL);
|
||||||
ctx.base_url = c->base_url;
|
ctx.base_url = c->base_url;
|
||||||
ctx.universal = c->universal;
|
ctx.universal = c->universal;
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
|
||||||
|
|
||||||
c->parser = NULL;
|
c->parser = NULL;
|
||||||
c->document = NULL;
|
c->document = NULL;
|
||||||
c->quirks = BINDING_QUIRKS_MODE_NONE;
|
c->quirks = DOM_DOCUMENT_QUIRKS_MODE_NONE;
|
||||||
c->encoding = NULL;
|
c->encoding = NULL;
|
||||||
c->base_url = nsurl_ref(content_get_url(&c->base));
|
c->base_url = nsurl_ref(content_get_url(&c->base));
|
||||||
c->base_target = NULL;
|
c->base_target = NULL;
|
||||||
|
@ -1850,7 +1850,7 @@ static bool html_find_stylesheets(html_content *c, dom_node *html)
|
||||||
c->base.active++;
|
c->base.active++;
|
||||||
LOG(("%d fetches active", c->base.active));
|
LOG(("%d fetches active", c->base.active));
|
||||||
|
|
||||||
if (c->quirks == BINDING_QUIRKS_MODE_FULL) {
|
if (c->quirks == DOM_DOCUMENT_QUIRKS_MODE_FULL) {
|
||||||
ns_error = hlcache_handle_retrieve(html_quirks_stylesheet_url,
|
ns_error = hlcache_handle_retrieve(html_quirks_stylesheet_url,
|
||||||
0, content_get_url(&c->base), NULL,
|
0, content_get_url(&c->base), NULL,
|
||||||
html_convert_css_callback, c, &child,
|
html_convert_css_callback, c, &child,
|
||||||
|
@ -1940,7 +1940,6 @@ static bool html_convert(struct content *c)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @todo quirks used to be set here too */
|
|
||||||
htmlc->document = dom_hubbub_parser_get_document(htmlc->parser);
|
htmlc->document = dom_hubbub_parser_get_document(htmlc->parser);
|
||||||
|
|
||||||
if (htmlc->document == NULL) {
|
if (htmlc->document == NULL) {
|
||||||
|
@ -1950,6 +1949,14 @@ static bool html_convert(struct content *c)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exc = dom_document_get_quirks_mode(htmlc->document, &htmlc->quirks);
|
||||||
|
if (exc != DOM_NO_ERR) {
|
||||||
|
LOG(("error retrieving quirks"));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(("quirks set to %d", htmlc->quirks));
|
||||||
|
|
||||||
|
|
||||||
if (htmlc->encoding == NULL) {
|
if (htmlc->encoding == NULL) {
|
||||||
const char *encoding;
|
const char *encoding;
|
||||||
encoding = dom_hubbub_parser_get_encoding(htmlc->parser,
|
encoding = dom_hubbub_parser_get_encoding(htmlc->parser,
|
||||||
|
|
|
@ -49,12 +49,6 @@ struct plotters;
|
||||||
struct scrollbar;
|
struct scrollbar;
|
||||||
struct scrollbar_msg_data;
|
struct scrollbar_msg_data;
|
||||||
|
|
||||||
typedef enum binding_quirks_mode {
|
|
||||||
BINDING_QUIRKS_MODE_NONE,
|
|
||||||
BINDING_QUIRKS_MODE_LIMITED,
|
|
||||||
BINDING_QUIRKS_MODE_FULL
|
|
||||||
} binding_quirks_mode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Container for stylesheets used by an HTML document
|
* Container for stylesheets used by an HTML document
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,7 +36,7 @@ typedef struct html_content {
|
||||||
/** Document tree */
|
/** Document tree */
|
||||||
dom_document *document;
|
dom_document *document;
|
||||||
/** Quirkyness of document */
|
/** Quirkyness of document */
|
||||||
binding_quirks_mode quirks;
|
dom_document_quirks_mode quirks;
|
||||||
|
|
||||||
/** Encoding of source, NULL if unknown. */
|
/** Encoding of source, NULL if unknown. */
|
||||||
char *encoding;
|
char *encoding;
|
||||||
|
|
Loading…
Reference in New Issue