Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Cameron Cawley
Browse
Commits
e36770dc
Commit
e36770dc
authored
27 years ago
by
Kevin Bracey
Browse files
Options
Download
Email Patches
Plain Diff
Made INPUT type=image work
parent
fe3e2b89
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
302 additions
and
221 deletions
+302
-221
c/Browser
c/Browser
+11
-5
c/Fetch
c/Fetch
+13
-12
c/FontManage
c/FontManage
+20
-20
c/Forms
c/Forms
+103
-86
c/Handlers
c/Handlers
+45
-22
c/Images
c/Images
+2
-2
c/Redraw
c/Redraw
+38
-28
c/Reformat
c/Reformat
+58
-34
h/Browser
h/Browser
+7
-7
h/FontManage
h/FontManage
+2
-2
h/Forms
h/Forms
+2
-2
h/Reformat
h/Reformat
+1
-1
No files found.
c/Browser
View file @
e36770dc
...
...
@@ -1249,7 +1249,8 @@ int browser_move_selection(browser_data * b, int key)
)
form_click_field
(
owner
,
new
,
key
==
akbd_RightK
?
1
:
2
);
key
==
akbd_RightK
?
1
:
2
,
0
,
0
);
/* Turn the pointer off, and reset the check to see if */
/* the user has moved it manually. */
...
...
@@ -1303,7 +1304,9 @@ static int browser_navigate_map(browser_data * b, int key)
{
tp
=
browser_get_pointer_token
(
b
,
&
p
,
NULL
,
NULL
);
if
(
tp
&&
redraw_selected
(
b
,
tp
)
&&
(
tp
->
style
&
IMG
)
&&
(
tp
->
type
&
TYPE_ISMAP
))
if
(
tp
&&
redraw_selected
(
b
,
tp
)
&&
(((
tp
->
style
&
IMG
)
&&
(
tp
->
type
&
TYPE_ISMAP
))
||
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype_IMAGE
)))
{
int
last_move
=
4
;
int
last_key
,
start_key
;
...
...
@@ -1676,7 +1679,9 @@ int browser_pointer_check(int eventcode, WimpPollBlock * b, IdBlock * idb, brows
if
((
tp
->
style
&
IMG
)
&&
(
tp
->
type
&
TYPE_ISMAP
))
mouse_set_pointer_shape
(
Mouse_Shape_Map
);
else
mouse_set_pointer_shape
(
Mouse_Shape_Link
);
}
else
mouse_set_pointer_shape
(
Mouse_Shape_Normal
);
else
if
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype_IMAGE
)
mouse_set_pointer_shape
(
Mouse_Shape_Link
);
else
mouse_set_pointer_shape
(
Mouse_Shape_Normal
);
}
/* If the mouse pointer is on, then update the status bar */
...
...
@@ -2010,13 +2015,14 @@ static HStream * browser_get_pointer_token_r(browser_data * b, reformat_cell * c
/* If the token represents an image... */
else
if
(
tp
->
style
&
IMG
)
else
if
((
tp
->
style
&
IMG
)
||
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype_IMAGE
))
{
reformat_get_image_size
(
b
,
tp
,
&
box
);
/* Correct for the border size, if the image is a link */
if
(
ISLINK
(
tp
))
if
(
ISLINK
(
tp
)
&&
(
tp
->
style
&
IMG
)
)
{
int
b
;
...
...
This diff is collapsed.
Click to expand it.
c/Fetch
View file @
e36770dc
...
...
@@ -219,8 +219,9 @@ void * fetch_token_data_address(browser_data * b, HStream * token)
{
/* No data for horizontal rules or images */
if
(
token
->
style
&
HR
)
return
NULL
;
if
(
token
->
style
&
IMG
)
return
NULL
;
if
(
token
->
style
&
HR
)
return
NULL
;
if
(
token
->
style
&
IMG
)
return
NULL
;
if
((
token
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
token
)
==
inputtype_IMAGE
)
return
NULL
;
/* Otherwise, return a pointer to the text */
...
...
@@ -431,16 +432,16 @@ void fetch_preprocess_token(browser_data * b, HStream * tptr)
if
(
tptr
->
style
&
INPUT
)
{
switch
(
tptr
->
type
&
TYPE_RESET
)
switch
(
HtmlINPUTtype
(
tptr
)
)
{
case
TYPE
_TEXT
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_text
,
tptr
->
text
)))
return
;
break
;
case
TYPE
_PASSWORD
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_password
,
tptr
->
text
)))
return
;
break
;
case
TYPE
_CHECKBOX
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_checkbox
,
(
char
*
)
(
tptr
->
type
&
TYPE_CHECKED
)
)))
return
;
break
;
case
TYPE
_RADIO
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_radio
,
(
char
*
)
(
tptr
->
type
&
TYPE_CHECKED
)
)))
return
;
break
;
case
TYPE
_IMAGE
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_image
,
NULL
)))
return
;
break
;
case
TYPE
_HIDDEN
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_hidden
,
NULL
)))
return
;
break
;
case
TYPE
_SUBMIT
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_submit
,
NULL
)))
return
;
break
;
case
TYPE
_RESET
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_reset
,
NULL
)))
return
;
break
;
case
inputtype
_TEXT
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_text
,
tptr
->
text
)))
return
;
break
;
case
inputtype
_PASSWORD
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_password
,
tptr
->
text
)))
return
;
break
;
case
inputtype
_CHECKBOX
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_checkbox
,
(
char
*
)
HtmlINPUTchecked
(
tptr
)
)))
return
;
break
;
case
inputtype
_RADIO
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_radio
,
(
char
*
)
HtmlINPUTchecked
(
tptr
)
)))
return
;
break
;
case
inputtype
_IMAGE
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_image
,
NULL
)))
return
;
break
;
case
inputtype
_HIDDEN
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_hidden
,
NULL
)))
return
;
break
;
case
inputtype
_SUBMIT
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_submit
,
NULL
)))
return
;
break
;
case
inputtype
_RESET
:
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_reset
,
NULL
)))
return
;
break
;
}
}
...
...
@@ -455,7 +456,7 @@ void fetch_preprocess_token(browser_data * b, HStream * tptr)
if
((
tptr
->
style
)
&
SELECT
)
{
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_select
,
tptr
->
value
)))
return
;
if
(
fetch_chkerror
(
b
,
form_new_field
(
b
,
tptr
,
form_select
,
(
char
*
)
HtmlSELECToptions
(
tptr
)
)))
return
;
}
b
->
formflag
=
1
;
...
...
This diff is collapsed.
Click to expand it.
c/FontManage
View file @
e36770dc
...
...
@@ -981,7 +981,7 @@ _kernel_oserror * fm_set_font_colour(fm_face h, int fore, int back)
/* Font Manager earlier than v3.37. */
/*************************************************/
_kernel_oserror
*
fm_puts
(
fm_face
h
,
int
x
,
int
y
,
char
*
s
,
int
os
,
int
blend
)
_kernel_oserror
*
fm_puts
(
fm_face
h
,
int
x
,
int
y
,
const
char
*
s
,
int
os
,
int
blend
)
{
#ifdef TRACE
if
(
tl
&
(
1u
<<
10
))
Printf
(
"
\n
fm_puts: Called with handle %p
\n
String '%s'
\n
"
,(
void
*
)
h
,
s
);
...
...
@@ -1450,7 +1450,7 @@ void fm_shutdown(void)
/* Returns: See parameters list. */
/*************************************************/
_kernel_oserror
*
fm_get_string_width
(
fm_face
h
,
char
*
s
,
int
maxwid
,
int
maxbytes
,
_kernel_oserror
*
fm_get_string_width
(
fm_face
h
,
const
char
*
s
,
int
maxwid
,
int
maxbytes
,
int
split
,
int
*
bytes
,
int
*
width
)
{
if
(
h
>=
0
)
...
...
@@ -1464,13 +1464,13 @@ _kernel_oserror * fm_get_string_width(fm_face h, char * s, int maxwid, int maxby
e
=
_swix
(
Font_SetFont
,
_IN
(
0
),
h
);
/* Force a terminator in the string */
if
(
maxbytes
<
strlen
(
s
))
{
c1
=
s
[
maxbytes
];
s
[
maxbytes
]
=
0
;
}
//
/* Force a terminator in the string */
//
//
if (maxbytes < strlen(s))
//
{
//
c1 = s[maxbytes];
//
s[maxbytes] = 0;
//
}
/* Get the width */
...
...
@@ -1520,7 +1520,7 @@ _kernel_oserror * fm_get_string_width(fm_face h, char * s, int maxwid, int maxby
if
(
!
e
&&
!*
width
&&
split
>
0
)
{
char
*
p
=
s
;
const
char
*
p
=
s
;
/* Adjust the string length to the first split character. */
/* (Thanks to Tony Cheal for spotting this when doing */
...
...
@@ -1532,13 +1532,13 @@ _kernel_oserror * fm_get_string_width(fm_face h, char * s, int maxwid, int maxby
while
(
*
p
&&
*
(
p
++
)
!=
split
);
/* Force a terminator at the split character, if found */
if
(
*
p
)
{
c2
=
*
p
;
*
p
=
0
;
}
//
/* Force a terminator at the split character, if found */
//
//
if (*p)
//
{
//
c2 = *p;
//
*p = 0;
//
}
/* Now call the Font Manager without asking for a split, knowing that */
/* the string length only runs up to the split character. */
...
...
@@ -1550,19 +1550,19 @@ _kernel_oserror * fm_get_string_width(fm_face h, char * s, int maxwid, int maxby
0x1000000
,
/* Maximum width if splitting is allowed */
0x1000000
,
/* Maximum height if splitting is allowed */
-
1
,
/* Character to split on, or -1 for no split */
maxbytes
,
/* Maximum string length */
p
-
s
/*
maxbytes
*/
,
/* Maximum string length */
width
,
/* Width of scanned string */
bytes
);
/* Length of scanned string */
/* Restore the overwritten character, if any */
if
(
c2
)
*
p
=
c2
;
//
if (c2) *p = c2;
}
/* Put the character that was overwritten by a terminator (if any) back */
if
(
c1
)
s
[
maxbytes
]
=
c1
;
//
if (c1) s[maxbytes] = c1;
/* Exit if there was some error */
...
...
This diff is collapsed.
Click to expand it.
c/Forms
View file @
e36770dc
This diff is collapsed.
Click to expand it.
c/Handlers
View file @
e36770dc
...
...
@@ -1521,6 +1521,42 @@ int handle_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_data
return
0
;
}
/*************************************************/
/* handle_calc_image_click_coords() */
/* */
/* Calculate the coordinates of a click on an */
/* image in pixels from the top left corner, as */
/* required by image maps and image input */
/* fields. */
/*************************************************/
int
handle_calc_image_click_coords
(
HStream
*
p
,
WimpGetPointerInfoBlock
*
i
,
int
*
x
,
int
*
y
,
browser_data
*
handle
)
{
WimpGetWindowStateBlock
s
;
BBox
box
;
/* Get the image's size and position on screen */
s
.
window_handle
=
handle
->
window_handle
;
if
(
wimp_get_window_state
(
&
s
))
return
0
;
if
(
image_get_token_image_size
(
handle
,
p
,
&
box
))
return
0
;
if
(
image_get_token_image_position
(
handle
,
p
,
x
,
y
))
return
0
;
*
x
=
coords_x_toscreen
(
*
x
,
(
WimpRedrawWindowBlock
*
)
&
s
);
*
y
=
coords_y_toscreen
(
*
y
,
(
WimpRedrawWindowBlock
*
)
&
s
);
/* Get the offset of the pointer position from the top left */
/* of the image in ox and oy */
*
x
=
i
->
x
-
*
x
;
*
y
=
*
y
+
(
box
.
ymax
-
box
.
ymin
)
-
i
->
y
;
image_convert_to_pixels
(
handle
,
p
,
x
,
y
);
return
1
;
}
/*************************************************/
/* handle_link_clicks() */
/* */
...
...
@@ -1595,7 +1631,12 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
)
)
{
ChkError
(
form_click_field
(
handle
,
p
,
0
));
int
x
=
0
,
y
=
0
;
if
((
p
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
p
)
==
inputtype_IMAGE
&&
eventcode
>=
0
)
handle_calc_image_click_coords
(
p
,
&
i
,
&
x
,
&
y
,
handle
);
ChkError
(
form_click_field
(
handle
,
p
,
0
,
x
,
y
));
used
=
1
;
}
else
...
...
@@ -1643,11 +1684,8 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
if
((
p
->
style
&
IMG
)
&&
(
p
->
type
&
TYPE_ISMAP
))
{
WimpGetWindowStateBlock
s
;
char
coords
[
64
];
browser_data
*
targetted
;
BBox
box
;
int
x
,
y
;
if
(
eventcode
<
0
)
{
...
...
@@ -1656,27 +1694,12 @@ int handle_link_clicks(int eventcode, WimpPollBlock * b, IdBlock * idb, browser_
if
(
!
p
)
return
0
;
}
/* Get the image's size and position on screen */
s
.
window_handle
=
handle
->
window_handle
;
if
(
wimp_get_window_state
(
&
s
))
return
0
;
if
(
image_get_token_image_size
(
handle
,
p
,
&
box
))
return
0
;
if
(
image_get_token_image_position
(
handle
,
p
,
&
x
,
&
y
))
return
0
;
x
=
coords_x_toscreen
(
x
,
(
WimpRedrawWindowBlock
*
)
&
s
);
y
=
coords_y_toscreen
(
y
,
(
WimpRedrawWindowBlock
*
)
&
s
);
/* Get the offset of the pointer position from the top left */
/* of the image in ox and oy */
ox
=
i
.
x
-
x
;
oy
=
y
+
(
box
.
ymax
-
box
.
ymin
)
-
i
.
y
;
/* Find out which pixel we clicked on */
handle_calc_image_click_coords
(
p
,
&
i
,
&
ox
,
&
oy
,
handle
);
if
(
ox
>=
0
&&
oy
>=
0
)
{
/* Convert the coordinate to pixels and build an appropriate */
/* CGI string including this information. */
/* Build an appropriate CGI string including this information. */
image_convert_to_pixels
(
handle
,
p
,
&
ox
,
&
oy
);
sprintf
(
coords
,
"?%d,%d"
,
ox
,
oy
);
...
...
This diff is collapsed.
Click to expand it.
c/Images
View file @
e36770dc
...
...
@@ -886,7 +886,7 @@ _kernel_oserror * image_new_image(browser_data * b, const char * url, HStream *
/* width and height fields according to any details in the */
/* HTML source. */
if
(
!
background
)
if
(
!
background
&&
!
(
tp
->
style
&
INPUT
)
)
{
if
(
tp
->
cols
>
0
)
idata
[
nimages
].
currw
=
tp
->
cols
*
2
;
if
(
tp
->
rows
>
0
)
idata
[
nimages
].
currh
=
tp
->
rows
*
2
;
...
...
@@ -2294,7 +2294,7 @@ static _kernel_oserror * image_update_image(browser_data * b, int image, BBox *
/* correct its X and Y coordinates appropriately */
o
=
0
;
if
(
ISLINK
(
tp
))
o
=
tp
->
maxlen
*
2
;
if
(
ISLINK
(
tp
)
&&
(
tp
->
style
&
IMG
)
)
o
=
tp
->
maxlen
*
2
;
x
+=
o
;
y
+=
ibox
.
ymin
+
o
;
...
...
This diff is collapsed.
Click to expand it.
c/Redraw
View file @
e36770dc
...
...
@@ -1627,9 +1627,9 @@ _kernel_oserror * redraw_draw_r(int toplevel, int xorg, int yorg, browser_data *
/* A text-based element */
if
(
(
tp
->
ty
p
e
&
TYPE_RESET
)
==
TYPE_TEXT
||
(
tp
->
type
&
TYPE_RESET
)
==
TYPE_PASSWORD
||
(
tp
->
style
&
(
TEXTAREA
|
SELECT
))
(
tp
->
s
ty
l
e
&
(
TEXTAREA
|
SELECT
))
||
HtmlINPUTtype
(
tp
)
==
inputtype_TEXT
||
HtmlINPUTtype
(
tp
)
==
inputtype_PASSWORD
)
{
BBox
box
;
...
...
@@ -1676,7 +1676,7 @@ _kernel_oserror * redraw_draw_r(int toplevel, int xorg, int yorg, browser_data *
&
r
->
redraw_area
,
fh
,
!!
(
tp
->
style
&
TEXTAREA
),
(
tp
->
ty
p
e
&
TYPE_RESET
)
==
TYPE
_PASSWORD
);
(
tp
->
s
ty
l
e
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype
_PASSWORD
);
}
/* If the element is a SELECT field, it needs a menu icon too */
...
...
@@ -1740,37 +1740,41 @@ _kernel_oserror * redraw_draw_r(int toplevel, int xorg, int yorg, browser_data *
// }
}
}
else
switch
(
tp
->
type
&
TYPE_RESET
)
else
switch
(
HtmlINPUTtype
(
tp
)
)
{
/* Graphics-based forms elements */
case
TYPE_CHECKBOX
:
if
(
nocontent
!=
tp
)
redraw_switch
(
b
,
tp
,
x
,
y
+
base
,
form_get_field
(
b
,
d
->
cdata
[
cn
].
t
)
->
checked
?
"fopton"
:
"foptoff"
,
r
);
case
inputtype_CHECKBOX
:
if
(
nocontent
!=
tp
)
redraw_switch
(
b
,
tp
,
x
,
y
+
base
,
form_get_field
(
b
,
d
->
cdata
[
cn
].
t
)
->
checked
?
"fopton"
:
"foptoff"
,
r
);
break
;
case
TYPE_RADIO
:
if
(
nocontent
!=
tp
)
redraw_switch
(
b
,
tp
,
x
,
y
+
base
,
form_get_field
(
b
,
d
->
cdata
[
cn
].
t
)
->
checked
?
"fradioon"
:
"fradiooff"
,
r
);
case
inputtype_RADIO
:
if
(
nocontent
!=
tp
)
redraw_switch
(
b
,
tp
,
x
,
y
+
base
,
form_get_field
(
b
,
d
->
cdata
[
cn
].
t
)
->
checked
?
"fradioon"
:
"fradiooff"
,
r
);
break
;
case
TYPE_IMAGE
:
case
TYPE_HIDDEN
:
break
;
case
inputtype_IMAGE
:
goto
do_image
;
case
inputtype_HIDDEN
:
break
;
case
TYPE
_SUBMIT
:
/* SUBMIT same as RESET: no break */
case
TYPE
_RESET
:
case
inputtype
_SUBMIT
:
/* SUBMIT same as RESET: no break */
case
inputtype
_RESET
:
{
BBox
box
;
int
fh
,
ox
,
oy
,
colour
;
char
*
p
;
BBox
box
;
int
fh
,
ox
,
oy
,
colour
;
const
char
*
p
;
p
=
form_button_text
(
tp
);
...
...
@@ -1845,7 +1849,11 @@ _kernel_oserror * redraw_draw_r(int toplevel, int xorg, int yorg, browser_data *
else
if
(
tp
->
style
&
IMG
)
{
BBox
box
;
int
ox
,
oy
,
o
=
0
;
int
ox
,
oy
,
o
;
do_image:
o
=
0
;
convert_pair_to_os
(
x
,
y
+
base
,
&
ox
,
&
oy
);
...
...
@@ -1874,7 +1882,7 @@ _kernel_oserror * redraw_draw_r(int toplevel, int xorg, int yorg, browser_data *
if
(
ISLINK
(
tp
))
{
o
=
tp
->
maxlen
*
2
;
o
=
(
tp
->
style
&
IMG
)
?
tp
->
maxlen
*
2
:
4
;
if
(
o
)
{
...
...
@@ -1887,6 +1895,8 @@ _kernel_oserror * redraw_draw_r(int toplevel, int xorg, int yorg, browser_data *
}
else
if
(
redraw_selected
(
b
,
tp
))
redraw_border_around_box
(
&
box
,
b
->
selecol
);
}
else
if
((
tp
->
style
&
INPUT
)
&&
redraw_selected
(
b
,
tp
))
redraw_border_around_box
(
&
box
,
b
->
selecol
);
/* Redraw the image itself */
...
...
This diff is collapsed.
Click to expand it.
c/Reformat
View file @
e36770dc
...
...
@@ -162,7 +162,8 @@ _kernel_oserror * reformat_stop(browser_data * b)
static
int
reformat_istext
(
HStream
*
tp
)
{
return
(((
tp
->
style
)
&
(
IMG
|
HR
))
==
0
);
return
(((
tp
->
style
)
&
(
IMG
|
HR
))
==
0
&&
!
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype_IMAGE
));
}
/*************************************************/
...
...
@@ -194,6 +195,7 @@ static int reformat_istext(HStream * tp)
static
_kernel_oserror
*
reformat_token_width
(
reformat_width_data
*
w
,
unsigned
int
flags
)
{
_kernel_oserror
*
e
=
NULL
;
BBox
box
;
/* Deal with tables */
...
...
@@ -281,13 +283,12 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
else
if
(
w
->
tp
->
style
&
(
INPUT
|
TEXTAREA
|
SELECT
))
{
if
(
(
w
->
tp
->
type
&
TYPE_RESET
)
==
TYPE
_TEXT
||
(
w
->
tp
->
type
&
TYPE_RESET
)
==
TYPE
_PASSWORD
||
(
w
->
tp
->
style
&
(
TEXTAREA
|
SELECT
)
)
if
(
(
w
->
tp
->
style
&
(
TEXTAREA
|
SELECT
)
||
HtmlINPUTtype
(
w
->
tp
)
==
inputtype
_TEXT
||
HtmlINPUTtype
(
w
->
tp
)
==
inputtype
_PASSWORD
)
)
{
BBox
box
;
int
h
,
length
,
extra
=
0
;
if
(
w
->
tp
->
style
&
TEXTAREA
)
...
...
@@ -314,7 +315,7 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
width
+=
32
;
/* Account for border and gap */
convert_to_points
(
width
,
&
extra
);
p
=
w
->
tp
->
value
+
8
;
p
=
(
char
*
)
HtmlSELECToptions
(
w
->
tp
)
+
8
;
l
=
8
;
while
(
*
p
!=
0xff
)
...
...
@@ -330,7 +331,7 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
{
/* One line writable */
length
=
w
->
tp
->
size
;
length
=
HtmlINPUTsize
(
w
->
tp
)
;
if
(
length
==
1
)
length
=
2
;
else
if
(
length
<
2
)
...
...
@@ -361,12 +362,12 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
return
e
;
}
else
switch
(
w
->
tp
->
type
&
TYPE_RESET
)
else
switch
(
HtmlINPUTtype
(
w
->
tp
)
)
{
case
TYPE
_SUBMIT
:
/*; no break - same as RESET */
case
TYPE
_RESET
:
case
inputtype
_SUBMIT
:
/*; no break - same as RESET */
case
inputtype
_RESET
:
{
char
*
p
;
const
char
*
p
;
int
h
,
length
,
end
;
p
=
form_button_text
(
w
->
tp
);
...
...
@@ -395,7 +396,7 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
}
break
;
case
TYPE
_CHECKBOX
:
case
inputtype
_CHECKBOX
:
{
w
->
bytes
=
0
;
...
...
@@ -405,7 +406,7 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
}
break
;
case
TYPE
_RADIO
:
case
inputtype
_RADIO
:
{
w
->
bytes
=
0
;
...
...
@@ -415,17 +416,23 @@ static _kernel_oserror * reformat_token_width(reformat_width_data * w, unsigned
}
break
;
case
TYPE_IMAGE
:
case
TYPE_HIDDEN
:
case
inputtype_HIDDEN
:
{
w
->
width
=
w
->
bytes
=
0
;
}
break
;
case
inputtype_IMAGE
:
{
goto
do_image
;
}
break
;
}
}
else
if
(
w
->
tp
->
style
&
IMG
)
{
BBox
box
;
do_image:
w
->
bytes
=
0
;
w
->
width
=
0
;
...
...
@@ -1201,27 +1208,41 @@ void reformat_free_queue(browser_data * b)
_kernel_oserror
*
reformat_get_image_size
(
browser_data
*
b
,
HStream
*
tp
,
BBox
*
box
)
{
_kernel_oserror
*
e
;
imgalign
al
;
e
=
image_get_token_image_size
(
b
,
tp
,
box
);
if
(
e
)
return
e
;
if
(
(
tp
->
ty
p
e
&
TYPE_ALIGN_MASK
)
==
TYPE_MIDDLE
)
if
(
tp
->
s
ty
l
e
&
IMG
)
{
box
->
ymin
-=
box
->
ymax
/
2
;
box
->
ymax
/=
2
;
if
((
tp
->
type
&
TYPE_ALIGN_MASK
)
==
TYPE_MIDDLE
)
al
=
imgalign_MIDDLE
;
else
if
((
tp
->
type
&
TYPE_ALIGN_MASK
)
==
TYPE_TOP
)
al
=
imgalign_TOP
;
else
al
=
imgalign_NONE
;
}
else
al
=
HtmlINPUTalign
(
tp
);
if
((
tp
->
type
&
TYPE_ALIGN_MASK
)
==
TYPE_TOP
)
switch
(
al
)
{
box
->
ymin
=-
box
->
ymax
;
box
->
ymax
=
0
;
case
imgalign_MIDDLE
:
box
->
ymin
-=
box
->
ymax
/
2
;
box
->
ymax
/=
2
;
break
;
case
imgalign_TOP
:
box
->
ymin
=-
box
->
ymax
;
box
->
ymax
=
0
;
break
;
}
/* Deal with links - need to account for a border */
/* of maxlen * 2 pixels width. ISLINK is defined */
/* in Fetch.h. */
if
(
ISLINK
(
tp
))
if
(
ISLINK
(
tp
)
&&
(
tp
->
style
&
IMG
)
)
{
int
b
;
...
...
@@ -1350,7 +1371,8 @@ static _kernel_oserror * reformat_check_height(int toplevel, browser_data * b, r
/* Find out the height of an image */
if
(
tp
->
style
&
IMG
)
if
((
tp
->
style
&
IMG
)
||
(
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype_IMAGE
)
{
BBox
box
;
...
...
@@ -1394,14 +1416,14 @@ static _kernel_oserror * reformat_check_height(int toplevel, browser_data * b, r
/* A few easy to work out forms elements */
else
if
((
tp
->
style
&
INPUT
)
&&
(
tp
->
type
&
TYPE_RESET
)
==
TYPE
_CHECKBOX
)
else
if
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype
_CHECKBOX
)
{
read_sprite_size
(
"fopton"
,
NULL
,
&
top
);
top
-=
8
;
bot
=
8
;
}
else
if
((
tp
->
style
&
INPUT
)
&&
(
tp
->
type
&
TYPE_RESET
)
==
TYPE
_RADIO
)
else
if
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype
_RADIO
)
{
read_sprite_size
(
"fradioon"
,
NULL
,
&
top
);
top
-=
8
;
...
...
@@ -1585,15 +1607,15 @@ static _kernel_oserror * reformat_check_height(int toplevel, browser_data * b, r
{
/* General input types */
switch
(
tp
->
type
&
TYPE_RESET
)
switch
(
HtmlINPUTtype
(
tp
)
)
{
case
TYPE
_TEXT
:
/* No break - same as PASSWORD */
case
TYPE
_PASSWORD
:
case
inputtype
_TEXT
:
/* No break - same as PASSWORD */
case
inputtype
_PASSWORD
:
bot
+=
8
;
top
+=
8
;
break
;
case
TYPE
_SUBMIT
:
/* No break - same as RESET */
case
TYPE
_RESET
:
case
inputtype
_SUBMIT
:
/* No break - same as RESET */
case
inputtype
_RESET
:
bot
+=
8
;
top
+=
12
;
break
;
...
...
@@ -2430,7 +2452,9 @@ if (!tpCurr) done = 1;
/* moved. The new position will be set when the reformatted */
/* region is next redrawn. */
if
(
tpCurr
->
style
&
IMG
)
image_set_token_image_position
(
b
,
tpCurr
,
-
1
,
-
1
);
if
(
tpCurr
->
style
&
IMG
||
((
tpCurr
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tpCurr
)
==
inputtype_IMAGE
))
image_set_token_image_position
(
b
,
tpCurr
,
-
1
,
-
1
);
/* If the image has a known width and height, the reformatter has */
/* dealt with it - so the image library can mark it as redrawable */
...
...
@@ -2882,7 +2906,7 @@ void reformat_change_text(browser_data * b, HStream * tp)
/* If we have ALT text for an image, strip off any preceeding */
/* spaces or [s, and any trailing spaces or ]s. */
else
if
(
tp
&&
tp
->
text
&&
(
tp
->
style
&
IMG
))
else
if
(
tp
&&
tp
->
text
&&
(
(
tp
->
style
&
IMG
)
||
((
tp
->
style
&
INPUT
)
&&
HtmlINPUTtype
(
tp
)
==
inputtype_IMAGE
))
)
{
char
*
start
,
*
end
;
char
last
;
...
...
This diff is collapsed.
Click to expand it.
h/Browser
View file @
e36770dc
...
...
@@ -25,13 +25,13 @@
/* (e.g. by drawing a box around it, changing its colour, etc.) and has */
/* some defined action if clicked on. */
#define CanBeSelected(t) (
\
ISLINK(t) ||
\
(
\
((t)->style & (INPUT | TEXTAREA | SELECT)) &&
\
((t)->ty
p
e &
TYPE_RESET) != TYPE_HIDDEN
&&
\
(
(t)->type & TYPE_RESET) != TYPE_IMAGE
\
)
\
#define CanBeSelected(t) ( \
ISLINK(t) || \
(
(t)->style & (TEXTAREA | SELECT)) ||
\
(
\
((t)->
s
ty
l
e &
INPUT) &&
\
(
HtmlINPUTtype(t) != inputtype_HIDDEN)
\
) \
)
/* Function prototypes */
...
...
This diff is collapsed.
Click to expand it.
h/FontManage
View file @
e36770dc
...
...
@@ -70,7 +70,7 @@ _kernel_oserror * fm_rescale_fonts (browser_data * b);
_kernel_oserror
*
fm_font_box
(
fm_face
h
,
BBox
*
box
);
_kernel_oserror
*
fm_set_font_colour
(
fm_face
h
,
int
fore
,
int
back
);
_kernel_oserror
*
fm_puts
(
fm_face
h
,
int
x
,
int
y
,
char
*
s
,
int
os
,
int
blend
);
_kernel_oserror
*
fm_puts
(
fm_face
h
,
int
x
,
int
y
,
const
char
*
s
,
int
os
,
int
blend
);
_kernel_oserror
*
fm_putsl
(
fm_face
handle
,
int
x
,
int
y
,
char
*
s
,
int
chars
,
int
os
,
int
blend
);
_kernel_oserror
*
fm_write_descriptor
(
char
*
name
,
char
*
buffer
);
...
...
@@ -84,7 +84,7 @@ int fm_system_font (void);
void
fm_init
(
int
systemfont
,
int
base_size
);
void
fm_shutdown
(
void
);
_kernel_oserror
*
fm_get_string_width
(
fm_face
h
,
char
*
s
,
int
maxwid
,
int
maxbytes
,
int
split
,
int
*
bytes
,
int
*
width
);
_kernel_oserror
*
fm_get_string_width
(
fm_face
h
,
const
char
*
s
,
int
maxwid
,
int
maxbytes
,
int
split
,
int
*
bytes
,
int
*
width
);
void
fm_token_font_info
(
HStream
*
t
,
int
*
facenum
,
int
*
size
,
int
*
italic
,
int
*
bold
);
fm_face
fm_find_token_font
(
browser_data
*
b
,
HStream
*
t
);
...
...
This diff is collapsed.
Click to expand it.
h/Forms
View file @
e36770dc
...
...
@@ -66,10 +66,10 @@ void form_abandon_menu (void);
int
form_give_focus
(
browser_data
*
b
);
_kernel_oserror
*
form_click_field
(
browser_data
*
b
,
HStream
*
token
,
int
mode
);
_kernel_oserror
*
form_click_field
(
browser_data
*
b
,
HStream
*
token
,
int
mode
,
int
x
,
int
y
);
_kernel_oserror
*
form_cancel_edit
(
browser_data
*
b
);
_kernel_oserror
*
form_finish_edit
(
browser_data
*
b
);
c
har
*
form_button_text
(
HStream
*
tp
);
c
onst
char
*
form_button_text
(
HStream
*
tp
);
int
form_token_cursor_editable
(
browser_data
*
b
,
HStream
*
token
);
_kernel_oserror
*
form_process_key
(
browser_data
*
b
,
int
*
key
);
void
form_select_menu_event
(
WimpPollBlock
*
e
);
...
...
This diff is collapsed.
Click to expand it.
h/Reformat
View file @
e36770dc
...
...
@@ -38,7 +38,7 @@
/* Other tag classification masks */
#define VISUALDATA (HR | IMG
)
/* Does the tag contain displayable data, despite */
#define VISUALDATA (HR | IMG
| INPUT)
/* Does the tag contain displayable data, despite */
/* having no text inside it? If the tag's style */
/* word contains the bit(s) defined here, it is */
/* deemed to contain such data. */
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment