1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-18 01:26:23 -04:00
Commit Graph

923 Commits

Author SHA1 Message Date
Witold Filipczyk
236f600148 More headers.
There was a compilation error on OpenBSD, so I guess more includes are required.
2010-09-17 16:13:22 +02:00
Witold Filipczyk
79340fa4ac Better looking symbols for LI elements. 2010-08-11 21:22:21 +02:00
Nils Dagsson Moskopp
2f0d954add Rudimentary support for HTML5 media elements
Make use of the HTML5 media elements, <video> and <audio> by adding
links to the media.
2010-08-07 20:44:44 +00:00
Witold Filipczyk
2ff9f1a76f & 15 for foreground. 2010-07-31 20:58:11 +02:00
Witold Filipczyk
17f82a3e21 Decode ESC color sequences in the plain renderer.
Added functions for screen_char->color -> color_T conversion.
2010-07-31 20:51:24 +02:00
Witold Filipczyk
fecb5f1f9d Compilation fix on Mingw32. 2010-07-03 15:11:54 +02:00
Witold Filipczyk
0ec2f8eaa8 Show IP of the document in the status bar.
config options:
ui.show_ip (0/1) default 0
status.showip-text - colors
2010-03-30 14:45:19 +02:00
Kalle Olavi Niemitalo
7bb51e7139 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	NEWS
	configure.in
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/af.po (kept 0.13.GIT)
	po/be.po (kept 0.13.GIT)
	po/bg.po (kept 0.13.GIT)
	po/ca.po (kept 0.13.GIT)
	po/cs.po (kept 0.13.GIT)
	po/da.po (kept 0.13.GIT)
	po/de.po (kept 0.13.GIT)
	po/el.po (kept 0.13.GIT)
	po/es.po (kept 0.13.GIT)
	po/et.po (kept 0.13.GIT)
	po/fi.po (kept 0.13.GIT)
	po/fr.po (kept 0.13.GIT)
	po/gl.po (kept 0.13.GIT)
	po/hr.po (kept 0.13.GIT)
	po/hu.po (kept 0.13.GIT)
	po/id.po (kept 0.13.GIT)
	po/is.po (kept 0.13.GIT)
	po/it.po (kept 0.13.GIT)
	po/lt.po (kept 0.13.GIT)
	po/nb.po (kept 0.13.GIT)
	po/nl.po (kept 0.13.GIT)
	po/pl.po (kept 0.13.GIT)
	po/pt.po (kept 0.13.GIT)
	po/pt_BR.po (kept 0.13.GIT)
	po/ro.po (kept 0.13.GIT)
	po/ru.po (kept 0.13.GIT)
	po/sk.po (kept 0.13.GIT)
	po/sr.po (kept 0.13.GIT)
	po/sv.po (kept 0.13.GIT)
	po/tr.po (kept 0.13.GIT)
	po/uk.po (kept 0.13.GIT)
	src/ecmascript/ecmascript.c
2009-07-11 16:47:33 +03:00
Kalle Olavi Niemitalo
e452420d5f Debian bug 534835: Don't assert ecmascript_reset_state succeeds
After the recent ecmascript_get_interpreter change, I got an assertion
failure in render_document, which calls ecmascript_reset_state and
then asserts that it has set vs->ecmascript != NULL.
ecmascript_reset_state cannot guarantee that because there might not
even be enough free memory for mem_calloc(1, sizeof(struct
ecmascript_interpreter).  So, replace the assertion in render_document
with error handling, and likewise in call_onsubmit_and_submit.
2009-06-28 11:17:06 +03:00
Miciah Dashiel Butler Masters
874202ef7a Don't fail assertion on 0-second meta-refresh
In start_document_refresh, use register_bottom_half instead of
install_timer if the timeout is 0 because install_timer asserts that it is
given a delay greater than 0.

Add a test case, test/refresh-0timeout.html.  Note that
document.browse.minimum_refresh_time must be set to 0 to reproduce the
assertion failure.
2009-06-18 18:13:25 +00:00
Miciah Dashiel Butler Masters
aafebad3f5 Document struct search 2009-05-22 20:24:34 +00:00
Kalle Olavi Niemitalo
34f8f6a58f Merge branch 'elinks-0.12' into master
Conflicts:
	NEWS (merged)
	configure.in (merged)
	doc/man/man1/elinks.1.in (regenerated)
	doc/man/man5/elinks.conf.5 (regenerated)
	doc/man/man5/elinkskeys.5 (regenerated)
	po/af.po (used elinks-0.12)
	po/be.po (used elinks-0.12)
	po/bg.po (used elinks-0.12)
	po/ca.po (used elinks-0.12)
	po/cs.po (used elinks-0.12)
	po/da.po (used elinks-0.12)
	po/de.po (used elinks-0.12)
	po/el.po (used elinks-0.12)
	po/es.po (used elinks-0.12)
	po/et.po (used elinks-0.12)
	po/fi.po (used elinks-0.12)
	po/fr.po (used master)
	po/gl.po (used elinks-0.12)
	po/hr.po (used elinks-0.12)
	po/hu.po (used elinks-0.12)
	po/id.po (used elinks-0.12)
	po/is.po (used elinks-0.12)
	po/it.po (used elinks-0.12)
	po/lt.po (used elinks-0.12)
	po/nb.po (used elinks-0.12)
	po/nl.po (used elinks-0.12)
	po/pl.po (used master)
	po/pt.po (used elinks-0.12)
	po/pt_BR.po (used elinks-0.12)
	po/ro.po (used elinks-0.12)
	po/ru.po (used elinks-0.12)
	po/sk.po (used elinks-0.12)
	po/sr.po (used elinks-0.12)
	po/sv.po (used elinks-0.12)
	po/tr.po (used elinks-0.12)
	po/uk.po (used elinks-0.12)
2009-03-29 18:26:20 +03:00
Kalle Olavi Niemitalo
d7d18e4e43 bug 1047: inline functions C99 conformance
C99 6.7.4p3 and 6.7.4p6 set some constraints on what can be done in
inline functions and how they can be declared.  In particular, any
function declared inline must also be defined in the same translation
unit.  To comply with that, remove inline specifiers from function
declarations in header files when the functions are not also defined
in those header files.

Sun Studio 11 on Solaris 9 is stricter than C99 and does not allow
references to static identifiers in extern inline functions.  Make the
configure script detect this and define NONSTATIC_INLINE accordingly
in config.h.  Then use that in the definitions of all non-static
inline functions.

Document the restrictions and this scheme in doc/hacking.txt.
2009-03-28 20:15:08 +02:00
Kalle Olavi Niemitalo
1bb71f3732 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/config/conf.c
	src/network/ssl/ssl.c
2009-03-12 08:46:02 +02:00
Kalle Olavi Niemitalo
5a43c55c9e Rewrap lines in option documentation.
Documentation strings of most options used to contain a "\n" at the
end of each source line.  When the option manager displayed these
strings, it treated each "\n" as a hard newline.  On 80x24 terminals
however, the option description window has only 60 columes available
for the text (with the default setup.h), and the hard newlines were
further apart, so the option manager wrapped the text a second time,
resulting in rather ugly output where long lones are interleaved with
short ones.  This could also cause the text to take up too much
vertical space and not fit in the window.

Replace most of those hard newlines with spaces so that the option
manager (or perhaps BFU) will take care of the wrapping.  At the same
time, rewrap the strings in source code so that the source lines are
at most 79 columns wide.

In some options though, there is a list of possible values and their
meanings.  In those lists, if the description of one value does not
fit in one line, then continuation lines should be indented.  The
option manager and BFU are not currently able to do that.  So, keep
the hard newlines in those lists, but rewrap them to 60 columns so
that they are less likely to require further wrapping at runtime.
2009-03-08 15:18:10 +02:00
Kalle Olavi Niemitalo
ece4bfcc28 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/document/dom/renderer.c (split into rss.c, source.c)
2009-02-15 05:08:06 +02:00
Kalle Olavi Niemitalo
d14f65a331 bug 1067: Comments about freeing the DOM document node. 2009-02-15 04:27:39 +02:00
Witold Filipczyk
f77748299b bug 1067: Fix for elinks-0.13. 2009-02-12 10:05:35 +01:00
Witold Filipczyk
a7c2f14e6d bug 1067: the node was freed, but still used. 2009-02-12 09:48:04 +01:00
Kalle Olavi Niemitalo
d2854dca8d Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/bookmarks/backend/default.c
	src/bookmarks/bookmarks.c
	src/session/session.c
	src/terminal/event.c
	src/viewer/text/search.c
2009-02-08 22:02:57 +02:00
Kalle Olavi Niemitalo
99d1269bc5 bug 153, 1066: Convert session-snapshot bookmarks to/from UTF-8.
These functions now expect or return strings in UTF-8:
delete_folder_by_name (sneak in a const, too), bookmark_terminal_tabs,
open_bookmark_folder, and get_auto_save_bookmark_foldername_utf8 (new
function).
2009-02-08 18:26:19 +02:00
Witold Filipczyk
d91668b0c5 Pass the codepage (cp) instead of options to the scan_http_equiv. 2009-01-27 09:23:56 +01:00
Kalle Olavi Niemitalo
687f19dbde Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/bfu/dialog.c
	src/bfu/hotkey.c
	src/bfu/inpfield.c
	src/dialogs/options.c
	src/document/renderer.c
	src/intl/gettext/libintl.h
	src/protocol/http/codes.c
	src/session/task.c
	src/terminal/event.c
	src/terminal/terminal.h
	src/viewer/text/form.c
	src/viewer/text/link.c

And a semantic conflict in src/terminal/terminal.c.
2009-01-01 19:14:01 +00:00
Kalle Olavi Niemitalo
ad45176dde Add get_terminal_codepage().
This simplifies the callers a little and may help implement
simultaneous support for different charsets on different terminals
of the same type (bug 1064).
2009-01-01 16:16:17 +00:00
Kalle Olavi Niemitalo
25da8085b3 Fix double-free crash if EOF immediately follows </MAP>.
look_for_link() used to return 0 both when it found the closing </MAP>
tag, and when it hit the end of the file.  In the first case, it also
added *menu to the memory_list; in the second case, it did not.  The
caller get_image_map() supposedly distinguished between these cases by
checking whether pos >= eof, and freed *menu separately if so.

However, if the </MAP> was at the very end of the HTML file, so that
not even a newline followed it, then look_for_link() left pos == eof
even though it had found the </MAP> and added *menu to the memory_list.
This made get_image_map() misinterpret the result and mem_free(*menu)
even though *menu had already been freed as part of the memory_list;
thus the crash.

To fix this, make look_for_link() return -1 instead of 0 if it hits
EOF without finding the </MAP>.  Then make get_image_map() check the
return value instead of comparing pos to eof.  And add a test case,
although not an automated one.

Alternatively, look_for_link() could have been changed to decrement
pos between finding the </MAP> and returning 0.  Then, the pos >= eof
comparison in get_image_map() would have been false.  That scheme
would however have been a bit more difficult to understand and
maintain, I think.

Reported by Paul B. Mahol.
(cherry picked from commit a2404407ce)
2008-12-31 20:15:44 +00:00
Miciah Dashiel Butler Masters
aedc4c3e37 CSS: do not fail assertion on "url( )"
A style-sheet containing the string "url( )" with 1 or more characters of
whitespace in between the parentheses triggered an assertion failure in
scan_css_token.

scan_css_token would find the left parenthesis, find the right parenthesis,
and then scan forwards from the left parenthesis for a non-whitespace
character to find the start of the URL and backwards from the right
parenthesis to find the end of the URL.  If there were whitespace and
nothing else, the start would be past the end, the routine would compute a
negative length for the URL, and then the routine would trigger an
assertion failure.  Now the routine simply enforces a lower bound of length
0 for the URL.
2008-12-25 07:16:02 +00:00
Kalle Olavi Niemitalo
0ec4f380fa Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	AUTHORS
2008-11-10 00:07:20 +02:00
Peter Collingbourne
658b9cc70f Fixed bug relating to newlines in hidden input fields
This patch fixes an issue whereby a newline character appearing within
a hidden input field is incorrectly reinterpreted as a space character.
The patch handles almost all cases, and includes a test case.
15/18 tests pass, but the remainder currently fail due to the fact
that ELinks does not currently support textarea scripting.
2008-11-09 23:28:46 +02:00
Kalle Olavi Niemitalo
5c2fada371 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:
	src/session/download.c
2008-11-01 22:39:17 +02:00
M. Vefa Bicakci
20a7a6c460 Patch 3: Further fixes including strcasestr and convert_to_lowercase 2008-11-01 22:32:43 +02:00
M. Vefa Bicakci
96b3093519 Patch 2: Modifications to the remaining parts of ELinks
[Forward ported to 0.12 from bug 1004 attachment 499.  --KON]
2008-11-01 22:20:25 +02:00
M. Vefa Bicakci
86085de07e Patch 1: Finalize modifications to the HTML parser
[Forward ported to 0.12 from bug 1004 attachment 498.  --KON]
2008-10-26 18:00:19 +02:00
M. Vefa Bicakci
85c26ddc45 Patch 0: Partial modification of the HTML parser and modification of the FastFind subsystem
[Forward ported to 0.12 from bug 1004 attachment 500.  --KON]
2008-10-26 16:13:38 +02:00
Kalle Olavi Niemitalo
0f6add14f2 Update document.comb_x and comb_y when splitting lines.
On 2008-09-05, it was reported to elinks-dev that ELinks hits an
internal error (bad alloc_header) when given a specific HTML file.
On 2008-09-09, out-of-range values of document->comb_x and
document->comb_y were noted as the cause of memory corruption.
Update those variables when splitting, aligning, or justifying a line.
Add many assertions to detect the bug if it occurs again.
2008-09-14 17:29:39 +03:00
Kalle Olavi Niemitalo
8548108e39 Make document.comb_{x,y} not relative to part.box.
Previously, the character at (document.comb_x, document.comb_y) was
accessed via the POS macro, which adds part.box.x and part.box.y to
the coordinates.  However, if document.comb and document.y are set
at the end of one part and read at the beginning of another, then
the struct screen_char used by the original part should be updated,
even though the new part has a different box.  Change comb_{x,y} to
be relative to the document, rather than to the box of a single part.
2008-09-14 16:15:25 +03:00
Kalle Olavi Niemitalo
a73fe73cd2 Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	src/document/document.h
	src/encoding/encoding.c
	src/network/connection.c
	src/protocol/bittorrent/bittorrent.c
	src/protocol/bittorrent/bittorrent.h
	src/protocol/bittorrent/common.h
	src/protocol/bittorrent/connection.c
	src/protocol/bittorrent/dialogs.c
	src/protocol/bittorrent/tracker.c
	src/protocol/file/cgi.c
	src/protocol/http/http.c
2008-08-03 22:18:53 +03:00
Kalle Olavi Niemitalo
018af50f1d Rename cache_entry.id and related members.
cache_entry.id => cache_entry.cache_id
document.id => document.cache_id
ecmascript_interpreter.onload_snippets_owner => .onload_snippets_cache_id

This is a combination of:

commit 232c07aa7f
bug 1009: id variables renamed, added document_id to the document.

commit 6007043458bf8f14abfc18b9db60785bdc0279f6
Revert addition of document.document_id
2008-08-03 21:27:56 +03:00
Kalle Olavi Niemitalo
6c2e8cd7b2 Bug 1013: Don't assume errno is between 0 and 100000
Replace almost all uses of enum connection_state with struct
connection_status.  This removes the assumption that errno values used
by the system are between 0 and 100000.  The GNU Hurd uses values like
ENOENT = 0x40000002 and EMIG_SERVER_DIED = -308.

This commit is derived from my attachments 450 and 467 to bug 1013.
2008-08-03 17:56:41 +03:00
Kalle Olavi Niemitalo
bbee237ff0 Merge branch 'elinks-0.12' into elinks-0.13 2008-07-20 14:47:40 +03:00
Kalle Olavi Niemitalo
83ccaa3673 Bug 698: Keep forms contiguous and non-overlapping and start from 0.
In document.forms, each struct form has form_num and form_end members
that reserve a subrange of [0, INT_MAX] to that form.  Previously,
multiple forms in the list could have form_end == INT_MAX and thus
overlap each other.  Prevent that by adjusting form_end of each form
newly added to the list.

Revert 438f039bda,
"check_html_form_hierarchy: Old code was buggy.", which made
check_html_form_hierarchy attach controls to the wrong forms.
Instead, construct the dummy form ("for those Flying Dutchmans") at
form_num == 0 always before adding any real forms to the list.
This prevents the assertion failure by ensuring that every possible
form_control.position is covered by some form, if there are any forms.

Add a function assert_forms_list_ok, which checks that the set of
forms actually covers the [0, INT_MAX] range without overlapping,
as intended.  Call that from check_html_form_hierarchy to detect
any corruption.

I have tested this code (before any cherry-picking) with:
- bug 613 attachment 210: didn't crash
- bug 714 attachment 471: didn't crash
- bug 961 attachment 382: didn't crash
- bug 698 attachment 239: all the submit buttons showed the right URLs
- bug 698 attachment 470: the submit button showed the right URL

(cherry picked from commit 386a5d517b)
2008-07-20 11:46:01 +03:00
Kalle Olavi Niemitalo
bbadb99dd1 952, 954: Add ecmascript_{detach,moved}_form_state stubs
Anything that frees or reallocates struct form_state must now call the
new functions ecmascript_detach_form_state or ecmascript_moved_form_state.
These functions should then clear out any dangling pointers, but that has
not yet been implemented.
2008-07-18 19:56:49 +03:00
Kalle Olavi Niemitalo
386a5d517b Bug 698: Keep forms contiguous and non-overlapping and start from 0.
In document.forms, each struct form has form_num and form_end members
that reserve a subrange of [0, INT_MAX] to that form.  Previously,
multiple forms in the list could have form_end == INT_MAX and thus
overlap each other.  Prevent that by adjusting form_end of each form
newly added to the list.

Revert 438f039bda,
"check_html_form_hierarchy: Old code was buggy.", which made
check_html_form_hierarchy attach controls to the wrong forms.
Instead, construct the dummy form ("for those Flying Dutchmans") at
form_num == 0 always before adding any real forms to the list.
This prevents the assertion failure by ensuring that every possible
form_control.position is covered by some form, if there are any forms.

Add a function assert_forms_list_ok, which checks that the set of
forms actually covers the [0, INT_MAX] range without overlapping,
as intended.  Call that from check_html_form_hierarchy to detect
any corruption.

I have tested this code (before any cherry-picking) with:
- bug 613 attachment 210: didn't crash
- bug 714 attachment 471: didn't crash
- bug 961 attachment 382: didn't crash
- bug 698 attachment 239: all the submit buttons showed the right URLs
- bug 698 attachment 470: the submit button showed the right URL
2008-07-14 15:02:06 +03:00
Kalle Olavi Niemitalo
988cec481b Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	NEWS
	configure.in

The following files also conflicted, but they had not been manually
edited in the elinks-0.12 branch after the previous merge, so I just
kept the 0.13.GIT versions:

	doc/man/man1/elinks.1.in
	doc/man/man5/elinks.conf.5
	doc/man/man5/elinkskeys.5
	po/fr.po
	po/pl.po
2008-07-11 22:28:45 +03:00
Miciah Dashiel Butler Masters
6cf099a087 Bug 983: Give precedence to HTTP Content-Type header over HTML meta tag
The Content-Type from the HTTP response header has
precedence over the Content-Type from a meta http-equiv tag.
http://www.w3.org/International/tutorials/tutorial-char-enc/en/all.html

This fixes bug 983.
2008-06-30 19:29:02 +00:00
Jonas Fonseca
1bd98053b0 Fix memory leak in the DOM configuration module
... by making the (only) user (which is the RSS renderer) responsible
allocation of the dom_config structure.
2008-06-21 00:19:15 +02:00
Miciah Dashiel Butler Masters
c21a3592c9 Build fix: Wrap supports_html_media_attr with #ifdef CONFIG_CSS/#endif 2008-06-18 08:48:18 +00:00
Miciah Dashiel Butler Masters
0b99fa70ca Bug 620: Reset form fields to default values on reload
Do not retain changed values in form fields when the user reloads.  Doing
so can be confusing or even cause data-loss when new default values are
specified in the updated document.  For example, when editing an article on
Wikipedia, one loads the edit page for the article, makes and submits
changes, goes back to the edit page to make further modifications, and
reloads to get the new article text.  Before this change, reloading the
edit page would not update the textarea on the page with the new article
source, which can lead one (and has led me) to make changes to the original
version of the article by accident.

This fixes bug 620.
(cherry picked from commit 9e1e94bee0)
2008-06-15 22:49:57 +03:00
Miciah Dashiel Butler Masters
9e1e94bee0 Bug 620: Reset form fields to default values on reload
Do not retain changed values in form fields when the user reloads.  Doing
so can be confusing or even cause data-loss when new default values are
specified in the updated document.  For example, when editing an article on
Wikipedia, one loads the edit page for the article, makes and submits
changes, goes back to the edit page to make further modifications, and
reloads to get the new article text.  Before this change, reloading the
edit page would not update the textarea on the page with the new article
source, which can lead one (and has led me) to make changes to the original
version of the article by accident.

This fixes bug 620.
2008-06-10 06:41:34 +00:00
Miciah Dashiel Butler Masters
86db3461b8 Bug 963: Parse scripts in blocks hidden with "display: none"
Handle <script> blocks even when they are contained by blocks with
"display: none" set.

This commit fixes the second problem that Kalle points out in comment 5
to bug 963.
2008-06-09 13:58:41 +00:00
Miciah Dashiel Butler Masters
cadd2ecc10 Bug 963: Correct reversed logic for document.css.ignore_display_none
When this option is enabled, elements should be rendered even when the CSS
display attribute is "none".  Before this commit, the reverse was true:
when the option was enabled, such elements were _not_ rendered.

I am not changing the default, which is enabled, meaning that by default,
ELinks renders elements regardless of "display: none".  Pasky advocates
that this remain the default until ELinks's CSS support improves.

This commit fixes the first problem that Kalle points out in comment 5 to
bug 963.
2008-06-09 13:58:41 +00:00
Miciah Dashiel Butler Masters
9af30f13b9 Document start_element and end_element 2008-06-09 13:58:41 +00:00
Miciah Dashiel Butler Masters
3c44a88b39 Document the invisible and name members of struct html_element 2008-06-09 13:58:41 +00:00
Witold Filipczyk
232c07aa7f bug 1009: id variables renamed, added document_id to the document.
cached->id => cached->cache_id
document->id => document->cache_id
onload_snippets_owner => onload_snippets_document_id
Added the distinct document->document_id.
Always reset ecmascript when a document changes for example a next chunk
of it is loaded.
2008-04-27 23:22:08 +03:00
Miciah Dashiel Butler Masters
3a0286e447 Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:19:23 +00:00
Miciah Dashiel Butler Masters
643a34e6af Strings corrections from Malcolm Parsons
Fix the spelling and grammar in various comments, variable names, comment
descriptions, and documentation.
2008-01-27 04:09:18 +00:00
Kalle Olavi Niemitalo
dae9b988f6 const in scanner
So that render_dom_document_start() is better assured that
default_colors[] won't be modified by the CSS code.
2008-01-26 18:20:17 +02:00
Kalle Olavi Niemitalo
4138b401ca Merge branch 'elinks-0.12' into elinks-0.13
Conflicts:

	src/document/css/stylesheet.c
	src/document/css/stylesheet.h
2008-01-26 18:15:33 +02:00
Kalle Olavi Niemitalo
cab0b3fbd5 const in CSS 2008-01-26 18:10:13 +02:00
Kalle Olavi Niemitalo
f19c948ca7 Bug 824: Disable combining characters unless --enable-combining.
Label this as an experimental feature because it has so many bugs
and it is not clear how they can be fixed.
2008-01-19 20:58:22 +02:00
Kalle Olavi Niemitalo
14d1a0f3e2 Bug 824: Define _XOPEN_SOURCE, not __USE_XOPEN.
_XOPEN_SOURCE has been standardized in SUSv2.  <features.h> of GNU
libc then defines the internal __USE_XOPEN macro.
2008-01-19 20:52:05 +02:00
Kalle Olavi Niemitalo
2fd3e0b3b3 combined: Leave the screen_char attributes unchanged.
The previous code displayed the wrong attributes if the combining
characters were at the end of an HTML link.  For example:

  <a href="#">trickỹ</a> more text <a href="#">second link</a>

  (The characters in the first A element are "tricky" and U+0303
  COMBINING TILDE.)

Here, when the cursor was not at the first link, ELinks displayed
the y-with-tilde cell as if it were not part of the link.
This happened because ELinks had already changed schar->attr
before set_line saw the space character after the link and
flushed document->combi[].
2008-01-19 20:50:10 +02:00
Witold Filipczyk
83a4d815ae combined: Added combining characters support.
Combining characters requires a UTF-8 locale.
It slows down rendering. There is still the unresolved issue with
combining characters at the end of a document.
This patch wasn't heavilly tested. Especially a "garbage" input may cause
unpredictable results.
2008-01-19 20:49:57 +02:00
Kalle Olavi Niemitalo
04b1e78039 Bug 722: Comment about case-sensitivity of media type names. 2008-01-12 10:08:57 +02:00
Kalle Olavi Niemitalo
d2733656b8 Bug 722: Truncate names of HTML media types.
HTML 4.01 section 6.13 says each entry in the list
must be truncated before the first character that
is not in the allowed set.
2008-01-12 10:08:02 +02:00
Kalle Olavi Niemitalo
65b365587e Bug 722: Read document.css.media only if needed. 2008-01-12 09:37:56 +02:00
Kalle Olavi Niemitalo
0c899dcc8a Bug 722: Default to media="all", not media="screen". 2008-01-12 09:35:41 +02:00
Miciah Dashiel Butler Masters
eb2db32f1e css_hook_css: Fix document.css.media change hook
When document.css.media is changed, make sure to call draw_formatted with rerender = 2 to force a more complete rerendering.
2007-12-22 03:59:34 +00:00
Miciah Dashiel Butler Masters
670d13728a Optionally honour "display: none" (default off)
Because ELinks's CSS support is still so incomplete, some documents still render better if "display: none" is not honoured.  Therefore, it is now honoured, unless document.css.ignore_display_none = 0, which is the default.
2007-12-22 03:59:22 +00:00
Miciah Dashiel Butler Masters
3ee39dae2b css_parse_atrule: Drop an unnecessary check
We have a while loop that checks token && token->type != '}' followed by an if statement that checks token && token->type == }.  If the while loop exits, that either token is false or token->type == '}'; therefore, the if statement need only check token.
2007-12-22 03:25:10 +00:00
Kalle Olavi Niemitalo
60144e9ff6 Bug 722: Filter CSS according to media types.
This patch adds support for:
- option document.css.media
- CSS @import "foo.css" tty;
- CSS @media tty { ... }
- HTML <link rel="stylesheet" media="tty">
- HTML <style media="tty">

This patch is attachments 395 and 396 from bugzilla.elinks.cz, which
are based on attachment 388 from bugzilla.elinks.cz.  This new
version of the patch fixes conflicts with recent 0.13.GIT changes,
marks Doxygen commands with at-signs rather than backslashes, and
adds a few comments.
2007-12-22 03:18:06 +00:00
Laurent MONIN
a35a5c557a Use @cp to shorten the line. 2007-10-15 12:32:25 +02:00
Laurent MONIN
b1eaca1f1e Drop unused variable @options from html_focusable(). 2007-10-15 12:31:16 +02:00
Laurent MONIN
31d8ffc578 In extract_color() and get_color(), make names of variables more explicit.
c -> attribute
r -> retval
at -> value
2007-10-15 12:26:19 +02:00
Laurent MONIN
a1125df95f Make get_bgcolor() use extract_color() instead of get_color().
It prevents a useless test, use_document_fg_colors() is
always true when use_document_bg_colors() is true.
2007-10-15 12:19:46 +02:00
Laurent MONIN
b709061864 Move code from get_color() to new extract_color(). 2007-10-15 12:17:08 +02:00
Laurent MONIN
11dea66ff1 struct table bordercolor,bgcolor -> color.(border|background) 2007-10-12 17:10:30 +02:00
Laurent MONIN
367767c500 struct par_attrib bgcolor -> color.background 2007-10-12 17:04:44 +02:00
Laurent MONIN
f150f22ac9 Use color.background instead of bgcolor in struct document too.
Not useful but coherent with other changes.
2007-10-12 16:50:47 +02:00
Laurent MONIN
bc498c00da struct text_style_color fg,bg -> foreground, background 2007-10-12 16:41:06 +02:00
Laurent MONIN
f8cdb5d472 More anonymous structures were named. 2007-10-12 16:24:41 +02:00
Laurent MONIN
78270c2ac3 Reduce usage of anonymous structures.
Naming them may ease things (ie. debug).
2007-10-12 12:37:28 +02:00
Laurent MONIN
e2a5696f76 active_link.(fg|bg) -> active_link.color.(foreground|background) 2007-10-12 12:24:53 +02:00
Laurent MONIN
8df72685ce Rename struct active_link_options field color to enable_color.
It matches the corresponding option name better.
2007-10-12 12:19:27 +02:00
Laurent MONIN
24605c967e Mark colors in struct document_options by using a new struct for them.
default_(link|vlink|...) -> default_color.(link|vlink|...)
2007-10-12 12:11:31 +02:00
Laurent MONIN
a5548fadd2 Use (correct) type enum form_mode for struct text_attrib field select_disabled. 2007-10-12 11:00:41 +02:00
Laurent MONIN
192c2a9e12 Use parenthesis around macro parameters.
Macros concerned are:
is_inline_element()
is_block_element()
2007-10-12 10:51:49 +02:00
Laurent MONIN
944a8e7bd9 style.(fg|bg) -> style.color.(fg|bg)
Introduce INIT_TEXT_STYLE() macro to initialize struct text_style.
2007-10-10 14:59:15 +02:00
Laurent MONIN
ca6424595b format.(clink|vlink|...) -> format.color.(clink|vlink|...)
It makes more obvious these fields are colors.
2007-10-10 14:37:10 +02:00
Miciah Dashiel Butler Masters
eacd0b4308 Drop extra definition of start_document_refresh
It must have come with the merge.  Doh.
2007-10-09 14:43:38 +00:00
Miciah Dashiel Butler Masters
f2f478eb2f Let CSS selectors select non-pairable elements
This necessitates that non-pairable elements be briefly pushed on the stack, so that get_css_selector_for_element sees them, and then popped.

It would be possible to push them only when CONFIG_CSS is defined, as they are otherwise not needed (as evidenced by the fact that we've gone so long without bothering to push them).  However, the performance hit should be small, the necessary #ifdef/#endif wrappers would be pretty ugly, and ideally, the CSS code will someday be in such a state that it can be considered an integral feature.
2007-10-09 14:14:45 +00:00
Miciah Dashiel Butler Masters
13523248ed Merge commit 'origin/elinks-0.12'
Conflicts:

	po/fr.po
	src/document/dom/renderer.c
	src/document/html/parser.c
	src/document/options.c
	src/document/refresh.c
2007-10-09 14:05:03 +00:00
Kalle Olavi Niemitalo
e2cc0bd434 Don't cast qsort comparison function pointers.
Instead, convert the element pointers inside the comparison functions.

The last argument of qsort() is supposed to be of type
int (*)(const void *, const void *).  Previously, comp_links() was
defined to take struct link * instead of const void *, and the type
mismatch was silenced by casting the function pointer to void *.
This was in principle not portable because:

(1) The different pointer types may have different representations.
    In a word-oriented machine, the const void * might include a byte
    selector while the struct link * might not.

(2) Casting a function pointer to a data pointer can lose bits in some
    memory models.  Apparently this does not occur in POSIX-conforming
    systems though, as dlsym() would fail if it did.

This commit also fixes hits_cmp() and compare_dir_entries(), which
had similar problems.  However, I'm leaving alias_compare() in
src/intl/gettext/localealias.c unchanged for now, so as not to diverge
from the GNU version.

I also checked the bsearch() calls but they were all okay, apart from
one that used the alias_compare() mentioned above.
2007-10-06 23:05:05 +03:00
Laurent MONIN
05fc8f5169 Fix compilation with --disable-css.
Compilation failed due to missing DEBUG_CSS test.
This was introduced in commit 98260f7970
2007-09-24 15:32:42 +02:00
Laurent MONIN
27057926b9 Fix compilation with --disable-css.
Compilation failed due to missing DEBUG_CSS test.
This was introduced in commit 98260f7970
2007-09-21 11:05:40 +02:00
Laurent MONIN
fec10a1846 Revert "format_html_part(): save and restore renderer_context.last_tag_for_newline too."
This reverts commit 60913ba9f9.
This was a bad move, anchors ceased to function correctly.
Reported by Witekfl.
2007-09-19 09:22:44 +02:00
Laurent MONIN
39d9f669c9 Revert "format_html_part(): save and restore renderer_context.last_tag_for_newline too."
This reverts commit 4abce8e363.
This was a bad move, anchors ceased to function correctly.
Reported by Witekfl.
2007-09-19 09:14:53 +02:00
Laurent MONIN
7b6cb249ed Fix compilation using --enable-html-highlight.
It was broken by commit 09cf904814.
Reported by witekfl.
2007-09-17 10:54:52 +02:00
Miciah Dashiel Butler Masters
7033247905 Introduce start_document_refreshes()
start_document_refreshes() performs the NULL-pointer checks that
previously all callers to start_document_refresh() must perform
and then calls start_document_refresh().
2007-09-14 16:44:04 +02:00
Jonas Fonseca
8e3c2d6042 Move find_tag to document/document 2007-09-14 16:29:13 +02:00
Laurent MONIN
f0e66866f5 Trim trailing whitespaces. 2007-09-14 15:12:32 +02:00
Jonas Fonseca
890903a65d Compile fix for commit e876df70d8 2007-09-14 15:08:51 +02:00
Petr Baudis
c1b91c7bf3 document/html: Make HTML parser state transparent
Before, *_html_parser_state() operated with struct html_element *. Now, it is
transparent for the renderer (just void *), so that DOM won't have to provide
this struct but will be able to use something internal.

Backported from master.
2007-09-14 15:06:56 +02:00
Petr Baudis
37b20d998c document/html: Move enum html_special_type from parser.h to renderer.h
...since it is renderer interface.
2007-09-14 15:03:14 +02:00
Laurent MONIN
09cf904814 Backport Pasky's changes concerning text_style-related stuff.
It partially includes changes made in following commits:

document/html: struct text_attrib_style -> struct text_style
commit    e133941206

document: struct format_attr -> struct text_style_format
commit    070d335796

document: Unify text style -> screen attribute handling
commit    b66d2bec67

document: Move text_style-related stuff to dedicated format.*
commit    db9431465f
2007-09-14 14:59:37 +02:00
Laurent MONIN
d6bb586a00 format_html_part(): group int variables declarations 2007-09-14 10:11:44 +02:00
Laurent MONIN
60913ba9f9 format_html_part(): save and restore renderer_context.last_tag_for_newline too. 2007-09-14 10:10:37 +02:00
Laurent MONIN
e914ca85fe Use explicit names for variables in format_html_part().
llm -> saved_last_link_to_move
ltm -> saved_last_tag_to_move
ef  -> saved_empty_format
lm  -> saved_margin
2007-09-14 10:10:09 +02:00
Laurent MONIN
419cd4775e format_html_part(): group int variables declarations 2007-09-14 10:07:32 +02:00
Laurent MONIN
4abce8e363 format_html_part(): save and restore renderer_context.last_tag_for_newline too. 2007-09-14 09:59:34 +02:00
Laurent MONIN
a6f3323a4b Use explicit names for variables in format_html_part().
llm -> saved_last_link_to_move
ltm -> saved_last_tag_to_move
ef  -> saved_empty_format
lm  -> saved_margin
2007-09-14 09:55:43 +02:00
Laurent MONIN
75d47ef957 Drop useless goto/label. 2007-09-14 09:41:51 +02:00
Laurent MONIN
73b1f43468 Drop useless goto/label. 2007-09-14 09:26:39 +02:00
Laurent MONIN
6e89b39ed0 Fix get_opt_bool() call and finish backport of process_head() split. 2007-09-12 23:51:43 +02:00
Miciah Dashiel Butler Masters
bd0a6f6f7d Reflow check_head_for_cache_control 2007-09-12 23:41:37 +02:00
Miciah Dashiel Butler Masters
deb74bd1bd Factor check_head_for_cache_control out of process_head 2007-09-12 23:41:17 +02:00
Miciah Dashiel Butler Masters
4b297a5b03 Factor check_head_for_refresh out of process_head 2007-09-12 23:38:41 +02:00
Miciah Dashiel Butler Masters
23262b3145 Fix process_head to check for cache-control information even if no refresh
Previously, process_head immediately returned if there was no refresh, never giving the cache-control check further down a chance to run.

Also add new tests:

   nocache.html
   refresh+nocache.html
2007-09-12 23:33:40 +02:00
Laurent MONIN
5b28e89026 Extend Use of LWS() macro to parse_old_meta_refresh(). 2007-09-11 17:57:19 +02:00
Laurent MONIN
41ece7a758 Make meta refresh content attribute parsing more tolerant.
Simply search for 'url' marker ignoring anything
before it.
ELinks is now able to follow incorrectly written
meta refresh content attribute with missing ; before
url= parameter.
As an example, try http://akkada.tivi.net.pl/
2007-09-11 17:55:10 +02:00
Laurent MONIN
d650a434b2 Extend Use of LWS() macro to parse_old_meta_refresh(). 2007-09-11 09:30:26 +02:00
Laurent MONIN
4a6a6909ea Make meta refresh content attribute parsing more tolerant.
Simply search for 'url' marker ignoring anything
before it.
ELinks is now able to follow incorrectly written
meta refresh content attribute with missing ; before
url= parameter.
As an example, try http://akkada.tivi.net.pl/
2007-09-08 21:03:22 +02:00
Miciah Dashiel Butler Masters
dbacc9ead2 Support document refresh in frames
Introduce reload_frame, which takes a frame @name argument in addition to the arguments that reload takes.
2007-09-06 20:47:17 +00:00
Miciah Dashiel Butler Masters
2676fcc2cd do_document_refresh: take document_view instead of session 2007-09-06 19:14:35 +00:00
Miciah Dashiel Butler Masters
66d62ca11b start_document_refresh: take document_view instead of session 2007-09-06 19:13:25 +00:00
Miciah Dashiel Butler Masters
a1a8696cce Introduce start_document_refreshes
start_document_refreshes performs the NULL-pointer checks that previously all callers to start_document_refresh must perform and then calls start_document_refresh.
2007-09-06 18:52:23 +00:00
Miciah Dashiel Butler Masters
a8f28f21c9 Reflow check_head_for_cache_control 2007-09-04 12:13:20 +00:00
Miciah Dashiel Butler Masters
2a2aad15f9 Factor check_head_for_cache_control out of process_head 2007-09-04 12:11:37 +00:00
Miciah Dashiel Butler Masters
fc12376bf5 Factor check_head_for_refresh out of process_head 2007-09-04 12:09:19 +00:00
Miciah Dashiel Butler Masters
2d0180d1e7 Fix process_head to check for cache-control information even if no refresh
Previously, process_head immediately returned if there was no refresh, never giving the cache-control check further down a chance to run.

Also add new tests:

   nocache.html
   refresh+nocache.html
2007-09-04 12:08:08 +00:00
Witold Filipczyk
7f49eda39e DOM renderer: off by one error. 2007-09-02 20:44:36 +00:00
Jonas Fonseca
5d34b4bff6 Move find_tag to document/document 2007-08-31 15:43:54 +02:00
Miciah Dashiel Butler Masters
3dbdde0f8f Fix RSS rendering
Fix inverted boolean logic from commit 8e954e9f61 'rss: check for allocation failure of struct rss_renderer' that totally broke RSS rendering.
2007-08-31 00:08:19 +00:00
Miciah Dashiel Butler Masters
f04bc1c7d1 init_template_by_style: collapse some case statements
After commit b66d2bec67 'document: Unify text style -> screen attribute handling', the case statements for CSS_PT_FONT_WEIGHT, CSS_PT_FONT_STYLE, and CSS_PT_TEXT_DECORATION all have common code and therefore collapse nicely.
2007-08-30 23:31:20 +00:00
Miciah Dashiel Butler Masters
0e0bacf0d3 Merge branch 'master' of ssh://pasky.or.cz/srv/git/elinks
Conflicts:

	src/document/options.c
2007-08-30 21:13:43 +00:00
Miciah Dashiel Butler Masters
91947860f2 Check session- and domain-specific settings for many options
Pass the session with some get_opt_* calls.  These are the low-hanging fruit.  Some places will be difficult because we don't have the session or for other reasons.
2007-08-30 21:11:51 +00:00
Miciah Dashiel Butler Masters
5ada24f3ef update_cache_document_options: take @ses and pass it to get_opt calls
change_hook_active_link: pass update_cache_document_options @ses.

Now when changing the global settings, it will not simply copy the new values for the global settings to the document-options cache, but also check session-specific settings.  This doesn't really matter yet, since the options in question can't be set on a per-session basis, but is in preparation for future changes.
2007-08-30 19:19:57 +00:00
Jonas Fonseca
19f3fd686c Compile fix for commit e876df70d8 2007-08-29 20:51:43 +02:00
Jonas Fonseca
8e954e9f61 rss: check for allocation failure of struct rss_renderer 2007-08-29 12:05:10 +02:00
Jonas Fonseca
6ebcce0655 rss: document the rss_renderer members 2007-08-29 12:02:36 +02:00
Jonas Fonseca
f2db9c07ed rss: remove the horrible text collection code which didn't do anything 2007-08-29 11:27:54 +02:00
Jonas Fonseca
86ffd94237 rss: simplify rendering to be done while parsing 2007-08-29 11:21:06 +02:00
Jonas Fonseca
0a5ee2d3de rss: move the rendering code above the push/pop handlers 2007-08-29 02:29:58 +02:00
Jonas Fonseca
51fec0ec52 rss: rename rss_renderer variables from data to rss 2007-08-29 02:26:53 +02:00
Jonas Fonseca
16a4110467 rss: minor cleanups 2007-08-29 02:15:06 +02:00
Jonas Fonseca
19b271e417 rss: remove check for rss_renderer->text that is already done above 2007-08-29 02:13:26 +02:00
Jonas Fonseca
8c4191fe87 rss: assert that node->parent is always set 2007-08-29 02:13:10 +02:00
Petr Baudis
6b05ddb762 Remove unnecessary document/html/parser.h includes 2007-08-29 00:08:05 +02:00
Petr Baudis
e876df70d8 document/html: Make HTML parser state transparent
Before, *_html_parser_state() operated with struct html_element *. Now, it is
transparent for the renderer (just void *), so that DOM won't have to provide
this struct but will be able to use something internal.
2007-08-28 23:35:00 +02:00
Petr Baudis
e5539a9937 document/html: Move enum html_special_type from parser.h to renderer.h
...since it is renderer interface.
2007-08-28 22:19:33 +02:00
Petr Baudis
a74af825e2 document/dom/rss.c: Add extra styles
Style aux got split to styles author, author-date-sep and date.
2007-08-28 21:34:32 +02:00
Petr Baudis
b457af1984 document/dom/source.c: Trivial simplification 2007-08-28 21:31:49 +02:00
Petr Baudis
baeb0cb0d5 document/dom: Move stylesheet parsing out of style loop
...for better clarity of the document initialization functions.
2007-08-28 21:31:25 +02:00
Petr Baudis
a9619bce80 document/renderer.c: Fix description 2007-08-28 21:28:32 +02:00
Petr Baudis
dc0cf23631 document/dom: Simplify init_template_by_style() usage
It doesn't take the useless styling information but just uses options->default_style.
2007-08-28 21:28:03 +02:00
Petr Baudis
55495ab655 document: Turn options' default_fg, default_bg to default_style
...as struct text_style. This way it might be possible later to
add other default formatting attributes by CSS and it allows
quite a code simplification in the DOM renderer.
2007-08-28 21:16:44 +02:00
Petr Baudis
db9431465f document: Move text_style-related stuff to dedicated format.*
We will need to include it from options.h and the include chain just
wouldn't work. And it feels like a hack to have it in renderer.h anyway.
2007-08-28 21:05:00 +02:00
Petr Baudis
b66d2bec67 document: Unify text style -> screen attribute handling
Currently, all DOM, HTML and plain renderers had their own routine for
conversion from text style to screen attribute. This moves text_style and
text_style_format from html/parser.h to renderer.h and introduces new generic
routine get_screen_chracter_template() that is used by all the specific
rendering engines.
2007-08-28 21:02:08 +02:00
Petr Baudis
38ee8a137c document/dom/util.*: Make init_template() private 2007-08-28 20:32:15 +02:00
Petr Baudis
070d335796 document: struct format_attr -> struct text_style_format 2007-08-28 20:17:53 +02:00
Petr Baudis
e133941206 document/html: struct text_attrib_style -> struct text_style 2007-08-28 20:15:30 +02:00
Petr Baudis
46e44f9298 document/dom: Move renderer-specific data from the generic struct dom_renderer
This is hopefully the final step to have the specific renderers completely
separated and self-contained.
2007-08-28 19:58:08 +02:00
Petr Baudis
91e512cca8 document/dom: Move URL regexp setup from general code to source renderer 2007-08-28 19:40:30 +02:00
Petr Baudis
afb9b6daa5 document/dom: Move styles initialization out of init_dom_renderer()
Now, CSS is initialized separately for each of the renderers, so that
also RSS doesn't just choose styles of random DOM node types.

init_template_by_style() is introduced as the common backend for
loading CSS properties.
2007-08-28 19:38:13 +02:00
Miciah Dashiel Butler Masters
fa12b10e26 Introduce session- (tab-)specific options
Introduce session-specific options for those options that have toggle-... actions.
2007-08-28 17:29:41 +00:00
Miciah Dashiel Butler Masters
ea372bd0cd get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
2007-08-28 17:24:59 +00:00
Petr Baudis
494e4a1019 document/dom/rss.c: Explain what normalizing is
As insighted by Jonas.
2007-08-28 18:12:41 +02:00
Petr Baudis
2480d1ae0a Merge branch 'master' of /srv/git/elinks 2007-08-28 17:43:14 +02:00
Petr Baudis
445a0ae600 document/dom: Some symbols should be static 2007-08-28 17:43:01 +02:00
Petr Baudis
4003e6decf document/dom: Split SGML (HTML) source renderer to source.* 2007-08-28 17:41:55 +02:00
Petr Baudis
556ae45b00 document/dom: Split RSS renderer to rss.* 2007-08-28 17:33:22 +02:00
Petr Baudis
144bd77240 document/dom: Split rendering utilities to util.*
These are functions that are commonly used by the individual renderers to put stuff on the canvas etc.
2007-08-28 17:12:23 +02:00
Miciah Dashiel Butler Masters
3975d28bce Merge commit 'origin/elinks-0.12'
Conflicts:

	doc/Doxyfile.in
	src/protocol/bittorrent/common.h
2007-08-28 14:47:39 +00:00
Miciah Dashiel Butler Masters
80259bc53e Revert "justify_line(): Re-add wordlen == 0 test"
This reverts commit 18cdce6c39.

elinks-0.12 has a different fix, and I will soon merge in that branch.
2007-08-28 13:41:14 +00:00
Petr Baudis
f88f49d955 document/dom: Explain that only renderer lives here 2007-08-28 15:15:13 +02:00
Petr Baudis
18cdce6c39 justify_line(): Re-add wordlen == 0 test
This fixes ELinks crashing on this with terminal width e.g. 103:

	<p align="justify">
	xxxx xxxx xxxx xxxxx xxxxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx xxxxx
	xxxxx xxxx xxxxxxx xxx xxxxxxx xxx xxxx xxxx xxxx xx xxxx x xxx xxxx
	xxxx xx xxxx xxxx xxxx xxx&mdash;xxx xxxx xx&mdash;xxx xxxx<em> </em>x
	xxxx </p>

This test was removed for an unknown reason in commit
b1cc717789.

Discovered together with Miciah.
2007-08-26 19:06:26 +02:00
Kalle Olavi Niemitalo
870df797cf Doxygen: Escape some HTML tags. 2007-07-31 13:48:20 +03:00
Kalle Olavi Niemitalo
76c6f38169 Doxygen: Begin commands with @ not \. 2007-07-31 13:47:12 +03:00
Kalle Olavi Niemitalo
0cb047b298 Bug 968: Don't use copy_chars in justify_line.
All the needed memory has been allocated before the loop so we can use
copy_screen_chars() directly.  This avoids the assertion failure in
copy_chars() for width==0 and should be a bit faster too.  According
to ISO/IEC 9899:1999 7.21.1p2, memcpy() doesn't copy anything if n==0
(but the pointers must be valid).
(original 'git cherry-pick' arguments: cherry-pick bug968-att394)
2007-07-30 16:43:46 +03:00
Kalle Olavi Niemitalo
2437d35904 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13
There were conflicts in src/document/css/ because 0.12.GIT switched
to LIST_OF(struct css_selector) and 0.13.GIT switched to struct
css_selector_set.  Resolved by using LIST_OF(struct css_selector)
inside struct css_selector_set.
2007-07-28 03:22:29 +03:00
Kalle Olavi Niemitalo
297ad024c3 const in css_appliers[] 2007-07-28 02:38:11 +03:00
Kalle Olavi Niemitalo
80f5ec1827 Doxygenate src/document/css/ 2007-07-28 02:35:36 +03:00
Kalle Olavi Niemitalo
a26db3948a Doxygenate src/document/ (but not subdirs) 2007-07-28 02:34:59 +03:00
Kalle Olavi Niemitalo
96176a8c77 Declare element types of lists. 2007-07-26 22:47:23 +03:00
Kalle Olavi Niemitalo
d3d2bb26c5 New macro LIST_OF for better Doxygen support. 2007-07-26 22:45:51 +03:00
Kalle Olavi Niemitalo
585f8b426b Doxygen syntax fixes
Fix warnings:
dom/stack.h:70: Warning: explicit link request to 'pop_dom_node' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_nodes' could not be resolved
dom/stack.h:71: Warning: explicit link request to 'pop_dom_state' could not be resolved
dom/stack.h:115: Warning: explicit link request to 'done_dom_node' could not be resolved

Use @returns instead of \return in src/document/css/parser.c,
and other such things.
2007-07-26 14:14:27 +03:00
Kalle Olavi Niemitalo
ab9e0821d6 Merge commit 'pasky.or.cz/elinks-0.12' into elinks-0.13 2007-07-22 18:48:45 +03:00
Kalle Olavi Niemitalo
64da6774c2 CSS: Count nested blocks when skipping.
When skipping "@media print { #foo {bar: baz} pre {white-space: normal} }",
the previous code would look for the first "{" and then the first "}", and
fail to skip the "pre" rule.  Seen at support.microsoft.com.

I originally posted this change as part of attachment 383 to bug 722.
2007-07-22 16:51:04 +03:00
Kalle Olavi Niemitalo
b1cc717789 Preserve underlines in links when justifying. 2007-07-20 17:57:01 +03:00
Kalle Olavi Niemitalo
275402f43c CSS: Fix parent selectors broken in the previous commit. 2007-07-16 01:42:15 +03:00
Kalle Olavi Niemitalo
591ff81890 CSS bug 766: Scan ancestor elements only if needed.
time elinks -no-connect -no-home 'http://rss.slashdot.org/Slashdot/slashdot/to?m=5878'
Wait until finished loading, then press q and Enter.

before	6.45user 0.17system 0:11.34elapsed 58%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3387minor)pagefaults 0swaps
after	5.51user 0.14system 0:09.85elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3469minor)pagefaults 0swaps
before	5.86user 0.17system 0:10.58elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3504minor)pagefaults 0swaps
after	5.50user 0.15system 0:10.96elapsed 51%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3645minor)pagefaults 0swaps
before	6.40user 0.14system 0:11.85elapsed 55%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3640minor)pagefaults 0swaps
after	6.17user 0.12system 0:10.80elapsed 58%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3378minor)pagefaults 0swaps
before	5.80user 0.14system 0:10.29elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3632minor)pagefaults 0swaps
after	5.56user 0.16system 0:10.08elapsed 56%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3569minor)pagefaults 0swaps
before	5.92user 0.14system 0:10.54elapsed 57%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3570minor)pagefaults 0swaps
after	5.52user 0.13system 0:10.10elapsed 55%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3515minor)pagefaults 0swaps

All in all, it is doubtful whether this change is worth the complexity.
Please go ahead and revert if you think it isn't.
2007-07-16 00:29:06 +03:00
Kalle Olavi Niemitalo
ace03d5093 CSS: new struct css_selector_set 2007-07-16 00:28:49 +03:00
Kalle Olavi Niemitalo
8097929290 Merge with #elinks-0.12 2007-07-16 00:18:17 +03:00
Kalle Olavi Niemitalo
98260f7970 CSS bug 766: Parse the id and class attributes in advance.
time elinks -no-connect -no-home 'http://rss.slashdot.org/Slashdot/slashdot/to?m=5878'
Wait until finished loading, then press q and Enter.

before	19.96user 0.16system 0:25.97elapsed 77%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3630minor)pagefaults 0swaps
after	6.46user 0.12system 0:12.66elapsed 52%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3630minor)pagefaults 0swaps
before	18.02user 0.19system 0:23.86elapsed 76%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3572minor)pagefaults 0swaps
after	5.73user 0.15system 0:10.02elapsed 58%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3628minor)pagefaults 0swaps
before	19.80user 0.15system 0:25.14elapsed 79%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3461minor)pagefaults 0swaps
after	6.28user 0.13system 0:11.91elapsed 53%CPU (0avgtext+0avgdata 0maxresident)k
	0inputs+0outputs (0major+3626minor)pagefaults 0swaps
2007-07-15 22:19:30 +03:00
Kalle Olavi Niemitalo
5d468daf83 CSS: Document reparent_selector and make it static. 2007-07-15 19:54:22 +03:00
Kalle Olavi Niemitalo
ef815d5e25 CSS: Don't call list_empty within args of DBG. 2007-07-15 15:56:33 +03:00
Kalle Olavi Niemitalo
455432fd0b CSS: Move /* #define DEBUG_CSS */ to stylesheet.h.
That's where src/document/css/README says it should be.
2007-07-15 15:56:14 +03:00
Witold Filipczyk
438f039bda check_html_form_hierarchy: Old code was buggy.
Old code caused the assertion failure on the shutdownday's page.
2007-07-10 15:22:47 +03:00
Kalle Olavi Niemitalo
eccc8c23f0 Merge with http://elinks.cz/elinks.git#elinks-0.12 2007-07-09 16:03:06 +03:00
Kalle Olavi Niemitalo
c2ca46cb81 Bug 461: Ensure contrast when filling with spaces.
So that the cursor will be visible in the Linux console.
2007-05-20 19:23:33 +03:00
Kalle Olavi Niemitalo
45d1750d03 Bug 914: Don't let UTF-8 I/O affect internal representations.
Use it for the actual I/O only.  Previously, defining CONFIG_UTF8 and
enabling UTF-8 used to force many strings to the UTF-8 charset
regardless of the terminal charset option.  Now, those strings always
follow the terminal charset.  This fixes bug 914 which was caused
because _() returned strings in the terminal charset and functions
then assumed they were in UTF-8.  This reduction in the effects of
UTF-8 I/O may also simplify future testing.
2007-05-20 15:31:02 +03:00
Kalle Olavi Niemitalo
f8f99cc04e put_link_line: Add a comment related to bug 213. 2007-05-13 12:11:17 +03:00
Witold Filipczyk
30a502cb8c DOM renderer: One byte too much. 2007-05-01 18:06:07 +02:00
Kalle Olavi Niemitalo
68ff5a8d61 Bug 816, html_textarea: Expand entity references.
Because the renderer no longer does that.
The comment "We don't cope well with entities here" may now be
obsolete but I'm not sure about that so I'm leaving it in.
2007-04-30 02:10:25 +03:00
Kalle Olavi Niemitalo
a58345f4e7 html_textarea: Use memmove rather than memcpy.
This is an overlapping copy and memcpy is not required to support that.
2007-04-30 01:41:32 +03:00
Kalle Olavi Niemitalo
bafe47508d Bug 784: Add html_context->doc_cp and parse attributes with it.
options->cp is still used for this in seven places where html_context
is not easily available.  Those should eventually be corrected too,
but I'm checking this change in already because it's better than what
we had before.
2007-04-30 00:56:39 +03:00
Kalle Olavi Niemitalo
5e83337d49 Bug 784: Keep form_control.default_value in the document charset.
Previously, html_special_form_control converted
form_control.default_value to the terminal charset, and init_form_state
then copied the value to form_state.value.  However, when CONFIG_UTF8
is defined and UTF-8 I/O is enabled, form_state.value is supposed to
be in UTF-8, rather than in the terminal charset.

This mismatch could not be conveniently fixed in
html_special_form_control because that does not know which terminal is
being used and whether UTF-8 I/O is enabled there.  Also, constructing
a conversion table from the document charset to form_state.value could
have ruined renderer_context.convert_table, because src/intl/charsets.c
does not support multiple concurrent conversion tables.

So instead, we now keep form_control.default_value in the document
charset, and convert it in the viewer each time it is needed.  Because
the result of the conversion is kept in form_state.value between
incremental renderings, this shouldn't even slow things down too much.

I am not implementing the proper charset conversions for the DOM
defaultValue property yet, because the current code doesn't have
them for other string properties either, and bug 805 is already open
for that.
2007-04-29 22:01:13 +03:00
Kalle Olavi Niemitalo
487a047264 Document the meaning of document_options.cp.
Miciah provided part of the text.
2007-04-29 21:28:40 +03:00
Laurent Monin
084d402c51 Bug 816, html_special_form_control: Don't parse character entity references. 2007-04-29 21:25:42 +03:00
Kalle Olavi Niemitalo
ce05aa1f37 Bug 947, set_hline: Also recognize NBSP_CHAR #ifndef CONFIG_UTF8. 2007-04-26 23:46:03 +03:00
Laurent MONIN
0b98c5051b Fix trailing whitespaces 2007-04-26 15:02:04 +02:00
Kalle Olavi Niemitalo
0b7a56f89a Bug 947, set_hline: Respect wrap_nbsp also if !part->document.
This does not yet fix bug 947 for the case where the document is UTF-8
and the terminal is ISO-8859-1.  That will require changing charsets.c
too, it seems.
2007-04-26 07:48:11 +03:00
Kalle Olavi Niemitalo
fa9567653d set_hline: Outdent some code. 2007-04-26 07:38:37 +03:00
Kalle Olavi Niemitalo
0c3a871a4b Bug 879, set_hline: Discard U+00AD SOFT HYPHEN characters if UTF-8.
If not UTF-8, then charsets.c has already discarded them.
2007-04-26 07:12:28 +03:00
Kalle Olavi Niemitalo
443db69980 Don't mark undisplayed names of modules for translation.
Exclude unneeded header files.  This partially reverts commit
90980a944e, with permission.
2007-03-23 00:51:56 +02:00
Laurent MONIN
90980a944e Mark all module names for translation and include needed header files. 2007-03-21 11:01:06 +01:00
Witold Filipczyk
e347122e6d get_attr_value: do not do trim_chars
trim_chars was called only in debug mode and the results of the get_attr_val
for value=" something " in debug mode differ from normal and fastmem mode.

[ From commit c4500039b2 on the witekfl
  branch.  --KON ]
2007-03-18 13:32:25 +02:00
Kalle Olavi Niemitalo
7645a836fc Cast the NULL argument of straconcat to unsigned char *.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).

Many places pass string literals of type char * to straconcat.  This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.
2007-03-11 12:59:11 +02:00
Kalle Olavi Niemitalo
22af2b22e2 Cast variadic arguments of add_to_ml to void *.
getml reads the args with va_arg(ap, void *), and the NULL macro in
particular may have the wrong type.
2007-03-11 12:44:13 +02:00
Kalle Olavi Niemitalo
801d520ddd Fix compiler errors without HAVE_VARIADIC_MACROS. 2007-03-11 12:22:02 +02:00
Witold Filipczyk
27a66f59d9 Fix the memleak. Part II of the 927 bugfix. 2007-02-25 11:02:53 +02:00
Witold Filipczyk
e01785e462 The fix for the bug 927.
When tables were rendered first time html_format_part was called with
document==NULL. <meta http-equiv=Refresh.../> was inside a table,
so document was NULL. Second time the table knew its dimensions
and document was not NULL.
2007-02-25 11:02:48 +02:00
Kalle Olavi Niemitalo
408d86f2b1 Remove temporary indentation left in the previous commit. 2007-01-30 10:27:57 +02:00
Kalle Olavi Niemitalo
ebf549ba77 Fix document.html.wrap_nbsp in UTF-8 terminals.
!CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
!CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
!CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (drawn as "\001").
!CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (not wrapped).
CONFIG_UTF8, ISO-8859-1 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
CONFIG_UTF8, ISO-8859-1 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, A0 ok
CONFIG_UTF8, ISO-8859-1 doc, UTF-8 terminal, UTF-8 I/O:
  all fail (not wrapped); after patch all ok.
CONFIG_UTF8, UTF-8 doc, ASCII terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (drawn as "\001").
CONFIG_UTF8, UTF-8 doc, ISO-8859-1 terminal, UTF-8 or unibyte I/O:
  &nbsp; ok, &#160; ok, &#xA0; ok, C2 A0 fail (not wrapped)
CONFIG_UTF8, UTF-8 doc, UTF-8 terminal, UTF-8 I/O:
  all fail (not wrapped); after patch all ok.
2007-01-30 10:21:12 +02:00
Kalle Olavi Niemitalo
419857dce6 set_hline: Add some comments. 2007-01-29 21:07:13 +02:00
Kalle Olavi Niemitalo
4adcae682f change_hook_css: Don't use the ses parameter.
It might be NULL.
2007-01-27 22:33:02 +02:00
Kalle Olavi Niemitalo
22f7468013 Make arrays of option change hooks const. 2007-01-27 19:00:47 +02:00
Kalle Olavi Niemitalo
a287f547fd set_hline: Add a FIXME comment about invalid UTF-8. 2006-12-26 14:59:16 +02:00
Kalle Olavi Niemitalo
cd10da6f31 Bug 912, set_hline: Don't let LINE(y).length remain larger than needed. 2006-12-26 14:51:42 +02:00
Kalle Olavi Niemitalo
26cce9aab3 Bug 912, realloc_line: Return the original line->length if successful.
This will let the caller restore the length if it notices it has
allocated too much space.
2006-12-26 14:38:58 +02:00
Kalle Olavi Niemitalo
819653836a Bug 912: Callers of realloc_line treat only values < 0 as errors.
This will let me change realloc_line to return the original length.
2006-12-26 14:37:08 +02:00
Kalle Olavi Niemitalo
6b68d38131 set_hline: Define local variables as const where possible.
I hope this makes the source easier to understand.
2006-12-26 14:27:50 +02:00
Kalle Olavi Niemitalo
f396abcf19 Bug 902: set_hline: Assert that we didn't go past end of array.
This assertion detects the overflow that manifested as bug 902.
2006-12-20 23:19:24 +02:00
Kalle Olavi Niemitalo
47f7ba24c6 Bug 902: set_hline: Allocate memory for one more character cell. 2006-12-20 22:04:41 +02:00
Kalle Olavi Niemitalo
a1fe5cf975 Bug 826, UTF-8 set_hline: Don't skip the character after double-cell.
I do not fully understand this code, but I am sure skipping characters
like this is a bug, and correcting it seems to fix bug 826 (too small
table for double-cell characters).  I don't see any similar bugs in
other parts of set_hline.

The patch is from bug 826, comment 4, attachment 308.  The warning
there about unicode_to_cell(UCS_NO_CHAR) still applies but this patch
does not make the situation worse.  I have logged a separate bug 901
about those calls.
2006-12-17 18:13:28 +02:00
Kalle Olavi Niemitalo
a193632187 Make html_context.quote_level unsigned.
Continuation of 7e9fc6f33b.
2006-12-10 14:14:16 +02:00
Miciah Dashiel Butler Masters
e523504424 Add .cached to struct document
This allows code to use document->cached instead of
find_in_cache(document->uri), thereby increasing the likelihood
of getting the correct cache entry.

This should fix Bug 756 - "assertion (cached)->object.refcount >= 0 failed"
after HTTP proxy was changed.

Patches for this were written by me and then later by Jonas.
This commit combines our independent implementations.
2006-12-10 03:11:04 +00:00
Miciah Dashiel Butler Masters
1442f551aa Simplify init_dom_renderer, drop get_css_property 2006-12-08 15:02:59 +00:00
Kalle Olavi Niemitalo
bddafe5f7e Document how timer callbacks erase timer IDs; add some assertions.
Tangential to bug 868.
2006-12-02 18:35:03 +02:00
Jonas Fonseca
9d43babde2 Fix out-of-bound access to the quote_char buffer
The quote_level was decremented unconditionally and could become negative
resulting in a negative index after applying "modulus 2". Reproducable
with an HTML file contianing "</q>".

Reported by paakku.
2006-11-26 22:32:02 +01:00
Kalle Olavi Niemitalo
c283b128b6 Bug 387: Treat &#013; inside <pre>...</pre> as a newline.
Recognize all of &#13; &#10; &#xA; &#xD; with any number of leading
zeroes.  (Previously only &#13; and &#x0A; were supported.)  All of
these are case insensitive.

Treat each CR+LF combination (&#13;&#10;) as a single newline.
2006-11-11 20:31:25 +02:00
Petr Baudis
b8d8d27df4 Fix spurious gcc warning 2006-11-03 19:22:14 +01:00
Miciah Dashiel Butler Masters
061e3aeab5 Eliminate one more unnecessary recomputation in the plaintext parser 2006-11-01 06:38:31 +00:00
Miciah Dashiel Butler Masters
2430de30f4 Eliminate some unnecessary recomputation in the plaintext parser 2006-11-01 01:35:47 +00:00
Miciah Dashiel Butler Masters
d0d03d37bb Fix overflow in the plaintext parser
Remove a bogus cell++ that was added in commit
161ccf9eae. This fixes an overflow when
loading binary files, which was making pasky sad.
2006-11-01 01:19:50 +00:00
Kalle Olavi Niemitalo
1c5db85b1a Bug 821: Document the charsets of buffers for BFU and form input fields. 2006-10-25 19:46:01 +03:00
Witold Filipczyk
2fe0623298 Moved the setTimeout timer to the struct document. 2006-10-24 16:47:41 +02:00
Miciah Dashiel Butler Masters
3041ef5ff1 Use foreachbacksafe in shrink_format_cache
I hope that it isn't too confusing to re-use the local variable next
with foreachbacksafe.
2006-10-20 23:10:35 +00:00
Witold Filipczyk
461787013b Revert commit 7cb91c3213. Doble glyphs should
be displayed correctly.
2006-10-01 16:08:52 +02:00
Kalle Olavi Niemitalo
92cb452a9e Rename CONFIG_UTF_8 to CONFIG_UTF8.
The configure script no longer recognizes "CONFIG_UTF_8=yes" lines
in custom features.conf files.  They will have to be changed to
"CONFIG_UTF8=yes".  This incompatibility was deemed acceptable
because no released version of ELinks supports CONFIG_UTF_8.

The --enable-utf-8 option was not renamed.
2006-09-17 16:12:47 +03:00
Kalle Olavi Niemitalo
e8462980e5 Change "utf_8" to "utf8" in most identifiers.
Suggested by Miciah on #elinks.

What was renamed:
  add_utf_8                      => add_utf8
  cp2utf_8                       => cp2utf8
  encode_utf_8                   => encode_utf8
  get_translation_table_to_utf_8 => get_translation_table_to_utf8
  goto invalid_utf_8_start_byte  => goto invalid_utf8_start_byte
  goto utf_8                     => goto utf8
  goto utf_8_select              => goto utf8_select
  terminal_interlink.utf_8       => terminal_interlink.utf8
  utf_8_to_unicode               => utf8_to_unicode

What was not renamed:
  terminal._template_.utf_8_io option, TERM_OPT_UTF_8_IO
    Compatibility with existing elinks.conf files would require an alias.
  --enable-utf-8
    Because the name of the charset is UTF-8, --enable-utf-8 looks better
    than --enable-utf8.
  CONFIG_UTF_8
    Will be renamed in a later commit.
  Unicode/utf_8.cp, table_utf_8, aliases_utf_8
    Will be renamed in a later commit.
2006-09-17 16:06:22 +03:00
Kalle Olavi Niemitalo
8850d85998 ECMAScript: If accessKey is a surrogate, throw an error when reading it.
Surrogates are now treated the same way as out-of-range characters
like U+110000; if a link has such an access key, then the ECMAScript
accessKey property cannot be read.  It seems currently impossible to
set such an access key though, because accesskey_string_to_unicode()
doesn't support multibyte characters yet.
2006-08-27 11:45:11 +03:00
Witold Filipczyk
a5c395cd7a Workaround for segfaults introduced by previous commit.
Why html_context->part->document isn't set ?
2006-08-05 20:17:48 +02:00
Witold Filipczyk
b7409fc5a7 The fix for bug 784. There is a wide area to cleanup and tidy up the code. 2006-08-05 18:32:05 +02:00
Witold Filipczyk
bdc3fcb7e4 I forgot about this one 2006-08-05 18:08:52 +02:00
Witold Filipczyk
049d088e8a The massive attack: the only property of options used by get_attr_val was
cp (codepage). To fix bug 784 html_context->part->document->cp should
be passed to get_attr_val instead of html_context->options->cp.
2006-08-05 18:06:28 +02:00
Miciah Dashiel Butler Masters
948d010088 Drop obsolete, commented-out code in put_chars
Drop some code for superscript and subscript handling that was deleted
in commit 65016cdca4, then added back
with the UTF-8 merge in commit 2a6125e3d0,
and then disabled in commit 1b653b9765.
2006-08-03 06:12:30 +00:00
Witold Filipczyk
7af9cf5ebc The missing line:
cells += added_chars - 1;
This is a fix for bug 778.
goto next instead of continue. Not heavilly tested
2006-07-28 22:33:16 +02:00
Laurent MONIN
1136aefb71 Trim trailing whitespaces. 2006-07-27 09:51:10 +02:00
Witold Filipczyk
8b4daed148 Commented out the code causing infinite loop when viewing
test/backspaces.txt.
2006-07-23 16:35:53 +02:00
Witold Filipczyk
58b158871c Decode the second char of double glyph. Still problems with a splitted
char
2006-07-23 13:14:38 +02:00
Witold Filipczyk
7cb91c3213 Decode the second char from double glyph. When that char is splitted
by convert_string and that char is the beginning of double glyph too
we have a problem. This is a rare case. Must we care about it?
2006-07-23 13:04:39 +02:00
Witold Filipczyk
a3e0caca57 Return number of really processed chars. In that case 0 2006-07-23 12:27:20 +02:00
Witold Filipczyk
f5351fc0dc Remember fragment of the splitted char and decode it next time. Idea by Jonas.
Not tested at all. UCS_NO_CHAR is returned only for <hr> or for UTF-8 char
which is splitted by convert_string
2006-07-21 22:10:18 +02:00
Witold Filipczyk
7c7a0bb890 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-07-21 19:00:49 +02:00
Witold Filipczyk
1b653b9765 Compilation fix 2006-07-21 13:21:21 +02:00
Witold Filipczyk
2a6125e3d0 Merge with utf8. src/document/plain/renderer.c replaced by utf8 version 2006-07-21 13:12:06 +02:00
Miciah Dashiel Butler Masters
ecbc2271d1 examine_element: drop html_stack parameter
The stack is available via the html_context, which is passed to
examine_element as of commit f42c86be70744e62af92282e4d64fc3066f6ba04.
2006-07-21 11:10:54 +00:00
Witold Filipczyk
8a1ef2ada9 That was missing, at least I think so 2006-07-20 02:05:56 +02:00
Witold Filipczyk
b388b4afea Avoided rerendering 2006-07-20 02:03:25 +02:00
Witold Filipczyk
70a46e12aa Fixed the issue when assummed codepage is not UTF-8 2006-07-19 19:11:03 +02:00
Witold Filipczyk
44c74ac389 Refactor is_cp_special to is_cp_utf8 2006-07-18 17:51:03 +02:00
Witold Filipczyk
1adbce8429 unicode_val_T instead of unsigned char in struct search 2006-07-17 22:14:45 +02:00
Petr Baudis
85c9c54d00 Accept float widths (ceiling them)
Especially percentages might be floats instead of integer, see
e.g. http://www.armitunes.com/cgi-bin/icecast/playing.cgi.
2006-07-16 22:22:16 +02:00
Jonas Fonseca
ef051261b3 Improve upon pasky's intro to the HTML engine 2006-07-13 21:12:24 +02:00
Petr Baudis
314dbc2dab Add short intro and talk about box model 2006-07-13 03:46:16 +02:00
Petr Baudis
1ae18267f8 Kill src/document/html/TODO
In the first paragraph it lists what's already done. In the second it
lists the obvious. And the third is obsolete.
2006-07-13 02:51:31 +02:00
Laurent MONIN
36a277540c Let be more tolerant with buggy meta refresh. It should fix bug 767. 2006-07-10 21:16:14 +02:00
Miciah Dashiel Butler Masters
bfc8b17d64 Fix a bug in the plaintext renderer when handling tabs
Commit 3ce3f01f30 introduced a bug whereby
if a tab set the current position in the line to or greater than the number
of bytes remaining in the source, the line was split after the tab.
2006-06-16 21:13:33 +00:00
Laurent MONIN
ef37161070 distribute_rows_or_cols(): merge two loops. 2006-06-06 23:10:29 +02:00
Laurent MONIN
824b4374fa distribute_rows_or_cols(): simplify code. 2006-06-06 23:09:19 +02:00
Jonas Fonseca
9f3456c872 Add support for parsing space separated CSS class attribute values
Sequentially apply style for stuff like class="class1 class2".
2006-06-06 15:21:56 +02:00
Kalle Olavi Niemitalo
819b6fab80 parse_header_param stores the string via a pointer parameter.
Its return value is now an enum that lets callers know whether an
error occurred.  However, this commit changes the callers only
minimally, so they do not yet check the return value.
2006-06-05 20:22:53 +00:00
Witold Filipczyk
966d965c11 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-06-02 19:53:36 +02:00
Witold Filipczyk
53890a9a95 The label ng moved one line down 2006-06-02 19:51:32 +02:00
Laurent MONIN
8cba76541b Code simplification and tidy up. 2006-06-02 18:54:03 +02:00
Miciah Dashiel Butler Masters
6712baaee0 Comment html_context->position 2006-06-02 06:13:31 +00:00
Miciah Dashiel Butler Masters
b1a7f3f19e Add a comment to html_context->put_chars_f explaining not to use it 2006-06-02 05:53:49 +00:00
Miciah Dashiel Butler Masters
77f5585125 Use put_chrs instead of html_context->put_chars_f in element handlers
In html_subscript, html_subscript_close, html_superscript, html_quote, and
html_quote_close, use put_chrs instead of html_context->put_chars_f.
Element handlers should use put_chrs so that it can correctly handle
whitespace and stuff.
2006-06-02 05:51:24 +00:00
Laurent MONIN
1d3656a317 Pass a pointer to a hash pointer to free_hash() to ensure hash pointer
is NULL on return.
2006-05-31 19:33:36 +02:00
Laurent MONIN
54099f5286 Do not export init_hash(),strhash() and hash_size() anymore, use a
wrapper named init_hash8() instead.
2006-05-31 19:17:01 +02:00
Laurent MONIN
4c5d4bcf34 Revert d19dcaa3e7 patch that breaks table
rendering.
2006-05-31 18:50:15 +02:00
Miciah Dashiel Butler Masters
c91c763d49 Eliminate link_bg
Instead of saving the old link colours when selecting a link and using that
to restore them when unselecting it, just copy the data from the document.

 - Eliminate struct link_bg and the .link_bg and .link_bg_n members
   of struct document_view.

 - Eliminate the free_link routine and don't call it from draw_doc,
   clear_link, or detach_formatted.

 - Add a .old_current_link member to struct view_state and initialise it in
   init_vs.

 - Don't save link_bg in draw_current_link.

 - Rewrite clear_link to use the document data instead of link_bg.

 - Modify init_link_drawing not to allocate ling_bg and to return a pointer
   to a static variable for the template character.
2006-05-28 01:08:46 +00:00
Miciah Dashiel Butler Masters
36e7044948 DOM: Factor get_doctype out of render_dom_document. 2006-05-28 00:39:58 +00:00
Miciah Dashiel Butler Masters
f925adbfc9 DOM: Factor done_dom_renderer out of render_dom_document. 2006-05-28 00:39:54 +00:00
Miciah Dashiel Butler Masters
3272290189 Better <q> support
Patch by Jonas Koelker, Jonas Fonseca, and me.
2006-05-28 00:37:12 +00:00
Miciah Dashiel Butler Masters
ca3fc4f7ac Mark line_break and put_chars static 2006-05-28 00:10:14 +00:00
Miciah Dashiel Butler Masters
65016cdca4 Fix superscript and subscript support
Introduce html_subscript_close callback. Draw opening and closing brackets
and carets for subscript and superscript text directly in the element
handlers rather than performing weirdness in the renderer. This both
improves readability and fixes bug 284, misplaced brackets with subscripts.
2006-05-28 00:10:13 +00:00
Miciah Dashiel Butler Masters
6947902b57 Replace special handling in end_element with callbacks
Add close callbacks html_html_close, html_style_close, and
html_xmp_close. end_element now calls the element close callback instead
of performing special handling for certain tags.
2006-05-28 00:10:13 +00:00
Miciah Dashiel Butler Masters
0f2982aa5d end_element: inconsequential code shuffling 2006-05-28 00:10:12 +00:00
Miciah Dashiel Butler Masters
03fde090cf struct element_info: add .close callback
Rename enum element_type values, shortening ELEMENT_TYPE_ to just ET_
and reformat the elements table to squeeze everything in.
2006-05-28 00:10:12 +00:00
Miciah Dashiel Butler Masters
12b5345b9a struct element_info: rename .func to .open 2006-05-28 00:10:12 +00:00
Witold Filipczyk
9fcd5ea64e Weird. The backslash removed 2006-05-26 20:03:48 +02:00
Witold Filipczyk
d19dcaa3e7 IMHO line_break should fill lines with spaces. This is done for <pre>.
See glib documentation in 256 colors for the difference.
Some lines are 1 space longer. I have no idea how to level them.
2006-05-26 19:59:20 +02:00
Witold Filipczyk
c4c97a07bd plain renderer: return when data is invalid in some cases 2006-05-10 18:18:22 +02:00
Witold Filipczyk
82d38ff2be plain renderer: rewritten change_colors, handling 256 color ESC sequences.
TODO: mono mode
2006-05-10 17:46:31 +02:00
Witold Filipczyk
c677bc010d plain renderer: stdio.h is not required 2006-05-08 10:20:37 +02:00
Witold Filipczyk
88c146a395 plain_renderer: cg-log -c | elinks works. The code needs cleanup 2006-05-07 15:49:08 +02:00
Witold Filipczyk
1feab80c13 plain renderer: used switch instead of if, else if, else 2006-05-07 14:39:27 +02:00
Pavol Babincak
bbd24d7bf4 Corrected computing cell count for html select in UTF-8. 2006-05-07 00:51:25 +02:00
Witold Filipczyk
e56f429c9b Another workaround related to tcc 2006-05-05 22:18:27 +02:00
Witold Filipczyk
ad160766b8 Added id to the form control. id is used by scripts 2006-05-01 19:22:07 +02:00
Pavol Babincak
7951d7bf22 Added: split line after any double-width character in html renderer.
Note: there are ugly bug (feature?) - when there isn't enought room for
whole double-width char two double-chars are displayed. Can be seen on
table with double-width chars reduced as much as possible.
2006-04-09 19:17:16 +02:00
Pavol Babincak
dd05c89d49 Replaced utf8_len with cells. 2006-04-09 19:07:43 +02:00
Pavol Babincak
161ccf9eae Use unicode_val_T instead of uint16_t for unicode data + cell count fix. 2006-04-09 17:04:47 +02:00
Witold Filipczyk
18280cafbb Code generated by tcc was broken for those boolean expressions 2006-04-06 22:07:45 +02:00
Pavol Babincak
8b9d06c977 Convert link titles to correct codepage before displaying it on screen.
Don't replace UTF-8 bytes with '*'. Probably there is need to do better
check what will be displayed.

Also get_current_link_title is no longer pretty and trivial. (o:
2006-03-13 01:54:34 +01:00
witekfl
3f01c3d2fe Display optionally tabs bar at top like other browser do.
TODO: input_line_layouter, ACT_MAIN_TAB_MENU
2006-03-04 10:24:37 +01:00
Timo Lindfors
212b4a2893 Fix bug #741: "html comments shouldn't be evaluted inside STYLE elements" 2006-02-22 19:45:14 -05:00
Pavol Babincak
f4a430e480 Support for double-width glyphs in DOM renderer
Removed duplicate code for UTF-8 in DOM renderer. Modified DOM renderer
to correctly displaying multi-width glyphs.
2006-02-18 20:28:01 +01:00
Pavol Babincak
fc5f2389ed Support for double-width glyphs in plain renderer
Removed duplicate code for UTF-8 in plain renderer. Modified plain renderer
to correctly displaying multi-width glyphs.
2006-02-18 20:28:00 +01:00
Pavol Babincak
f9d67aeb73 Added configure option --enable-utf-8
For enabling better UTF-8 support by Witek and Scrool.
2006-02-18 20:28:00 +01:00
Witold Filipczyk
44a1aa9c87 Witekfl's UTF-8 patch v5. 2006-02-18 20:27:46 +01:00
Miciah Dashiel Butler Masters
190259ca22 mem_alloc_align: drop the obj type parameter
Instead use the object itself, i.e., replace typeof(obj) with
typeof(**ptr).
2006-02-17 17:32:59 +00:00
Eric Wald
3ce3f01f30 Add support for forcing wrapping at the screen boundary
This patch modifies ELinks wrapping behavior slightly.

 * The wrap command now toggles line wrapping in HTML mode, as well as
   text mode.  Note that when the HTML view of a page is wrapped, its
   source view is unwrapped, and vice versa.
 * Tabs in text-mode lines are now handled correctly.
 * Wrapping a line that reaches exactly to the edge of the screen will
   no longer produce a blank line in text mode.
 * Text within extra-wide table cells is now wrapped to less than the
   screen width, to eliminate sideways scrolling.

The last point is only enabled by setting TABLE_LINE_PADDING to a
non-negative number, in the src/setup.h header file, because it is a
significant change of behavior from previous versions.
2006-02-15 15:50:29 +01:00
Miciah Dashiel Butler Masters
2c087e52e7 Revert unstable 'Eval embedded scripts at once'
Revert commit 2f0490cb04
('Eval embedded scripts at once') and follow-up commit
997f61bb32 ('Use document_view instead of
view_state. It is safer probably') because the change causes crashes on
numerous pages and just looks wrong.
2006-02-12 15:03:12 +00:00
Miciah Dashiel Butler Masters
b8ee886a60 sort_links: fix memory leak
Free document->lines1 and document->lines2 if they are already set. This
fixes a memory leak from commit 52d3a6411d.
2006-02-03 20:12:24 +00:00
Jonas Fonseca
92a9cafb6e DOM: Replace various DOM status/error/exception codes with dom_code enum
Replaces sgml_parser_code, dom_stack_code, and dom_exception_code and
generally tries to simplify things and remove redundant codes.
2006-01-31 22:01:35 +01:00
Jonas Fonseca
ca5a5f230a Make render_dom_node_source static 2006-01-29 12:11:35 +01:00
Jonas Fonseca
2e3e18595f Normalize all links added by the plain renderer
Fixes problems with host or protocol parts not being lowercased. This
triggers an assertion failure when trying to download such links. Reported
by lindi-.
2006-01-29 09:04:52 +01:00
52d3a6411d Sort links when necessary 2006-01-28 14:13:41 +01:00
dacb694e33 Merge with git+ssh://pasky.or.cz/srv/git/elinks.git 2006-01-28 12:11:29 +01:00
997f61bb32 Use document_view instead of view_state. It is safer probably 2006-01-28 12:07:00 +01:00
9cc9db4e24 Handling onsubmit 2006-01-28 11:17:22 +01:00
6e4c80a29e Avoid memleak 2006-01-28 08:37:58 +01:00
Laurent MONIN
5114c9d110 Trim trailing whitespaces. 2006-01-28 01:59:22 +01:00
Laurent MONIN
bae3b58146 Fix a potential memleak. 2006-01-28 01:58:00 +01:00
b1b66db850 Success. document.write works for me. 2006-01-27 16:54:39 +01:00
9c9fa1d81c Defined document.write and document.writeln for SEE 2006-01-27 14:55:53 +01:00
8bf45d0ece Spidermonkey's document.write and document.writeln defined. They work,
but rendering doesn't work
2006-01-27 13:29:38 +01:00
2551fe3525 Render html written by document.write. I'm not sure if format_html_part
is called right way
2006-01-27 12:41:35 +01:00
62d42380f8 Added ret param for document.write 2006-01-27 12:07:45 +01:00
2f0490cb04 Eval embedded scripts at once 2006-01-27 10:26:58 +01:00
Jonas Fonseca
bea1a0c559 Handle <base href=""> for HTML source rendering
Requested by witekfl.
2006-01-25 23:16:30 +01:00
Jonas Fonseca
89a95a5fc5 Rename enum html_element_type to html_element_mortality_type
This name is reserved for DOM.
2006-01-25 23:13:10 +01:00
Miciah Dashiel Butler Masters
3b5724edd5 look_for_link: simplify string
Use stracpy(empty_string_or_(target_base)) instead of
null_or_stracpy(target_base) and then stracpy("") if that returns NULL.
2006-01-18 20:38:33 +00:00
Jonas Fonseca
1d52d67e50 Add get_dom_node_child() which searches for a node with given type 2006-01-16 07:11:02 +01:00
Jonas Fonseca
6c85c0f009 Add DOM configuration inspired module
It add support for normalizing a DOM document in various ways, such as
removing comments, converting CDATA section nodes to text nodes, cleanup
whitespace, etc.

Use it in the RSS renderer to sanitize the text to be rendered.
2006-01-16 05:12:34 +01:00
Jonas Fonseca
eecc22751d Use dom_stack_code enum for dom_stack_callback_T 2006-01-16 00:55:58 +01:00
Jonas Fonseca
2748d043f9 Autogenerate .vimrc files and put the master in config/vimrc
This changes the init target to be idempotent: most importantly it will now
never overwrite a Makefile if it exists. Additionally 'make init' will
generate the .vimrc files. Yay, no more stupid 'added fairies' commits! ;)
2006-01-15 18:38:58 +01:00
Jonas Fonseca
0950996dd8 Change parse_sgml() to take buf+bufsize instead of DOM string 2006-01-14 11:32:11 +01:00