aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2012-09-20 21:27:09 +0200
committerSebastian Geerken <devnull@localhost>2012-09-20 21:27:09 +0200
commitfd3bd017cca30ec144ba19bb46159ffd952d5467 (patch)
tree4c317eb382923f3dd6933bbd794b275e448753b9
parente03f23fca4501d0db0d5e68e92292db0822b55fb (diff)
parent97a315bf349a757927f4a55a6cbe186f20d384af (diff)
Merge again with main repo.
-rw-r--r--dw/textblock.cc24
-rw-r--r--src/form.cc2
-rw-r--r--src/html.cc17
-rw-r--r--src/styleengine.cc4
-rw-r--r--src/table.cc6
5 files changed, 30 insertions, 23 deletions
diff --git a/dw/textblock.cc b/dw/textblock.cc
index 5bf0ef00..27c14561 100644
--- a/dw/textblock.cc
+++ b/dw/textblock.cc
@@ -968,8 +968,13 @@ void Textblock::drawText(core::View *view, core::style::Style *style,
}
}
-/*
- * Draw a word of text. TODO New description;
+/**
+ * Draw a word of text.
+ *
+ * Since hyphenated words consist of multiple instance of
+ * dw::Textblock::Word, which should be drawn as a whole (to preserve
+ * kerning etc.; see \ref dw-line-breaking), two indices are
+ * passed. See also drawLine(), where drawWord() is called.
*/
void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2,
core::View *view, core::Rectangle *area,
@@ -979,6 +984,15 @@ void Textblock::drawWord (Line *line, int wordIndex1, int wordIndex2,
bool drawHyphen = wordIndex2 == line->lastWord
&& words->getRef(wordIndex2)->hyphenWidth > 0;
+ if (style->hasBackground ()) {
+ int w = 0;
+ for (int i = wordIndex1; i <= wordIndex2; i++)
+ w += words->getRef(i)->size.width;
+ w += words->getRef(wordIndex2)->hyphenWidth;
+ drawBox (view, style, area, xWidget, yWidgetBase - line->boxAscent,
+ w, line->boxAscent + line->boxDescent, false);
+ }
+
if (wordIndex1 == wordIndex2 && !drawHyphen) {
// Simple case, where copying in one buffer is not needed.
Word *word = words->getRef (wordIndex1);
@@ -1182,12 +1196,6 @@ void Textblock::drawLine (Line *line, core::View *view, core::Rectangle *area)
if (child->intersects (area, &childArea))
child->draw (view, &childArea);
} else {
- /* TODO: include in drawWord:
- if (word->style->hasBackground ()) {
- drawBox (view, word->style, area, xWidget,
- yWidgetBase - line->boxAscent, word->size.width,
- line->boxAscent + line->boxDescent, false);
- }*/
int wordIndex2 = wordIndex;
while (wordIndex2 < line->lastWord &&
words->getRef(wordIndex2)->hyphenWidth > 0 &&
diff --git a/src/form.cc b/src/form.cc
index 3e2cb78e..11f27b47 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -327,7 +327,7 @@ 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 required for <form>\n");
+ 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 c008efed..ca9b7751 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -163,11 +163,10 @@ DilloUrl *a_Html_url_new(DilloHtml *html,
const char *suffix = (n_ic) > 1 ? "s" : "";
n_ic_spc = URL_ILLEGAL_CHARS_SPC(url);
if (n_ic == n_ic_spc) {
- BUG_MSG("URL has %d illegal character%s (%d space%s)\n",
- n_ic, suffix, n_ic_spc, suffix);
+ BUG_MSG("URL has %d illegal space%s\n", n_ic, suffix);
} else if (n_ic_spc == 0) {
- BUG_MSG("URL has %d illegal character%s (%d in {00-1F, 7F} range)\n",
- n_ic, suffix, n_ic);
+ BUG_MSG("URL has %d illegal character%s in {00-1F, 7F} range\n",
+ n_ic, suffix);
} else {
BUG_MSG("URL has %d illegal character%s: "
"%d space%s, and %d in {00-1F, 7F} range\n",
@@ -1650,7 +1649,7 @@ static void Html_tag_close_title(DilloHtml *html, int TagIdx)
a_UIcmd_set_page_title(html->bw, html->Stash->str);
a_History_set_title_by_url(html->page_url, html->Stash->str);
} else {
- BUG_MSG("the TITLE element must be inside the HEAD section\n");
+ BUG_MSG("TITLE element must be inside the HEAD section\n");
}
}
@@ -2846,7 +2845,7 @@ static void Html_tag_open_meta(DilloHtml *html, const char *tag, int tagsize)
/* only valid inside HEAD */
if (!(html->InFlags & IN_HEAD)) {
- BUG_MSG("META elements must be inside the HEAD section\n");
+ BUG_MSG("META element must be inside the HEAD section\n");
return;
}
@@ -3000,7 +2999,7 @@ static void Html_tag_open_link(DilloHtml *html, const char *tag, int tagsize)
/* Ignore LINK outside HEAD */
if (!(html->InFlags & IN_HEAD)) {
- BUG_MSG("the LINK element must be inside the HEAD section\n");
+ BUG_MSG("LINK element must be inside the HEAD section\n");
return;
}
/* Remote stylesheets enabled? */
@@ -3082,6 +3081,8 @@ static void Html_tag_open_span(DilloHtml *html, const char *tag, int tagsize)
{
const char *attrbuf;
+ html->styleEngine->inheritBackgroundColor();
+
if (prefs.show_tooltip &&
(attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) {
@@ -3903,7 +3904,7 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof)
} else if (ch == '<') {
/* unterminated tag detected */
p = dStrndup(buf+token_start+1,
- strcspn(buf+token_start+1, " <"));
+ strcspn(buf+token_start+1, " <\n\r\t"));
BUG_MSG("<%s> element lacks its closing '>'\n", p);
dFree(p);
--buf_index;
diff --git a/src/styleengine.cc b/src/styleengine.cc
index ed272269..b7814cde 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -605,9 +605,9 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props) {
attrs->x_link = p->value.intVal;
break;
case PROPERTY_X_LANG:
- attrs->x_lang[0] = tolower (p->value.strVal[0]);
+ attrs->x_lang[0] = D_ASCII_TOLOWER(p->value.strVal[0]);
if (attrs->x_lang[0])
- attrs->x_lang[1] = tolower (p->value.strVal[1]);
+ attrs->x_lang[1] = D_ASCII_TOLOWER(p->value.strVal[1]);
else
attrs->x_lang[1] = 0;
break;
diff --git a/src/table.cc b/src/table.cc
index 27de6bfc..98157e76 100644
--- a/src/table.cc
+++ b/src/table.cc
@@ -349,13 +349,9 @@ static void Html_tag_open_table_cell(DilloHtml *html,
switch (S_TOP(html)->table_mode) {
case DILLO_HTML_TABLE_MODE_NONE:
- BUG_MSG("<t%c> outside <table>\n",
- (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
return;
case DILLO_HTML_TABLE_MODE_TOP:
- BUG_MSG("<t%c> outside <tr>\n",
- (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
/* a_Dw_table_add_cell takes care that dillo does not crash. */
/* continues */
case DILLO_HTML_TABLE_MODE_TR:
@@ -401,6 +397,8 @@ static void Html_tag_content_table_cell(DilloHtml *html,
switch (S_TOP(html)->table_mode) {
case DILLO_HTML_TABLE_MODE_NONE:
+ BUG_MSG("<t%c> outside <table>\n",
+ (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h');
return;
case DILLO_HTML_TABLE_MODE_TOP: