aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-04-17 22:25:03 +0200
committerjcid <devnull@localhost>2008-04-17 22:25:03 +0200
commitd9a53431af0ba3e6d7010a6509e0ce9c549603e2 (patch)
tree63a6ad097e68e5e37cfc4c5439476d6794597845
parent743f7547bc125a1ec1cb71d5a1ab444bfeec2fce (diff)
- Improved parsing of collapsing white space.
-rw-r--r--ChangeLog1
-rw-r--r--configure.in2
-rw-r--r--dpi/ftp.c2
-rw-r--r--src/html.cc37
4 files changed, 13 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index f5f2103d..b14d929b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -50,6 +50,7 @@ dillo-fltk2
- Fixed a SEGFAULT bug in http.c (handling of web->url).
- Fixed handling of #anchors with repush, and other operations.
- Implemented a_Dialog_choice5(). May be used by dpis and dillo.
+ - Improved parsing of collapsing white space.
Patches: Jorge Arellano Cid
+- Connected signals to <li> elements (fixes links within lists).
- Enabled text, background-color, panel_size, geometry, fullscreen,
diff --git a/configure.in b/configure.in
index 55c4bb12..9f399d5e 100644
--- a/configure.in
+++ b/configure.in
@@ -81,7 +81,7 @@ typedef unsigned char uchar_t;
typedef unsigned short ushort_t;
typedef unsigned long ulong_t;
typedef unsigned int uint_t;
-typedef int bool_t;
+typedef unsigned char bool_t;
#endif /* __D_SIZE_H__ */
diff --git a/dpi/ftp.c b/dpi/ftp.c
index 07225c94..1001c5d2 100644
--- a/dpi/ftp.c
+++ b/dpi/ftp.c
@@ -173,7 +173,7 @@ static int try_ftp_transfer(char *url)
ssize_t n;
int nb, minibuf_sz;
- const char *mime_type;
+ const char *mime_type = "application/octet-stream";
char buf[4096], minibuf[MinSZ], *d_cmd;
pid_t ch_pid;
int aborted = 0;
diff --git a/src/html.cc b/src/html.cc
index 395fd227..55b6bb6b 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -304,6 +304,7 @@ public: //BUG: for now everything is public
bool_t PrevWasCR; /* Flag to help parsing of "\r\n" in PRE tags */
bool_t PrevWasOpenTag; /* Flag to help deferred parsing of white space */
bool_t SPCPending; /* Flag to help deferred parsing of white space */
+ bool_t PrevWasSPC; /* Flag to help handling collapsing white space */
bool_t InVisitedLink; /* used to 'contrast_visited_colors' */
bool_t ReqTagClose; /* Flag to help handling bad-formed HTML */
bool_t CloseOneTag; /* Flag to help Html_tag_cleanup_at_close() */
@@ -842,6 +843,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url,
PreFirstChar = FALSE;
PrevWasCR = FALSE;
PrevWasOpenTag = FALSE;
+ PrevWasSPC = FALSE;
SPCPending = FALSE;
InVisitedLink = FALSE;
ReqTagClose = FALSE;
@@ -1482,11 +1484,14 @@ static void Html_process_space(DilloHtml *html, const char *space,
html->SPCPending = FALSE;
} else {
- if (SGML_SPCDEL && html->PrevWasOpenTag) {
+ if (SGML_SPCDEL) {
/* SGML_SPCDEL ignores white space inmediately after an open tag */
+ if (html->PrevWasOpenTag)
+ html->SPCPending = FALSE;
+ } else if (!html->PrevWasSPC) {
+ DW2TB(html->dw)->addSpace(S_TOP(html)->style);
html->SPCPending = FALSE;
- } else {
- html->SPCPending = TRUE;
+ html->PrevWasSPC = TRUE;
}
if (parse_mode == DILLO_HTML_PARSE_MODE_STASH_AND_BODY)
@@ -1544,11 +1549,6 @@ static void Html_process_word(DilloHtml *html, const char *word, int size)
dFree(Pword);
} else {
- /* add pending space if present */
- if (html->SPCPending && (!SGML_SPCDEL || !html->PrevWasOpenTag))
- /* SGML_SPCDEL ignores space after an open tag */
- DW2TB(html->dw)->addSpace (S_TOP(html)->style);
-
/* Collapse white-space entities inside the word (except &nbsp;) */
Pword = Html_parse_entities(html, word, size);
for (i = 0; Pword[i]; ++i)
@@ -1559,6 +1559,7 @@ static void Html_process_word(DilloHtml *html, const char *word, int size)
}
html->PrevWasOpenTag = FALSE;
+ html->PrevWasSPC = FALSE;
html->SPCPending = FALSE;
if (html->InFlags & IN_LI)
html->WordAfterLI = TRUE;
@@ -2631,7 +2632,6 @@ static void Html_tag_open_button(DilloHtml *html, const char *tag, int tagsize)
*/
static void Html_tag_open_font(DilloHtml *html, const char *tag, int tagsize)
{
-#if 1
StyleAttrs style_attrs;
Style *old_style;
/*Font font;*/
@@ -2665,8 +2665,6 @@ static void Html_tag_open_font(DilloHtml *html, const char *tag, int tagsize)
Style::create (HT2LT(html), &style_attrs);
old_style->unref ();
}
-
-#endif
}
/*
@@ -3329,6 +3327,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize)
numtostr((*list_number)++, buf, 16, S_TOP(html)->style->listStyleType);
list_item->initWithText (dStrdup(buf), word_style);
list_item->addSpace (word_style);
+ html->PrevWasSPC = TRUE;
break;
case HTML_LIST_NONE:
MSG_HTML("<li> outside <ul> or <ol>\n");
@@ -5393,22 +5392,6 @@ static void Html_process_tag(DilloHtml *html, char *tag, int tagsize)
if (ni != -1 && !(html->InFlags & IN_BODY) /* && parsing HTML */)
Html_test_section(html, ni, IsCloseTag);
- /* White space handling */
- if (html->SPCPending) {
- if (SGML_SPCDEL) {
- /* SGML_SPCDEL requires space pending and open tag */
- if (!IsCloseTag)
- DW2TB(html->dw)->addSpace(S_TOP(html)->style);
- html->SPCPending = FALSE;
- } else {
- /* custom space handling: preserve pending space past close tags */
- if (!IsCloseTag) {
- DW2TB(html->dw)->addSpace(S_TOP(html)->style);
- html->SPCPending = FALSE;
- }
- }
- }
-
/* Tag processing */
ci = S_TOP(html)->tag_idx;
if (ni != -1) {