Commit Graph

1638 Commits

Author SHA1 Message Date
Michael Drake
04e61b710f Fix object accounting for aborted HTML contents. 2016-02-11 11:45:38 +00:00
Michael Drake
d4a01d525a HTML: Remove some status bar updating code. 2016-02-10 16:09:16 +00:00
Michael Drake
3bee7b7e12 Layout: Don't generate :before and :after boxes for replaced elements.
In CSS 2.1 this was undefined.

  CSS 2.1 -- 12.1 The :before and :after pseudo-elements

    Note. This specification does not fully define the interaction
    of :before and :after with replaced elements (such as IMG in HTML).
    This will be defined in more detail in a future specification.

    -- https://www.w3.org/TR/CSS21/generate.html#before-after-content

In CSS 3 the :before and :after generated content boxes are not allowed
on replaced elements.

  CSS 3 Generated and Replaced Content Module
        12. Replaced content

  The box model defines different rules for the layout of replaced
  elements than normal elements. Replaced elements do not have
  '::before' and '::after' pseudo-elements; the 'content' property
  in the case of replaced content replaces the entire contents of
  the element's box.

  -- https://www.w3.org/TR/css3-content/#replacedContent
2016-02-09 16:42:28 +00:00
Michael Drake
8e580ccd19 Split out presentational hints handling. 2016-02-05 10:49:58 +00:00
Michael Drake
b002ba7357 Simplify special element handling in node inserted callback. 2016-01-29 16:04:47 +00:00
Michael Drake
b58176c65e Spaces to tabs. 2016-01-29 16:04:47 +00:00
Michael Drake
d9e92d2032 Add comment on on-demand JS context creation safety
Checking for enable_scripting isn't needed here.
2016-01-21 14:58:38 +00:00
Michael Drake
82b298ac2c Ensure we do on-demand JS context creation only when JS is enabled.
An alternative approach which may be better would be to create the
JavaScript context when the html_content is created, rather than
on demand.

This code checks for the JS context and creates one every time we
add a node to the DOM.  So when JS is on, every doc with a single
node in it has a JS context.  This seems to make on-demand creation
a redundant overhead.
2016-01-21 14:51:17 +00:00
Michael Drake
669448d7b6 Fix place where we're calling a js_* fn without checking for context. 2016-01-21 14:49:57 +00:00
Michael Drake
594012ef52 Ensure constant javascript_enabled for HTML contents.
Now we take the value of the javascript_enabled option when the
content is created.  We then use the content's script_enabled
boolean everywhere else.

This prevents us getting inconsistent values for javascript_enabled
if a user toggles the setting while a page is loading.

It was read frequently during box construction, and also the
parser's script enabled setting could change where we handled
a change of encoding.

Now we only care about the setting of the javascript_enabled
option at time of html_content creation.
2016-01-21 14:11:36 +00:00
Michael Drake
3dcf7d80a1 Pass html_content to box_extract_link. 2016-01-21 14:09:57 +00:00
Michael Drake
ad273a41e8 Simplify place_float_below loop condition. 2016-01-21 09:44:05 +00:00
Michael Drake
a774e9473d Make use of cached place float below value earlier. 2016-01-20 22:37:22 +00:00
Michael Drake
0bbc03c577 Cache place below level, to avoid pointless calls to find_sides. 2016-01-20 20:09:40 +00:00
Michael Drake
c13080d96c Optimise white hot find_sides to take advantage of sorted float_children.
Now we have an early exit when we get to the floats above the area we're
interested in.
2016-01-20 20:02:56 +00:00
Michael Drake
948a93041d Sort float_children of containers by their bottom edge. 2016-01-20 20:02:56 +00:00
Michael Drake
38e6fd1b74 Split adding float to a container out into separate function. 2016-01-20 20:02:55 +00:00
Michael Drake
018adc2f5e Remove redundant condition in white hot path. 2016-01-20 18:27:15 +00:00
Michael Drake
0492966c86 Remove erroneous redeclaration of variable in new scope. 2015-12-20 12:04:21 +00:00
Michael Drake
e5a2538b6d Make it clearer why we're asserting. 2015-11-11 22:22:19 +00:00
Michael Drake
896c71abbe Only fire click event on button 1 press. 2015-11-06 15:55:36 +00:00
Michael Drake
5c719d540e Assert that we have a node. 2015-11-06 15:55:33 +00:00
Michael Drake
2f27852229 Always consider the root element's box.
Previously we didn't consider it at all.
2015-11-06 14:23:36 +00:00
Michael Drake
ed5fd91843 Fix overflow-{x|y} handling. 2015-11-01 14:06:06 +00:00
Michael Drake
7a6f0c765a Fix descendant bounding box calcs to work with overflow-{x|y}. 2015-10-31 19:11:24 +00:00
Daniel Silverstone
3aacba15f8 Don't call up if the parent's jscontext has gone NULL in the meantime 2015-10-31 18:26:43 +01:00
Daniel Silverstone
60c52e1eaf Change click handling to fire_dom_event 2015-10-31 18:01:38 +01:00
Daniel Silverstone
310162474a Add fire_dom_event, it's in a bad place but we can move it later 2015-10-31 18:01:38 +01:00
Daniel Silverstone
b1d477219d Shunt the handling of new elements 2015-10-31 18:01:38 +01:00
Daniel Silverstone
5a107a466b Initial work toward JS event support 2015-10-31 18:01:38 +01:00
Michael Drake
71f296a41c Fix dom document leak for framesets. 2015-10-31 16:14:40 +00:00
Michael Drake
1bb7d295bb Make nsurl utf8 string conversion function consistent with nsurl API. 2015-10-25 09:03:20 +00:00
Chris Young
65b510fbc3 Rework IDN URL retrieval to return an nserror 2015-10-24 15:12:57 +01:00
Chris Young
53141c7089 Modify the status bar link text so it shows either the ASCII encoded or IDN host, depending on the set option.
Default is to display the encoded version as this provides some security making phishing domains more obvious, and a lot of our frontends are unable to display the full range of UTF-8 characters on the status bar.
Displaying the decoded address in the URL bar requires frontends to be updated (GTK and Amiga done already), and the same caveats apply.
2015-10-24 15:12:57 +01:00
Vincent Sanders
9ebdc7dd7a ensure completion of async js scripts completes the fetch
When the fetch of asynchronous javascript scripts completed the
completion of html rendering was not processed leaving the state
machine waiting forever.
2015-10-02 09:29:51 +01:00
Vincent Sanders
1f07c45740 fix gadget resource leak (coverity #1109875) 2015-09-07 13:53:59 +01:00
Chris Young
63227a214b Rename context_menu.c and strip out all the context menu code, so this file and popupmenu.class is only used (optionally) for HTML form selection. 2015-09-05 15:09:00 +01:00
Michael Drake
257666499d Reorder percentage calculation.
Fixed point representation couldn't store 0.65 exactly, so avoid doing
the divide by 100 first.

I will look at moving this into libcss's fixed point header and doing
it in a way that avoids arithmetic overflow, but for now this fixes
el reg layout.
2015-08-24 22:47:58 +01:00
Daniel Silverstone
2c7dfe0d3d It's not a hubbub error 2015-08-12 11:00:22 +02:00
Daniel Silverstone
548adc547d Store the HTML content as userdata on the DOM's HTMLDocument 2015-08-09 12:00:25 +01:00
Daniel Silverstone
c8ae744680 Only iterate the form when freeing a control if there is one.
This fixes Bug#2322
2015-06-03 20:24:32 +01:00
Vincent Sanders
0d811963c1 fixup all the remaining logging macro callsites
The semantic patch tool appears to have missed some difficult to
reason about callsites which have now been manually cleaned up
2015-05-28 17:06:18 +01:00
Vincent Sanders
c105738fa3 Change LOG() macro to be varadic
This changes the LOG macro to be varadic removing the need for all
callsites to have double bracketing and allows for future improvement
on how we use the logging macros.

The callsites were changed with coccinelle and the changes checked by
hand. Compile tested for several frontends but not all.

A formatting annotation has also been added which allows the compiler
to check the parameters and types passed to the logging.
2015-05-28 16:08:46 +01:00
Vincent Sanders
2c51dabfeb put assert back to protect against bad logic in frontend drag implementations 2015-05-08 15:30:41 +01:00
Vincent Sanders
31f8c363be remove assert if drag message contains an unknown type.
Instead of asserting if a message contains an unsupported drag type
the message is now logged and ignored.
2015-05-03 17:49:19 +01:00
Vincent Sanders
a375e58bb8 Silence incorrect warning from gcc 4.9
This makes the box_move_xy function return a value on all code
paths. This was not really necessary as there is an assert in the path
that could have returned without a value. The gcc optimiser seems
unable to reason about this in this case causing a warning.
2015-05-03 17:40:27 +01:00
Vincent Sanders
3cabd331ee Ensure result of ftell is checked for errors
The ftell call in the html renderer handling of drag and drop was not
checking its return value for errors which could have resulted in
attempting to read -1 bytes.

coverity 1251038
2015-04-26 00:32:42 +01:00
Michael Drake
69776768d2 Remove duplicate branch in relative position handling. 2015-04-23 09:46:04 +01:00
Daniel Silverstone
df3a889435 Ensure we delink form controls when freeing them 2015-04-22 21:11:21 +01:00
Vincent Sanders
1e1df59089 add some debug to form gadget freeing
Serveral reports of form freeing segfaulting on RISC OS so this adds
some debug in this area to see if we can tell why.
2015-03-27 15:27:33 +00:00