diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/capi.c | 6 | ||||
-rw-r--r-- | src/decode.c | 21 | ||||
-rw-r--r-- | src/domain.c | 8 | ||||
-rw-r--r-- | src/form.cc | 58 | ||||
-rw-r--r-- | src/form.hh | 8 | ||||
-rw-r--r-- | src/html.cc | 44 | ||||
-rw-r--r-- | src/styleengine.cc | 8 | ||||
-rw-r--r-- | src/table.cc | 6 |
8 files changed, 57 insertions, 102 deletions
@@ -302,7 +302,11 @@ static char *Capi_dpi_build_cmd(DilloWeb *web, char *server) /* Let's be kind and make the HTTP query string for the dpi */ char *proxy_connect = a_Http_make_connect_str(web->url); Dstr *http_query = a_Http_make_query_str(web->url, web->requester,FALSE); - /* BUG: embedded NULLs in query data will truncate message */ + + if ((uint_t) http_query->len > strlen(http_query->str)) { + /* Can't handle NULLs embedded in query data */ + MSG_ERR("HTTPS query truncated!\n"); + } /* BUG: WORKAROUND: request to only check the root URL's certificate. * This avoids the dialog bombing that stems from loading multiple diff --git a/src/decode.c b/src/decode.c index 7ea3dc25..c5752e62 100644 --- a/src/decode.c +++ b/src/decode.c @@ -242,24 +242,6 @@ Decode *a_Decode_content_init(const char *format) } /* - * Legal names for the ASCII character set - */ -static int Decode_is_ascii(const char *str) -{ - return (!(dStrAsciiCasecmp(str, "ASCII") && - dStrAsciiCasecmp(str, "US-ASCII") && - dStrAsciiCasecmp(str, "us") && - dStrAsciiCasecmp(str, "IBM367") && - dStrAsciiCasecmp(str, "cp367") && - dStrAsciiCasecmp(str, "csASCII") && - dStrAsciiCasecmp(str, "ANSI_X3.4-1968") && - dStrAsciiCasecmp(str, "iso-ir-6") && - dStrAsciiCasecmp(str, "ANSI_X3.4-1986") && - dStrAsciiCasecmp(str, "ISO_646.irv:1991") && - dStrAsciiCasecmp(str, "ISO646-US"))); -} - -/* * Initialize decoder to translate from any character set known to iconv() * to UTF-8. * @@ -272,8 +254,7 @@ Decode *a_Decode_charset_init(const char *format) if (format && strlen(format) && - dStrAsciiCasecmp(format,"UTF-8") && - !Decode_is_ascii(format)) { + dStrAsciiCasecmp(format,"UTF-8")) { iconv_t ic = iconv_open("UTF-8", format); if (ic != (iconv_t) -1) { diff --git a/src/domain.c b/src/domain.c index af8c8075..90d6b414 100644 --- a/src/domain.c +++ b/src/domain.c @@ -132,17 +132,17 @@ bool_t a_Domain_permit(const DilloUrl *source, const DilloUrl *dest) if (a_Url_same_organization(source, dest)) return TRUE; + ret = default_deny ? FALSE : TRUE; + for (i = 0; i < num_exceptions; i++) { - if(Domain_match(source_host, exceptions[i].origin) && - Domain_match(dest_host, exceptions[i].destination)) { + if (Domain_match(source_host, exceptions[i].origin) && + Domain_match(dest_host, exceptions[i].destination)) { ret = default_deny; MSG("Domain: Matched rule from %s to %s.\n", exceptions[i].origin, exceptions[i].destination); break; } } - if (i == num_exceptions) - ret = default_deny ? FALSE : TRUE; MSG("Domain: %s from %s to %s.\n", (ret == TRUE ? "permitted" : "DENIED"), source_host, dest_host); diff --git a/src/form.cc b/src/form.cc index 099f1a48..92e06ab1 100644 --- a/src/form.cc +++ b/src/form.cc @@ -177,6 +177,7 @@ public: void addOption (char *value, bool selected, bool enabled); void ensureSelection (); void addOptionsTo (SelectionResource *res); + void reset (SelectionResource *res); void appendValuesTo (Dlist *values, SelectionResource *res); }; @@ -360,7 +361,7 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize) a_Url_free(action); } -void Html_tag_close_form(DilloHtml *html, int TagIdx) +void Html_tag_close_form(DilloHtml *html) { // DilloHtmlForm *form; // int i; @@ -547,10 +548,11 @@ void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize) if (a_Html_get_attr(html, tag, tagsize, "readonly")) ((EntryResource *) resource)->setEditable(false); -// /* Maximum length of the text in the entry */ -// if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "maxlength"))) -// gtk_entry_set_max_length(GTK_ENTRY(widget), -// strtol(attrbuf, NULL, 10)); + /* Maximum length of the text in the entry */ + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "maxlength"))) { + int maxlen = strtol(attrbuf, NULL, 10); + ((EntryResource *) resource)->setMaxLength(maxlen); + } } if (prefs.show_tooltip && (attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) { @@ -680,7 +682,7 @@ void Html_tag_content_textarea(DilloHtml *html, const char *tag, int tagsize) * Close textarea * (TEXTAREA is parsed in VERBATIM mode, and entities are handled here) */ -void Html_tag_close_textarea(DilloHtml *html, int TagIdx) +void Html_tag_close_textarea(DilloHtml *html) { char *str; DilloHtmlInput *input; @@ -774,7 +776,7 @@ void Html_tag_open_select(DilloHtml *html, const char *tag, int tagsize) /* * ? */ -void Html_tag_close_select(DilloHtml *html, int TagIdx) +void Html_tag_close_select(DilloHtml *html) { if (html->InFlags & IN_SELECT) { if (html->InFlags & IN_OPTION) @@ -898,7 +900,7 @@ void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize) /* * Handle close <BUTTON> */ -void Html_tag_close_button(DilloHtml *html, int TagIdx) +void Html_tag_close_button(DilloHtml *html) { html->InFlags &= ~IN_BUTTON; } @@ -982,8 +984,6 @@ void DilloHtmlForm::submit(DilloHtmlInput *active_input, EventButton *event) } a_Url_free(url); } - // /* now, make the rendered area have its focus back */ - // gtk_widget_grab_focus(GTK_BIN(bw->render_main_scroll)->child); } /* @@ -1764,35 +1764,12 @@ void DilloHtmlInput::reset () } break; case DILLO_HTML_INPUT_SELECT: + case DILLO_HTML_INPUT_SEL_LIST: if (select != NULL) { - /* this is in reverse order so that, in case more than one was - * selected, we get the last one, which is consistent with handling - * of multiple selected options in the layout code. */ -// for (i = select->num_options - 1; i >= 0; i--) { -// if (select->options[i].init_val) { -// gtk_menu_item_activate(GTK_MENU_ITEM -// (select->options[i].menuitem)); -// Html_select_set_history(input); -// break; -// } -// } + SelectionResource *sr = (SelectionResource *) embed->getResource(); + select->reset(sr); } break; - case DILLO_HTML_INPUT_SEL_LIST: - if (!select) - break; -// for (i = 0; i < select->num_options; i++) { -// if (select->options[i].init_val) { -// if (select->options[i].menuitem->state == GTK_STATE_NORMAL) -// gtk_list_select_child(GTK_LIST(select->menu), -// select->options[i].menuitem); -// } else { -// if (select->options[i].menuitem->state==GTK_STATE_SELECTED) -// gtk_list_unselect_child(GTK_LIST(select->menu), -// select->options[i].menuitem); -// } -// } - break; case DILLO_HTML_INPUT_TEXTAREA: if (init_str != NULL) { MultiLineTextResource *textres = @@ -1874,6 +1851,15 @@ void DilloHtmlSelect::addOptionsTo (SelectionResource *res) } } +void DilloHtmlSelect::reset (SelectionResource *res) +{ + int size = options->size (); + for (int i = 0; i < size; i++) { + DilloHtmlOption *option = options->get (i); + res->setItem(i, option->selected); + } +} + void DilloHtmlSelect::appendValuesTo (Dlist *values, SelectionResource *res) { int size = options->size (); diff --git a/src/form.hh b/src/form.hh index cd04543f..297442e0 100644 --- a/src/form.hh +++ b/src/form.hh @@ -48,16 +48,16 @@ void a_Html_form_display_hiddens2(void *v_form, bool display); */ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize); -void Html_tag_close_form(DilloHtml *html, int TagIdx); +void Html_tag_close_form(DilloHtml *html); void Html_tag_open_input(DilloHtml *html, const char *tag, int tagsize); void Html_tag_open_isindex(DilloHtml *html, const char *tag, int tagsize); void Html_tag_open_textarea(DilloHtml *html, const char *tag, int tagsize); void Html_tag_content_textarea(DilloHtml *html, const char *tag, int tagsize); -void Html_tag_close_textarea(DilloHtml *html, int TagIdx); +void Html_tag_close_textarea(DilloHtml *html); void Html_tag_open_select(DilloHtml *html, const char *tag, int tagsize); -void Html_tag_close_select(DilloHtml *html, int TagIdx); +void Html_tag_close_select(DilloHtml *html); void Html_tag_open_option(DilloHtml *html, const char *tag, int tagsize); void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize); -void Html_tag_close_button(DilloHtml *html, int TagIdx); +void Html_tag_close_button(DilloHtml *html); #endif /* __FORM_HH__ */ diff --git a/src/html.cc b/src/html.cc index 7ba1a69e..44023e37 100644 --- a/src/html.cc +++ b/src/html.cc @@ -69,7 +69,7 @@ using namespace dw::core::style; *---------------------------------------------------------------------------*/ class DilloHtml; typedef void (*TagOpenFunct) (DilloHtml *html, const char *tag, int tagsize); -typedef void (*TagCloseFunct) (DilloHtml *html, int TagIdx); +typedef void (*TagCloseFunct) (DilloHtml *html); typedef enum { SEEK_ATTR_START, @@ -1305,7 +1305,7 @@ static void Html_tag_cleanup_to_idx(DilloHtml *html, int idx) BUG_MSG(" - forcing close of open tag: <%s>\n", toptag.name); _MSG("Close: %*s%s\n", size," ", toptag.name); if (toptag.close) - toptag.close(html, toptag_idx); + toptag.close(html); Html_real_pop_tag(html); } } @@ -1571,7 +1571,7 @@ static void Html_tag_open_html(DilloHtml *html, const char *tag, int tagsize) /* * Handle close HTML element */ -static void Html_tag_close_html(DilloHtml *html, int TagIdx) +static void Html_tag_close_html(DilloHtml *html) { /* TODO: may add some checks here */ if (html->Num_HTML == 1) { @@ -1606,7 +1606,7 @@ static void Html_tag_open_head(DilloHtml *html, const char *tag, int tagsize) * twice when the head element is closed implicitly. * Note2: HEAD is parsed once completely got. */ -static void Html_tag_close_head(DilloHtml *html, int TagIdx) +static void Html_tag_close_head(DilloHtml *html) { if (html->InFlags & IN_HEAD) { _MSG("Closing HEAD section\n"); @@ -1636,7 +1636,7 @@ static void Html_tag_open_title(DilloHtml *html, const char *tag, int tagsize) * Handle close TITLE * set page-title in the browser window and in the history. */ -static void Html_tag_close_title(DilloHtml *html, int TagIdx) +static void Html_tag_close_title(DilloHtml *html) { if (html->InFlags & IN_HEAD) { /* title is only valid inside HEAD */ @@ -1661,7 +1661,7 @@ static void Html_tag_open_script(DilloHtml *html, const char *tag, int tagsize) /* * Handle close SCRIPT */ -static void Html_tag_close_script(DilloHtml *html, int TagIdx) +static void Html_tag_close_script(DilloHtml *html) { /* eventually the stash will be sent to an interpreter for parsing */ } @@ -1698,7 +1698,7 @@ static void Html_tag_open_style(DilloHtml *html, const char *tag, int tagsize) /* * Handle close STYLE */ -static void Html_tag_close_style(DilloHtml *html, int TagIdx) +static void Html_tag_close_style(DilloHtml *html) { if (prefs.parse_embedded_css && html->loadCssFromStash) html->styleEngine->parse(html, NULL, html->Stash->str, html->Stash->len, @@ -1788,7 +1788,7 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) /* * BODY */ -static void Html_tag_close_body(DilloHtml *html, int TagIdx) +static void Html_tag_close_body(DilloHtml *html) { if (html->Num_BODY == 1) { /* some tag soup pages use multiple BODY tags... */ @@ -2224,7 +2224,7 @@ static void Html_tag_content_map(DilloHtml *html, const char *tag, int tagsize) /* * Handle close <MAP> */ -static void Html_tag_close_map(DilloHtml *html, int TagIdx) +static void Html_tag_close_map(DilloHtml *html) { /* This is a hack for the perhaps frivolous feature of drawing image map * shapes when there is no image to display. If this map is defined after @@ -2495,7 +2495,7 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize) /* * <A> close function */ -static void Html_tag_close_a(DilloHtml *html, int TagIdx) +static void Html_tag_close_a(DilloHtml *html) { html->InVisitedLink = false; } @@ -2527,7 +2527,7 @@ static void Html_tag_open_q(DilloHtml *html, const char *tag, int tagsize) /* * </Q> */ -static void Html_tag_close_q(DilloHtml *html, int TagIdx) +static void Html_tag_close_q(DilloHtml *html) { /* Right Double Quotation Mark */ const char *U201D = "\xe2\x80\x9d"; @@ -2657,7 +2657,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize) /* * Close <LI> */ -static void Html_tag_close_li(DilloHtml *html, int TagIdx) +static void Html_tag_close_li(DilloHtml *html) { html->InFlags &= ~IN_LI; ((ListItem *)html->dw)->flush (); @@ -2769,7 +2769,7 @@ static void Html_tag_open_pre(DilloHtml *html, const char *tag, int tagsize) /* * Custom close for <PRE> */ -static void Html_tag_close_pre(DilloHtml *html, int TagIdx) +static void Html_tag_close_pre(DilloHtml *html) { html->InFlags &= ~IN_PRE; } @@ -3023,22 +3023,6 @@ static void Html_tag_open_link(DilloHtml *html, const char *tag, int tagsize) } /* - * Set the history of the menu to be consistent with the active menuitem. - */ -//static void Html_select_set_history(DilloHtmlInput *input) -//{ -// int i; -// -// for (i = 0; i < input->select->num_options; i++) { -// if (GTK_CHECK_MENU_ITEM(input->select->options[i].menuitem)->active) { -// gtk_option_menu_set_history(GTK_OPTION_MENU(input->widget), i); -// break; -// } -// } -//} - - -/* * Set the Document Base URI */ static void Html_tag_open_base(DilloHtml *html, const char *tag, int tagsize) @@ -3107,7 +3091,7 @@ static void Html_tag_open_div(DilloHtml *html, const char *tag, int tagsize) /* * Default close for paragraph tags - pop the stack and break. */ -static void Html_tag_close_par(DilloHtml *html, int TagIdx) +static void Html_tag_close_par(DilloHtml *html) { HT2TB(html)->addParbreak (9, html->styleEngine->wordStyle ()); } diff --git a/src/styleengine.cc b/src/styleengine.cc index 2c7b1d7a..c394887e 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -51,7 +51,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) { style_attrs.color = Color::create (layout, 0); style_attrs.backgroundColor = Color::create (layout, 0xffffff); - n->style = Style::create (layout, &style_attrs); + n->style = Style::create (&style_attrs); } StyleEngine::~StyleEngine () { @@ -715,7 +715,7 @@ Style * StyleEngine::backgroundStyle () { assert (attrs.backgroundColor); stack->getRef (stack->size () - 1)->backgroundStyle = - Style::create (layout, &attrs); + Style::create (&attrs); } return stack->getRef (stack->size () - 1)->backgroundStyle; } @@ -757,7 +757,7 @@ Style * StyleEngine::style0 (int i) { postprocessAttrs (&attrs); - stack->getRef (i)->style = Style::create (layout, &attrs); + stack->getRef (i)->style = Style::create (&attrs); return stack->getRef (i)->style; } @@ -771,7 +771,7 @@ Style * StyleEngine::wordStyle0 () { attrs.valign = style ()->valign; - stack->getRef(stack->size() - 1)->wordStyle = Style::create(layout, &attrs); + stack->getRef(stack->size() - 1)->wordStyle = Style::create(&attrs); return stack->getRef (stack->size () - 1)->wordStyle; } diff --git a/src/table.cc b/src/table.cc index 98157e76..41f2b686 100644 --- a/src/table.cc +++ b/src/table.cc @@ -297,7 +297,7 @@ static void Html_set_collapsing_border_model(DilloHtml *html, Widget *col_tb) collapseCellAttrs.borderWidth.bottom = borderWidth; collapseCellAttrs.hBorderSpacing = 0; collapseCellAttrs.vBorderSpacing = 0; - collapseStyle = Style::create(HT2LT(html), &collapseCellAttrs); + collapseStyle = Style::create(&collapseCellAttrs); col_tb->setStyle (collapseStyle); if (Html_table_get_border_model(html) != DILLO_HTML_TABLE_BORDER_COLLAPSE) { @@ -314,7 +314,7 @@ static void Html_set_collapsing_border_model(DilloHtml *html, Widget *col_tb) collapseTableAttrs.borderStyle = collapseCellAttrs.borderStyle; /* CSS2 17.6.2: table does not have padding (in collapsing mode) */ collapseTableAttrs.padding.setVal (0); - collapseStyle = Style::create(HT2LT(html), &collapseTableAttrs); + collapseStyle = Style::create(&collapseTableAttrs); ((dw::Table*)S_TOP(html)->table)->setStyle (collapseStyle); } } @@ -331,7 +331,7 @@ static void Html_set_separate_border_model(DilloHtml *html, Widget *col_tb) separateCellAttrs = *(html->styleEngine->style ()); /* CSS2 17.5: Internal table elements do not have margins */ separateCellAttrs.margin.setVal (0); - separateStyle = Style::create(HT2LT(html), &separateCellAttrs); + separateStyle = Style::create(&separateCellAttrs); col_tb->setStyle (separateStyle); } |