diff options
author | Sebastian Geerken <devnull@localhost> | 2013-10-14 20:25:21 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-10-14 20:25:21 +0200 |
commit | a86189a5307f05974429277414909f14888669d5 (patch) | |
tree | 8a2f963b13adf2d56c2a506f3458f852308af9c1 /src | |
parent | bd6a97f011cd71bcd679b7fba09fa60f9fb2e0a8 (diff) | |
parent | 8de011d8d7357509c487b3de5e052dfc52730b2b (diff) |
Merge with main repo.
Diffstat (limited to 'src')
-rw-r--r-- | src/IO/http.c | 2 | ||||
-rw-r--r-- | src/dillo.cc | 3 | ||||
-rw-r--r-- | src/form.cc | 3 | ||||
-rw-r--r-- | src/html.cc | 42 | ||||
-rw-r--r-- | src/prefs.c | 2 | ||||
-rw-r--r-- | src/prefs.h | 2 | ||||
-rw-r--r-- | src/prefsparser.cc | 2 | ||||
-rw-r--r-- | src/table.cc | 34 | ||||
-rw-r--r-- | src/tipwin.cc | 2 | ||||
-rw-r--r-- | src/ui.cc | 22 | ||||
-rw-r--r-- | src/ui.hh | 2 | ||||
-rw-r--r-- | src/url.c | 11 |
12 files changed, 99 insertions, 28 deletions
diff --git a/src/IO/http.c b/src/IO/http.c index 62cbc08b..1af1996d 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -300,6 +300,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester, "Accept-Encoding: gzip\r\n" "%s" /* language */ "%s" /* auth */ + "DNT: 1\r\n" "Host: %s\r\n" "%s" "%s" @@ -325,6 +326,7 @@ Dstr *a_Http_make_query_str(const DilloUrl *url, const DilloUrl *requester, "Accept-Encoding: gzip\r\n" "%s" /* language */ "%s" /* auth */ + "DNT: 1\r\n" "Host: %s\r\n" "%s" "%s" diff --git a/src/dillo.cc b/src/dillo.cc index 567d897f..6a7747ed 100644 --- a/src/dillo.cc +++ b/src/dillo.cc @@ -489,8 +489,7 @@ int main(int argc, char **argv) Fl::scheme(prefs.theme); setColors(); - if (!prefs.show_tooltip) { - // turn off UI tooltips + if (!prefs.show_ui_tooltip) { Fl::option(Fl::OPTION_SHOW_TOOLTIPS, false); } diff --git a/src/form.cc b/src/form.cc index af25bcb9..a91e170b 100644 --- a/src/form.cc +++ b/src/form.cc @@ -362,7 +362,8 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "action"))) action = a_Html_url_new(html, attrbuf, NULL, 0); else { - BUG_MSG("action attribute is required for <form>\n"); + if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f) + BUG_MSG("action attribute is required for <form>\n"); action = a_Url_dup(html->base_url); } content_type = DILLO_HTML_ENC_URLENCODED; diff --git a/src/html.cc b/src/html.cc index 2ff6a2c7..00882ccc 100644 --- a/src/html.cc +++ b/src/html.cc @@ -289,6 +289,9 @@ void a_Html_tag_set_align_attr(DilloHtml *html, const char *tag, int tagsize) if ((align = a_Html_get_attr(html, tag, tagsize, "align"))) { TextAlignType textAlignType = TEXT_ALIGN_LEFT; + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("The align attribute is obsolete in HTML5.\n"); + if (dStrAsciiCasecmp (align, "left") == 0) textAlignType = TEXT_ALIGN_LEFT; else if (dStrAsciiCasecmp (align, "right") == 0) @@ -330,6 +333,9 @@ bool a_Html_tag_set_valign_attr(DilloHtml *html, const char *tag, int tagsize) VAlignType valign; if ((attr = a_Html_get_attr(html, tag, tagsize, "valign"))) { + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("The valign attribute is obsolete in HTML5.\n"); + if (dStrAsciiCasecmp (attr, "top") == 0) valign = VALIGN_TOP; else if (dStrAsciiCasecmp (attr, "bottom") == 0) @@ -1829,6 +1835,10 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) { color = a_Html_color_parse(html, attrbuf, -1); + + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<body> bgcolor attribute is obsolete.\n"); + if (color != -1) html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, color); @@ -1836,6 +1846,10 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "text"))) { color = a_Html_color_parse(html, attrbuf, -1); + + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<body> text attribute is obsolete.\n"); + if (color != -1) html->styleEngine->setNonCssHint (CSS_PROPERTY_COLOR, CSS_TYPE_COLOR, color); @@ -1843,11 +1857,17 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) html->restyle (); - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "link"))) + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "link"))) { html->non_css_link_color = a_Html_color_parse(html, attrbuf, -1); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<body> link attribute is obsolete.\n"); + } - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "vlink"))) + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "vlink"))) { html->non_css_visited_color = a_Html_color_parse(html, attrbuf, -1); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<body> vlink attribute is obsolete.\n"); + } html->dw->setStyle (html->style ()); @@ -2669,6 +2689,8 @@ static void Html_tag_open_ul(DilloHtml *html, const char *tag, int tagsize) html->styleEngine->setNonCssHint (CSS_PROPERTY_LIST_STYLE_TYPE, CSS_TYPE_ENUM, list_style_type); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<ul> type attribute is obsolete.\n"); } S_TOP(html)->list_type = HTML_LIST_UNORDERED; @@ -2785,19 +2807,26 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) width_ptr = a_Html_get_attr_wdef(html, tag, tagsize, "width", NULL); if (width_ptr) { + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<hr> width attribute is obsolete.\n"); html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, a_Html_parse_length (html, width_ptr)); dFree(width_ptr); } - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "size"))) + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "size"))) { size = strtol(attrbuf, NULL, 10); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<hr> size attribute is obsolete.\n"); + } a_Html_tag_set_align_attr(html, tag, tagsize); /* TODO: evaluate attribute */ if (a_Html_get_attr(html, tag, tagsize, "noshade")) { + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<hr> noshade attribute is obsolete.\n"); html->styleEngine->setNonCssHint (CSS_PROPERTY_BORDER_TOP_STYLE, CSS_TYPE_ENUM, BORDER_SOLID); html->styleEngine->setNonCssHint (CSS_PROPERTY_BORDER_BOTTOM_STYLE, @@ -3840,10 +3869,13 @@ static const char *Html_get_attr2(DilloHtml *html, break; case MATCH_ATTR_NAME: - if ((Found = (!(attrname[attr_pos]) && - (tag[i] == '=' || isspace(tag[i]) || tag[i] == '>')))) { + if (!attrname[attr_pos] && + (tag[i] == '=' || isspace(tag[i]) || tag[i] == '>')) { + Found = 1; state = SEEK_TOKEN_START; --i; + } else if (!tag[i]) { + state = SEEK_ATTR_START; // NULL byte is not allowed } else { if (D_ASCII_TOLOWER(tag[i]) != D_ASCII_TOLOWER(attrname[attr_pos])) state = SEEK_ATTR_START; diff --git a/src/prefs.c b/src/prefs.c index 4ab476c8..4b45b51e 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -93,10 +93,12 @@ void a_Prefs_init(void) prefs.show_quit_dialog = TRUE; prefs.show_reload = TRUE; prefs.show_save = TRUE; + prefs.show_url = TRUE; prefs.show_search = TRUE; prefs.show_stop = TRUE; prefs.show_tools = TRUE; prefs.show_tooltip = TRUE; + prefs.show_ui_tooltip = TRUE; prefs.small_icons = FALSE; prefs.start_page = a_Url_new(PREFS_START_PAGE, NULL); prefs.theme = dStrdup(PREFS_THEME); diff --git a/src/prefs.h b/src/prefs.h index 941c0b51..bdb3aaee 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -61,6 +61,7 @@ typedef struct { int32_t ui_text_bg_color; bool_t contrast_visited_color; bool_t show_tooltip; + bool_t show_ui_tooltip; char *theme; int panel_size; bool_t small_icons; @@ -80,6 +81,7 @@ typedef struct { bool_t show_tools; bool_t show_filemenu; bool_t show_clear_url; + bool_t show_url; bool_t show_search; bool_t show_help; bool_t show_progress_box; diff --git a/src/prefsparser.cc b/src/prefsparser.cc index dde562b3..f6522d45 100644 --- a/src/prefsparser.cc +++ b/src/prefsparser.cc @@ -103,10 +103,12 @@ int PrefsParser::parseOption(char *name, char *value) { "show_quit_dialog", &prefs.show_quit_dialog, PREFS_BOOL }, { "show_reload", &prefs.show_reload, PREFS_BOOL }, { "show_save", &prefs.show_save, PREFS_BOOL }, + { "show_url", &prefs.show_url, PREFS_BOOL }, { "show_search", &prefs.show_search, PREFS_BOOL }, { "show_stop", &prefs.show_stop, PREFS_BOOL }, { "show_tools", &prefs.show_tools, PREFS_BOOL }, { "show_tooltip", &prefs.show_tooltip, PREFS_BOOL }, + { "show_ui_tooltip", &prefs.show_ui_tooltip, PREFS_BOOL }, { "small_icons", &prefs.small_icons, PREFS_BOOL }, { "start_page", &prefs.start_page, PREFS_URL }, { "theme", &prefs.theme, PREFS_STRING }, diff --git a/src/table.cc b/src/table.cc index b11dde4d..a3002ebf 100644 --- a/src/table.cc +++ b/src/table.cc @@ -45,10 +45,17 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "border"))) border = isdigit(attrbuf[0]) ? strtol (attrbuf, NULL, 10) : 1; - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cellspacing"))) + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cellspacing"))) { cellspacing = strtol (attrbuf, NULL, 10); - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cellpadding"))) + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<table> cellspacing attribute is obsolete.\n"); + } + + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "cellpadding"))) { cellpadding = strtol (attrbuf, NULL, 10); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<table> cellpadding attribute is obsolete.\n"); + } if (border != -1) { cssLength = CSS_CREATE_LENGTH (border, CSS_LENGTH_TYPE_PX); @@ -76,10 +83,13 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) CSS_TYPE_LENGTH_PERCENTAGE, cssLength); } - if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "width"))) + if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "width"))) { html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, a_Html_parse_length (html, attrbuf)); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<table> width attribute is obsolete.\n"); + } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "align"))) { if (dStrAsciiCasecmp (attrbuf, "left") == 0) @@ -91,6 +101,8 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) else if (dStrAsciiCasecmp (attrbuf, "center") == 0) html->styleEngine->setNonCssHint (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, TEXT_ALIGN_CENTER); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<table> align attribute is obsolete.\n"); } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) { @@ -98,6 +110,8 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) if (bgcolor != -1) html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<table> bgcolor attribute is obsolete.\n"); } html->style (); // evaluate now, so we can build non-css hints for the cells @@ -177,6 +191,8 @@ void Html_tag_open_tr(DilloHtml *html, const char *tag, int tagsize) if (bgcolor != -1) html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<tr> bgcolor attribute is obsolete.\n"); } if (a_Html_get_attr (html, tag, tagsize, "align")) { @@ -361,9 +377,13 @@ static void Html_tag_open_table_cell(DilloHtml *html, html->styleEngine->setNonCssHint (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, text_align); } - if (a_Html_get_attr(html, tag, tagsize, "nowrap")) + if (a_Html_get_attr(html, tag, tagsize, "nowrap")) { + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<t%c> nowrap attribute is obsolete.\n", + (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h'); html->styleEngine->setNonCssHint(CSS_PROPERTY_WHITE_SPACE, CSS_TYPE_ENUM, WHITE_SPACE_NOWRAP); + } a_Html_tag_set_align_attr (html, tag, tagsize); @@ -371,6 +391,9 @@ static void Html_tag_open_table_cell(DilloHtml *html, html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, a_Html_parse_length (html, attrbuf)); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<t%c> width attribute is obsolete.\n", + (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h'); } a_Html_tag_set_valign_attr (html, tag, tagsize); @@ -380,6 +403,9 @@ static void Html_tag_open_table_cell(DilloHtml *html, if (bgcolor != -1) html->styleEngine->setNonCssHint (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor); + if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) + BUG_MSG("<t%c> bgcolor attribute is obsolete.\n", + (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h'); } default: diff --git a/src/tipwin.cc b/src/tipwin.cc index c8463eb5..01d9a2f4 100644 --- a/src/tipwin.cc +++ b/src/tipwin.cc @@ -71,7 +71,7 @@ void TipWin::value(const char *s) { void TipWin::do_show(void *wid) { cur_widget = wid; // Keep track of requesting widget - if (prefs.show_tooltip) { + if (prefs.show_ui_tooltip) { Fl::add_timeout(recent ? 0.2f : 0.8f, show_timeout); } } @@ -455,12 +455,16 @@ void UI::make_location(int ww) b->set_tooltip("Clear the URL box.\nMiddle-click to paste a URL."); p_xpos += b->w(); - CustInput *i = new CustInput(p_xpos,0,ww-p_xpos-32,lh,0); - Location = i; - i->when(FL_WHEN_ENTER_KEY); - i->callback(location_cb, this); - i->set_tooltip("Location"); - p_xpos += i->w(); + LocationGroup = new Fl_Group(p_xpos,0,ww-p_xpos-32,lh,0); + LocationGroup->begin(); + CustInput *i = new CustInput(p_xpos,0,ww-p_xpos-32,lh,0); + Location = i; + i->when(FL_WHEN_ENTER_KEY); + i->callback(location_cb, this); + i->set_tooltip("Location"); + p_xpos += i->w(); + LocationGroup->box(FL_THIN_UP_BOX); // or FL_FLAT_BOX + LocationGroup->end(); Search = b = new CustButton(p_xpos,0,16,lh,0); b->image(icons->ImgSearch); @@ -567,7 +571,7 @@ void UI::make_panel(int ww) make_toolbar(ww,bh); make_filemenu_button(); make_location(ww); - NavBar->resizable(Location); + NavBar->resizable(LocationGroup); make_progress_bars(0,1); NavBar->box(FL_THIN_UP_FRAME); NavBar->end(); @@ -581,7 +585,7 @@ void UI::make_panel(int ww) p_xpos = 0; make_filemenu_button(); make_location(ww); - LocBar->resizable(Location); + LocBar->resizable(LocationGroup); LocBar->end(); LocBar->rearrange(); TopGroup->insert(*LocBar,0); @@ -945,6 +949,8 @@ void UI::customize() Tools->hide(); if ( !prefs.show_clear_url ) Clear->hide(); + if ( !prefs.show_url ) + Location->hide(); if ( !prefs.show_search ) Search->hide(); if ( !prefs.show_help ) @@ -129,7 +129,7 @@ class UI : public CustGroupVertical { CustGroupHorizontal *LocBar, *NavBar, *StatusBar; Fl_Input *Location; CustProgressBox *PProg, *IProg; - Fl_Group *Panel, *Main; + Fl_Group *Panel, *Main, *LocationGroup; Fl_Output *StatusOutput; Findbar *FindBar; @@ -688,15 +688,14 @@ static uint_t Url_host_public_internal_dots(const char *host) if (tld_len > 0) { /* These TLDs were chosen by examining the current publicsuffix list - * in October 2012 and picking out those where it was simplest for + * in September 2013 and picking out those where it was simplest for * them to describe the situation by beginning with a "*.[tld]" rule * or every rule was "[something].[tld]". */ - const char *const tlds[] = {"ar","au","bd","bn","ck","cy","er","et", - "fj","fk","gt","gu","il","jm","ke","kh", - "kp","kw","lb","lr","mm","mt","mz","ni", - "np","nz","om","pg","py","sv","tr","uk", - "ve","ye","za","zm","zw"}; + const char *const tlds[] = {"au","bd","bn","ck","cy","er","et","fj", + "fk","gn","gu","il","jm","ke","kh","kp", + "kw","lb","lr","mm","mt","mz","ni","np", + "nz","pg","tr","uk","ye","za","zm","zw"}; uint_t i, tld_num = sizeof(tlds) / sizeof(tlds[0]); for (i = 0; i < tld_num; i++) { |