r13182 jmb - in /trunk/netsurf: beos/beos_fetch_rsrc.cpp content/fetch.c content/fetch.h content/fetchers/about.c content/fetchers/curl.c content/fetchers/data.c content/fetchers/file.c content/fetchers/resource.c
by netsurf@semichrome.net
Author: jmb
Date: Sun Nov 27 08:14:36 2011
New Revision: 13182
URL: http://source.netsurf-browser.org?rev=13182&view=rev
Log:
return;
Fix bug #3442642: allow scheme-specific fetchers to have a say in whether an URL can be fetched.
Modified:
trunk/netsurf/beos/beos_fetch_rsrc.cpp
trunk/netsurf/content/fetch.c
trunk/netsurf/content/fetch.h
trunk/netsurf/content/fetchers/about.c
trunk/netsurf/content/fetchers/curl.c
trunk/netsurf/content/fetchers/data.c
trunk/netsurf/content/fetchers/file.c
trunk/netsurf/content/fetchers/resource.c
Modified: trunk/netsurf/beos/beos_fetch_rsrc.cpp
URL: http://source.netsurf-browser.org/trunk/netsurf/beos/beos_fetch_rsrc.cpp?...
==============================================================================
--- trunk/netsurf/beos/beos_fetch_rsrc.cpp (original)
+++ trunk/netsurf/beos/beos_fetch_rsrc.cpp Sun Nov 27 08:14:36 2011
@@ -78,6 +78,11 @@
LOG(("fetch_rsrc_finalise called for %s", scheme));
}
+static bool fetch_rsrc_can_fetch(const nsurl *url)
+{
+ return true;
+}
+
static void *fetch_rsrc_setup(struct fetch *parent_fetch, const char *url,
bool only_2xx, const char *post_urlenc,
const struct fetch_multipart_data *post_multipart,
@@ -340,6 +345,7 @@
}
fetch_add_fetcher("rsrc",
fetch_rsrc_initialise,
+ fetch_rsrc_can_fetch,
fetch_rsrc_setup,
fetch_rsrc_start,
fetch_rsrc_abort,
Modified: trunk/netsurf/content/fetch.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetch.c?rev=13182...
==============================================================================
--- trunk/netsurf/content/fetch.c (original)
+++ trunk/netsurf/content/fetch.c Sun Nov 27 08:14:36 2011
@@ -60,6 +60,7 @@
/** Information about a fetcher for a given scheme. */
typedef struct scheme_fetcher_s {
lwc_string *scheme_name; /**< The scheme. */
+ fetcher_can_fetch can_fetch; /**< Ensure an URL can be fetched. */
fetcher_setup_fetch setup_fetch; /**< Set up a fetch. */
fetcher_start_fetch start_fetch; /**< Start a fetch. */
fetcher_abort_fetch abort_fetch; /**< Abort a fetch. */
@@ -157,6 +158,7 @@
bool fetch_add_fetcher(lwc_string *scheme,
fetcher_initialise initialiser,
+ fetcher_can_fetch can_fetch,
fetcher_setup_fetch setup_fetch,
fetcher_start_fetch start_fetch,
fetcher_abort_fetch abort_fetch,
@@ -174,6 +176,7 @@
}
new_fetcher->scheme_name = scheme;
new_fetcher->refcount = 0;
+ new_fetcher->can_fetch = can_fetch;
new_fetcher->setup_fetch = setup_fetch;
new_fetcher->start_fetch = start_fetch;
new_fetcher->abort_fetch = abort_fetch;
@@ -540,16 +543,15 @@
while (fetcher != NULL) {
lwc_string_isequal(fetcher->scheme_name, scheme, &match);
- if (match == true) {
- lwc_string_unref(scheme);
- return true;
- }
+ if (match == true)
+ break;
+
fetcher = fetcher->next_fetcher;
}
lwc_string_unref(scheme);
- return false;
+ return fetcher == NULL ? false : fetcher->can_fetch(url);
}
Modified: trunk/netsurf/content/fetch.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetch.h?rev=13182...
==============================================================================
--- trunk/netsurf/content/fetch.h (original)
+++ trunk/netsurf/content/fetch.h Sun Nov 27 08:14:36 2011
@@ -124,6 +124,7 @@
/* API for fetchers themselves */
typedef bool (*fetcher_initialise)(lwc_string *);
+typedef bool (*fetcher_can_fetch)(const nsurl *);
typedef void* (*fetcher_setup_fetch)(struct fetch *, nsurl *,
bool, const char *,
const struct fetch_multipart_data *,
@@ -138,6 +139,7 @@
*
* \param scheme scheme fetcher is for (caller relinquishes ownership)
* \param initialiser fetcher initialiser
+ * \param can_fetch fetcher can fetch function
* \param setup_fetch fetcher fetch setup function
* \param start_fetch fetcher fetch start function
* \param abort_fetch fetcher fetch abort function
@@ -148,6 +150,7 @@
*/
bool fetch_add_fetcher(lwc_string *scheme,
fetcher_initialise initialiser,
+ fetcher_can_fetch can_fetch,
fetcher_setup_fetch setup_fetch,
fetcher_start_fetch start_fetch,
fetcher_abort_fetch abort_fetch,
Modified: trunk/netsurf/content/fetchers/about.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchers/about.c?...
==============================================================================
--- trunk/netsurf/content/fetchers/about.c (original)
+++ trunk/netsurf/content/fetchers/about.c Sun Nov 27 08:14:36 2011
@@ -669,6 +669,11 @@
}
}
+static bool fetch_about_can_fetch(const nsurl *url)
+{
+ return true;
+}
+
/** callback to set up a about fetch context. */
static void *
fetch_about_setup(struct fetch *fetchh,
@@ -792,6 +797,7 @@
fetch_add_fetcher(scheme,
fetch_about_initialise,
+ fetch_about_can_fetch,
fetch_about_setup,
fetch_about_start,
fetch_about_abort,
Modified: trunk/netsurf/content/fetchers/curl.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchers/curl.c?r...
==============================================================================
--- trunk/netsurf/content/fetchers/curl.c (original)
+++ trunk/netsurf/content/fetchers/curl.c Sun Nov 27 08:14:36 2011
@@ -113,6 +113,7 @@
static bool fetch_curl_initialise(lwc_string *scheme);
static void fetch_curl_finalise(lwc_string *scheme);
+static bool fetch_curl_can_fetch(const nsurl *url);
static void * fetch_curl_setup(struct fetch *parent_fetch, nsurl *url,
bool only_2xx, const char *post_urlenc,
const struct fetch_multipart_data *post_multipart,
@@ -252,6 +253,7 @@
if (!fetch_add_fetcher(scheme,
fetch_curl_initialise,
+ fetch_curl_can_fetch,
fetch_curl_setup,
fetch_curl_start,
fetch_curl_abort,
@@ -318,6 +320,10 @@
}
}
+bool fetch_curl_can_fetch(const nsurl *url)
+{
+ return nsurl_enquire(url, NSURL_HOST);
+}
/**
* Start fetching data for the given URL.
Modified: trunk/netsurf/content/fetchers/data.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchers/data.c?r...
==============================================================================
--- trunk/netsurf/content/fetchers/data.c (original)
+++ trunk/netsurf/content/fetchers/data.c Sun Nov 27 08:14:36 2011
@@ -73,6 +73,11 @@
{
LOG(("fetch_data_finalise called for %s", lwc_string_data(scheme)));
curl_easy_cleanup(curl);
+}
+
+static bool fetch_data_can_fetch(const nsurl *url)
+{
+ return true;
}
static void *fetch_data_setup(struct fetch *parent_fetch, nsurl *url,
@@ -330,6 +335,7 @@
fetch_add_fetcher(scheme,
fetch_data_initialise,
+ fetch_data_can_fetch,
fetch_data_setup,
fetch_data_start,
fetch_data_abort,
Modified: trunk/netsurf/content/fetchers/file.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchers/file.c?r...
==============================================================================
--- trunk/netsurf/content/fetchers/file.c (original)
+++ trunk/netsurf/content/fetchers/file.c Sun Nov 27 08:14:36 2011
@@ -110,6 +110,11 @@
/** callback to initialise the file fetcher. */
static void fetch_file_finalise(lwc_string *scheme)
{
+}
+
+static bool fetch_file_can_fetch(const nsurl *url)
+{
+ return true;
}
/** callback to set up a file fetch context. */
@@ -645,6 +650,7 @@
fetch_add_fetcher(scheme,
fetch_file_initialise,
+ fetch_file_can_fetch,
fetch_file_setup,
fetch_file_start,
fetch_file_abort,
Modified: trunk/netsurf/content/fetchers/resource.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/fetchers/resource...
==============================================================================
--- trunk/netsurf/content/fetchers/resource.c (original)
+++ trunk/netsurf/content/fetchers/resource.c Sun Nov 27 08:14:36 2011
@@ -219,6 +219,11 @@
}
}
+static bool fetch_resource_can_fetch(const nsurl *url)
+{
+ return true;
+}
+
/** callback to set up a resource fetch context. */
static void *
fetch_resource_setup(struct fetch *fetchh,
@@ -350,6 +355,7 @@
fetch_add_fetcher(scheme,
fetch_resource_initialise,
+ fetch_resource_can_fetch,
fetch_resource_setup,
fetch_resource_start,
fetch_resource_abort,
11 years, 2 months
r13181 dsilvers - in /trunk/netsurf: Docs/USING-Monkey monkey/browser.c monkey/plot.c
by netsurf@semichrome.net
Author: dsilvers
Date: Fri Nov 25 12:08:30 2011
New Revision: 13181
URL: http://source.netsurf-browser.org?rev=13181&view=rev
Log:
More response tags, updated docs with commands
Modified:
trunk/netsurf/Docs/USING-Monkey
trunk/netsurf/monkey/browser.c
trunk/netsurf/monkey/plot.c
Modified: trunk/netsurf/Docs/USING-Monkey
URL: http://source.netsurf-browser.org/trunk/netsurf/Docs/USING-Monkey?rev=131...
==============================================================================
--- trunk/netsurf/Docs/USING-Monkey (original)
+++ trunk/netsurf/Docs/USING-Monkey Fri Nov 25 12:08:30 2011
@@ -35,9 +35,19 @@
parsed a token at a time, so that when such a string is encountered,
the parser can stop splitting and return the rest.
+ Commands to Monkey are namespaced. For example commands related to
+ browser windows are prefixed by WINDOW.
+
Top level tags for nsmonkey
---------------------------
+ QUIT
+
+ WINDOW
+
+ Top level response tags for nsmonkey
+ ------------------------------------
+
GENERIC
WARN, ERROR, DIE
@@ -49,6 +59,8 @@
SSLCERT
401LOGIN
+
+ PLOT
In the below, %something% indicates a substitution made by Monkey.
@@ -65,20 +77,71 @@
Errors (tagged ERROR) tend to come from Monkey's parsers
Death (tagged DIE) comes from the core and kills Monkey dead.
+Commands
+========
+
+ Generic commands
+ ----------------
+
+ QUIT
+ Cause monkey to quit cleanly.
+ This will cleanly destroy open windows etc.
+
+ Window commands
+ ---------------
+
+ WINDOW NEW [%url%]
+ Create a new browser window, optionally giving the core
+ a URL to immediately navigate to.
+ Minimally you will receive a WINDOW NEW WIN %id% response.
+
+ WINDOW DESTROY %id%
+ Destroy the given browser window.
+ Minimally you will recieve a WINDOW DESTROY WIN %id% response.
+
+ WINDOW GO %id% %url% [%url%]
+ Cause the given browser window to visit the given URL.
+ Optionally you can give a referrer URL to also use (simulating
+ a click in the browser on a link).
+ Minimally you can expect throbber, url etc responses.
+
+ WINDOW REDRAW %id% [%num% %num% %num% %num%]
+ Cause a browser window to redraw. Optionally you can give a
+ set of coordinates to simulate a partial expose of the window.
+ Said coordinates are in traditional X0 Y0 X1 Y1 order.
+ The coordinates are in canvas, not window, coordinates. So you
+ should take into account the scroll offsets when issuing this
+ command.
+ Minimally you can expect redraw start/stop messages and you
+ can likely expect some number of PLOT results.
+
+ WINDOW RELOAD %id%
+ Cause a browser window to reload its current content.
+ Expect responses similar to a GO command.
+
+
+Responses
+=========
+
Generic messages
----------------
GENERIC STARTED
Monkey has started and is ready for commands
+
GENERIC CLOSING_DOWN
Monkey has been told to shut down and is doing so
+
GENERIC FINISHED
Monkey has finished and will now exit
+
GENERIC LAUNCH URL %url%
The core asked monkey to launch the given URL
+
GENERIC THUMBNAIL URL %url%
The core asked monkey to thumbnail a content without
a window.
+
GENERIC POLL BLOCKING
Monkey reached a point where it could sleep waiting for
commands or scheduled timeouts. No fetches nor redraws
@@ -91,7 +154,7 @@
The core asked Monkey to open a new window. The IDs for 'FOR' and
'CLONE' are core window IDs, the WIN id is a Monkey window ID.
- WINDOW SIZE WIN %id% WIDTH %num% HEIGHT %num%
+ WINDOW SIZE WIN %id% WIDTH %n% HEIGHT %n%
The window specified has been set to the shown width and height.
WINDOW DESTROY WIN %id%
@@ -103,7 +166,7 @@
WINDOW REDRAW WIN %id%
The core asked that Monkey redraw the given window.
- WINDOW GET_DIMENSIONS WIN %id% WIDTH %num% HEIGHT %num%
+ WINDOW GET_DIMENSIONS WIN %id% WIDTH %n% HEIGHT %n%
The core asked Monkey what the dimensions of the window are.
Monkey has to respond immediately and returned the supplied width
and height values to the core.
@@ -124,16 +187,16 @@
The core asked Monkey to stop the throbber for the named
window. This indicates to the user that the window is finished.
- WINDOW SET_SCROLL WIN %id% X %num% Y %num%
+ WINDOW SET_SCROLL WIN %id% X %n% Y %n%
The core asked Monkey to set the named window's scroll offsets
to the given X and Y position.
- WINDOW UPDATE_BOX WIN %id% X %num% Y %num% WIDTH %num% HEIGHT %num%
+ WINDOW UPDATE_BOX WIN %id% X %n% Y %n% WIDTH %n% HEIGHT %n%
The core asked Monkey to redraw the given portion of the content
display. Note these coordinates refer to the content, not the
viewport which Monkey is simulating.
- WINDOW UPDATE_EXTENT WIN %id% WIDTH %num% HEIGHT %num%
+ WINDOW UPDATE_EXTENT WIN %id% WIDTH %n% HEIGHT %n%
The core has told us that the content in the given window has a
total width and height as shown. This allows us (along with the
window's width and height) to know the scroll limits.
@@ -146,7 +209,7 @@
The core has told us to update the mouse pointer for the given
window to the given pointer ID.
- WINDOW SET_SCALE WIN %id% SCALE %num%
+ WINDOW SET_SCALE WIN %id% SCALE %n%
The core has asked us to scale the given window by the given scale
factor.
@@ -154,29 +217,29 @@
The core has informed us that the given window's URL bar needs
updating to the given url.
- WINDOW GET_SCROLL WIN %id% X %num% Y %num%
+ WINDOW GET_SCROLL WIN %id% X %n% Y %n%
The core asked Monkey for the scroll offsets. Monkey returned the
numbers shown for the window named.
WINDOW SCROLL_START WIN %id%
The core asked Monkey to scroll the named window to the top/left.
- WINDOW POSITION_FRAME WIN %id% X0 %num% Y0 %num% X1 %num% Y1 %num%
+ WINDOW POSITION_FRAME WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
The core asked Monkey to position the named window as a frame at
the given coordinates of its parent.
- WINDOW SCROLL_VISIBLE WIN %id% X0 %num% Y0 %num% X1 %num% Y1 %num%
+ WINDOW SCROLL_VISIBLE WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
The core asked Monkey to scroll the named window until the
indicated box is visible.
- WINDOW PLACE_CARET WIN %id% X %num% Y %num% HEIGHT %num%
+ WINDOW PLACE_CARET WIN %id% X %n% Y %n% HEIGHT %n%
The core asked Monkey to render a caret in the named window at the
indicated position with the indicated height.
WINDOW REMOVE_CARET WIN %id%
The core asked Monkey to remove any caret in the named window.
- WINDOW SCROLL_START WIN %id% X0 %num% Y0 %num% X1 %num% Y1 %num%
+ WINDOW SCROLL_START WIN %id% X0 %n% Y0 %n% X1 %n% Y1 %n%
The core asked Monkey to scroll the named window to the start of
the given box.
@@ -192,6 +255,11 @@
The core asked Monkey to render a thumbnail for the given window
which is currently at the given URL.
+ WINDOW REDRAW WIN %id% START
+ WINDOW REDRAW WIN %id% STOP
+ The core wraps redraws in these messages. Thus PLOT responses can
+ be allocated to the appropriate window.
+
Download window messages
------------------------
@@ -199,7 +267,7 @@
The core asked Monkey to create a download window owned by the
given browser window.
- DOWNLOAD_WINDOW DATA DWIN %id% SIZE %num% DATA %str%
+ DOWNLOAD_WINDOW DATA DWIN %id% SIZE %n% DATA %str%
The core asked Monkey to update the named download window with
the given byte size and data string.
@@ -224,3 +292,27 @@
The core asked Monkey to ask for identification for the named
realm at the given URL.
+ Plotter messages
+ ----------------
+
+ Note, Monkey won't clip coordinates, but sometimes the core does.
+
+ PLOT CLIP X0 %n% Y0 %n% X1 %n% Y1 %n%
+ The core asked Monkey to clip plotting to the given clipping
+ rectangle (X0,Y0) (X1,Y1)
+
+ PLOT TEXT X %n% Y %n% STR %str%
+ The core asked Monkey to plot the given string at the
+ given coordinates.
+
+ PLOT LINE X0 %n% Y0 %n% X1 %n% Y1 %n%
+ The core asked Monkey to plot a line with the given start
+ and end coordinates.
+
+ PLOT RECT X0 %n% Y0 %n% X1 %n% Y1 %n%
+ The core asked Monkey to plot a rectangle with the given
+ coordinates as the corners.
+
+ PLOT BITMAP X %n% Y %n% WIDTH %n% HEIGHT %n%
+ The core asked Monkey to plot a bitmap at the given
+ coordinates, scaled to the given width/height.
Modified: trunk/netsurf/monkey/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/monkey/browser.c?rev=1318...
==============================================================================
--- trunk/netsurf/monkey/browser.c (original)
+++ trunk/netsurf/monkey/browser.c Fri Nov 25 12:08:30 2011
@@ -453,7 +453,7 @@
};
if (argc != 3 && argc != 7) {
- fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD");
+ fprintf(stdout, "ERROR WINDOW REDRAW ARGS BAD\n");
return;
}
@@ -477,7 +477,9 @@
}
LOG(("Issue redraw"));
+ fprintf(stdout, "WINDOW REDRAW WIN %d START\n", atoi(argv[2]));
browser_window_redraw(gw->bw, gw->scrollx, gw->scrolly, &clip, &ctx);
+ fprintf(stdout, "WINDOW REDRAW WIN %d STOP\n", atoi(argv[2]));
}
static void
@@ -485,7 +487,7 @@
{
struct gui_window *gw;
if (argc != 3 && argc != 4) {
- fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD");
+ fprintf(stdout, "ERROR WINDOW RELOAD ARGS BAD\n");
}
gw = monkey_find_window_by_num(atoi(argv[2]));
@@ -514,6 +516,8 @@
monkey_window_handle_redraw(argc, argv);
} else if (strcmp(argv[1], "RELOAD") == 0) {
monkey_window_handle_reload(argc, argv);
- }
-
-}
+ } else {
+ fprintf(stdout, "ERROR WINDOW COMMAND UNKNOWN %s\n", argv[1]);
+ }
+
+}
Modified: trunk/netsurf/monkey/plot.c
URL: http://source.netsurf-browser.org/trunk/netsurf/monkey/plot.c?rev=13181&r...
==============================================================================
--- trunk/netsurf/monkey/plot.c (original)
+++ trunk/netsurf/monkey/plot.c Fri Nov 25 12:08:30 2011
@@ -17,6 +17,8 @@
*/
#include "desktop/plotters.h"
+
+#include <stdio.h>
static bool
monkey_plot_disc(int x, int y, int radius, const plot_style_t *style)
@@ -41,7 +43,8 @@
monkey_plot_text(int x, int y, const char *text, size_t length,
const plot_font_style_t *fstyle)
{
- return true;
+ fprintf(stdout, "PLOT TEXT X %d Y %d STR %*s\n", x, y, (int)length, text);
+ return true;
}
static bool
@@ -50,19 +53,25 @@
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags)
{
- return true;
+ fprintf(stdout, "PLOT BITMAP X %d Y %d WIDTH %d HEIGHT %d\n",
+ x, y, width, height);
+ return true;
}
static bool
monkey_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- return true;
+ fprintf(stdout, "PLOT RECT X0 %d Y0 %d X1 %d Y1 %d\n",
+ x0, y0, x1, y1);
+ return true;
}
static bool
monkey_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- return true;
+ fprintf(stdout, "PLOT LINE X0 %d Y0 %d X1 %d Y1 %d\n",
+ x0, y0, x1, y1);
+ return true;
}
@@ -80,7 +89,9 @@
static bool
monkey_plot_clip(const struct rect *clip)
{
- return true;
+ fprintf(stdout, "PLOT CLIP X0 %d Y0 %d X1 %d Y1 %d\n",
+ clip->x0, clip->y0, clip->x1, clip->y1);
+ return true;
}
const struct plotter_table monkey_plotters = {
11 years, 2 months
r13179 tlsa - /trunk/netsurf/render/layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Thu Nov 24 11:22:25 2011
New Revision: 13179
URL: http://source.netsurf-browser.org?rev=13179&view=rev
Log:
Only make space for vertical box scrollbar if box has height set.
Modified:
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=13179...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Thu Nov 24 11:22:25 2011
@@ -1258,12 +1258,18 @@
(box->object && content_get_type(box->object) ==
CONTENT_HTML)) {
/* make space for scrollbars, unless height/width are AUTO */
+ enum css_height_e htype;
+ css_fixed height = 0;
+ css_unit hunit = CSS_UNIT_PX;
+ htype = css_computed_height(box->style, &height, &hunit);
+
if (which == BOTTOM && box->height != AUTO &&
(overflow == CSS_OVERFLOW_SCROLL ||
box_hscrollbar_present(box))) {
box->padding[BOTTOM] += SCROLLBAR_WIDTH;
}
if (which == RIGHT && box->width != AUTO &&
+ htype == CSS_HEIGHT_SET &&
(overflow == CSS_OVERFLOW_SCROLL ||
box_vscrollbar_present(box))) {
box->width -= SCROLLBAR_WIDTH;
11 years, 2 months
r13178 jmb - /trunk/netsurf/desktop/browser.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Nov 23 18:13:19 2011
New Revision: 13178
URL: http://source.netsurf-browser.org?rev=13178&view=rev
Log:
Fix bug #3441539: downloads may be created from within frames
Modified:
trunk/netsurf/desktop/browser.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=131...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Wed Nov 23 18:13:19 2011
@@ -758,6 +758,10 @@
/* Get download out of the way */
if (download) {
llcache_handle *l;
+ struct browser_window *root;
+
+ root = browser_window_get_root(bw);
+ assert(root != NULL);
fetch_flags |= LLCACHE_RETRIEVE_FORCE_FETCH;
fetch_flags |= LLCACHE_RETRIEVE_STREAM_DATA;
@@ -770,7 +774,7 @@
} else if (error != NSERROR_OK) {
LOG(("Failed to fetch download: %d", error));
} else {
- error = download_context_create(l, bw->window);
+ error = download_context_create(l, root->window);
if (error != NSERROR_OK) {
LOG(("Failed creating download context: %d",
error));
@@ -834,8 +838,8 @@
browser_window_set_status(bw, messages_get("Loading"));
bw->history_add = add_to_history;
- /* Only permit requests for root contents to become downloads */
- if (bw->window != NULL)
+ /* Verifiable fetches may trigger a download */
+ if (verifiable)
fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD;
error = hlcache_handle_retrieve(nsurl,
@@ -1330,14 +1334,15 @@
void browser_window_convert_to_download(struct browser_window *bw,
llcache_handle *stream)
{
+ struct browser_window *root = browser_window_get_root(bw);
nserror error;
- error = download_context_create(stream, bw->window);
+ assert(root != NULL);
+
+ error = download_context_create(stream, root->window);
if (error != NSERROR_OK) {
llcache_handle_abort(stream);
llcache_handle_release(stream);
-
- return;
}
/* remove content from browser window */
11 years, 2 months
r13177 dsilvers - /branches/vince/netsurf-cairo/gtk/bitmap.c
by netsurf@semichrome.net
Author: dsilvers
Date: Wed Nov 23 16:49:13 2011
New Revision: 13177
URL: http://source.netsurf-browser.org?rev=13177&view=rev
Log:
Move the flush to the bitmap_get_buffer call where it belongs
Modified:
branches/vince/netsurf-cairo/gtk/bitmap.c
Modified: branches/vince/netsurf-cairo/gtk/bitmap.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-cairo/gtk/bitmap...
==============================================================================
--- branches/vince/netsurf-cairo/gtk/bitmap.c (original)
+++ branches/vince/netsurf-cairo/gtk/bitmap.c Wed Nov 23 16:49:13 2011
@@ -125,6 +125,9 @@
{
struct bitmap *bitmap = (struct bitmap *)vbitmap;
assert(bitmap);
+
+ cairo_surface_flush (bitmap->surface);
+
return cairo_image_surface_get_data(bitmap->surface);
}
@@ -205,8 +208,6 @@
uint32_t *pixels = (uint32_t *)cairo_image_surface_get_data(bitmap->surface);
uint32_t pixel;
- cairo_surface_flush (bitmap->surface);
-
for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) {
pixel = pixels[pixel_loop];
pixels[pixel_loop] = (pixel & 0xff00ff00) |
11 years, 2 months
r13176 dsilvers - /branches/vince/netsurf-cairo/gtk/bitmap.c
by netsurf@semichrome.net
Author: dsilvers
Date: Wed Nov 23 16:46:08 2011
New Revision: 13176
URL: http://source.netsurf-browser.org?rev=13176&view=rev
Log:
Rearrange bitmap_modified so cairo notices the new pixels
Modified:
branches/vince/netsurf-cairo/gtk/bitmap.c
Modified: branches/vince/netsurf-cairo/gtk/bitmap.c
URL: http://source.netsurf-browser.org/branches/vince/netsurf-cairo/gtk/bitmap...
==============================================================================
--- branches/vince/netsurf-cairo/gtk/bitmap.c (original)
+++ branches/vince/netsurf-cairo/gtk/bitmap.c Wed Nov 23 16:46:08 2011
@@ -205,6 +205,8 @@
uint32_t *pixels = (uint32_t *)cairo_image_surface_get_data(bitmap->surface);
uint32_t pixel;
+ cairo_surface_flush (bitmap->surface);
+
for (pixel_loop=0; pixel_loop < pixel_count; pixel_loop++) {
pixel = pixels[pixel_loop];
pixels[pixel_loop] = (pixel & 0xff00ff00) |
@@ -212,7 +214,8 @@
((pixel & 0xff0000) >> 16);
}
- cairo_surface_flush (bitmap->surface);
+
+ cairo_surface_mark_dirty (bitmap->surface);
}
11 years, 2 months
r13175 mono - in /trunk/netsurf/atari: global_evnt.c global_evnt.h
by netsurf@semichrome.net
Author: mono
Date: Wed Nov 23 16:38:38 2011
New Revision: 13175
URL: http://source.netsurf-browser.org?rev=13175&view=rev
Log:
Moved static declarations.
Modified:
trunk/netsurf/atari/global_evnt.c
trunk/netsurf/atari/global_evnt.h
Modified: trunk/netsurf/atari/global_evnt.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/global_evnt.c?rev=1...
==============================================================================
--- trunk/netsurf/atari/global_evnt.c (original)
+++ trunk/netsurf/atari/global_evnt.c Wed Nov 23 16:38:38 2011
@@ -66,7 +66,18 @@
#define T_HELP MAINMENU_T_NAVIGATE - MAINMENU_T_FILE + 1
/* Count of the above defines: */
#define NUM_MENU_TITLES 7
-static char * menu_titles[NUM_MENU_TITLES] = {NULL};
+static char * menu_titles[NUM_MENU_TITLES] = {NULL};
+
+/* Global event handlers: */
+static void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] );
+static void __CDECL global_evnt_menu( WINDOW * win, short buff[8] );
+static void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data);
+
+/* Menu event handlers: */
+static void __CDECL menu_about(WINDOW *win, int item, int title, void *data);
+
+static char * get_accel(int mode, char * message, struct s_accelerator * accel);
+static int parse_accel( char * message, struct s_accelerator * accel);
/* Menu event handlers: */
@@ -327,10 +338,9 @@
if( kstate & (K_LSHIFT|K_RSHIFT))
kstate |= K_LSHIFT|K_RSHIFT;
if( window_url_widget_has_focus( gw ) ) {
- /* make sure we report for the root window and report...: */
- done = tb_url_input( gw, nkc );
- if( done ) return;
- } else {
+ /* make sure we report for the root window and report...: */
+ done = tb_url_input( gw, nkc );
+ } else {
gw_tmp = window_list;
/* search for active browser component: */
while( gw_tmp != NULL && done == false ) {
Modified: trunk/netsurf/atari/global_evnt.h
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/global_evnt.h?rev=1...
==============================================================================
--- trunk/netsurf/atari/global_evnt.h (original)
+++ trunk/netsurf/atari/global_evnt.h Wed Nov 23 16:38:38 2011
@@ -63,16 +63,5 @@
void bind_global_events( void );
void unbind_global_events( void );
-/* Global event handlers: */
-static void __CDECL global_evnt_apterm( WINDOW * win, short buff[8] );
-static void __CDECL global_evnt_menu( WINDOW * win, short buff[8] );
-static void __CDECL global_evnt_keybd( WINDOW * win, short buff[8], void * data);
-
-/* Menu event handlers: */
-static void __CDECL menu_about(WINDOW *win, int item, int title, void *data);
-
-
-static char * get_accel(int mode, char * message, struct s_accelerator * accel);
-static int parse_accel( char * message, struct s_accelerator * accel);
#endif
11 years, 2 months
r13174 mono - /trunk/netsurf/atari/plot.c
by netsurf@semichrome.net
Author: mono
Date: Wed Nov 23 16:37:29 2011
New Revision: 13174
URL: http://source.netsurf-browser.org?rev=13174&view=rev
Log:
Removed unused variable, plot_line is now global.
Modified:
trunk/netsurf/atari/plot.c
Modified: trunk/netsurf/atari/plot.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/plot.c?rev=13174&r1...
==============================================================================
--- trunk/netsurf/atari/plot.c (original)
+++ trunk/netsurf/atari/plot.c Wed Nov 23 16:37:29 2011
@@ -41,7 +41,6 @@
GEM_PLOTTER plotter = NULL;
GEM_FONT_PLOTTER fplotter = NULL;
-extern APPvar * appv;
extern short vdih;
/*
@@ -57,9 +56,9 @@
struct s_driver_table_entry * drvinfo;
int flags = 0;
- if( option_atari_dither == 1)
+ if( option_atari_dither == 1)
flags |= PLOT_FLAG_DITHER;
- if( option_atari_transparency == 1 )
+ if( option_atari_transparency == 1 )
flags |= PLOT_FLAG_TRANS;
vdih = app.graf.handle;
@@ -98,14 +97,14 @@
}
}
-bool plot_rectangle( int x0, int y0, int x1, int y1,
+bool plot_rectangle( int x0, int y0, int x1, int y1,
const plot_style_t *style )
{
plotter->rectangle( plotter, x0, y0, x1, y1, style );
return ( true );
}
-static bool plot_line( int x0, int y0, int x1, int y1,
+bool plot_line( int x0, int y0, int x1, int y1,
const plot_style_t *style )
{
plotter->line( plotter, x0, y0, x1, y1, style );
@@ -160,33 +159,33 @@
bool repeat_y = (flags & BITMAPF_REPEAT_Y);
int bmpw,bmph;
struct rect clip;
-
+
if( option_suppress_images != 0 ) {
return( true );
}
- bmpw = bitmap_get_width(bitmap);
+ bmpw = bitmap_get_width(bitmap);
bmph = bitmap_get_height(bitmap);
- if ( repeat_x || repeat_y ) {
+ if ( repeat_x || repeat_y ) {
plotter_get_clip( plotter, &clip );
- if( repeat_x && width == 1 && repeat_y && height == 1 ){
+ if( repeat_x && width == 1 && repeat_y && height == 1 ){
width = MAX( width, clip.x1 - x );
height = MAX( height, clip.y1 - y );
}
else if( repeat_x && width == 1 ){
width = MAX( width, clip.x1 - x);
- }
+ }
else if( repeat_y && height == 1){
height = MAX( height, clip.y1 - y );
- }
+ }
}
if( width != bmpw || height != bmph ) {
plotter->bitmap_resize(plotter, bitmap, width, height );
if( bitmap->resized )
bm = bitmap->resized;
- else
+ else
bm = bitmap;
} else {
bm = bitmap;
@@ -204,7 +203,7 @@
int xf,yf;
int xoff = x;
int yoff = y;
-
+
if (yoff > clip.y0 )
yoff = (clip.y0 - height) + ((yoff - clip.y0) % height);
if (xoff > clip.x0 )
11 years, 2 months
r13173 mono - /trunk/netsurf/atari/filetype.c
by netsurf@semichrome.net
Author: mono
Date: Wed Nov 23 16:35:40 2011
New Revision: 13173
URL: http://source.netsurf-browser.org?rev=13173&view=rev
Log:
Log mimetype
Modified:
trunk/netsurf/atari/filetype.c
Modified: trunk/netsurf/atari/filetype.c
URL: http://source.netsurf-browser.org/trunk/netsurf/atari/filetype.c?rev=1317...
==============================================================================
--- trunk/netsurf/atari/filetype.c (original)
+++ trunk/netsurf/atari/filetype.c Wed Nov 23 16:35:40 2011
@@ -27,39 +27,43 @@
#include "utils/log.h"
#include "content/fetch.h"
-
/**
* filetype -- determine the MIME type of a local file
*/
const char *fetch_filetype(const char *unix_path)
{
- int l;
- LOG(("unix path %s", unix_path));
- l = strlen(unix_path);
- /* This line is adding for devlopment versions running from the root dir: */
+ int l;
+ char * res = (char*)"text/html";
+ l = strlen(unix_path);
+
+ LOG(("unix path: %s", unix_path));
+
+ /* This line is added for devlopment versions running from the root dir: */
if (2 < l && strcasecmp(unix_path + l - 3, "f79") == 0)
- return "text/css";
- if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0)
- return "text/css";
- if (2 < l && strcasecmp(unix_path + l - 3, "jpg") == 0)
- return "image/jpeg";
- if (3 < l && strcasecmp(unix_path + l - 4, "jpeg") == 0)
- return "image/jpeg";
- if (2 < l && strcasecmp(unix_path + l - 3, "gif") == 0)
- return "image/gif";
- if (2 < l && strcasecmp(unix_path + l - 3, "png") == 0)
- return "image/png";
- if (2 < l && strcasecmp(unix_path + l - 3, "jng") == 0)
- return "image/jng";
- if (2 < l && strcasecmp(unix_path + l - 3, "svg") == 0)
- return "image/svg";
- if (2 < l && strcasecmp(unix_path + l - 3, "txt") == 0)
- return "text/plain";
- return "text/html";
+ res = (char*)"text/css";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "css") == 0)
+ res = (char*)"text/css";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "jpg") == 0)
+ res = (char*)"image/jpeg";
+ else if (3 < l && strcasecmp(unix_path + l - 4, "jpeg") == 0)
+ res = (char*)"image/jpeg";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "gif") == 0)
+ res = (char*)"image/gif";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "png") == 0)
+ res = (char*)"image/png";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "jng") == 0)
+ res = (char*)"image/jng";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "svg") == 0)
+ res = (char*)"image/svg";
+ else if (2 < l && strcasecmp(unix_path + l - 3, "txt") == 0)
+ res = (char*)"text/plain";
+error:
+ LOG(("mime type: %s", res ));
+ return( res );
}
char *fetch_mimetype(const char *ro_path)
{
return strdup("text/plain");
-}
+}
11 years, 2 months