NetSurf
page-info.c
Go to the documentation of this file.
1/*
2 * Copyright 2020 Michael Drake <tlsa@netsurf-browser.org>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Pave info viewer window implementation
22 */
23
24#include <stdlib.h>
25#include <string.h>
26
27#include "css/utils.h"
28
29#include "utils/nsurl.h"
30#include "utils/nscolour.h"
31
32#include "netsurf/mouse.h"
33#include "netsurf/layout.h"
34#include "netsurf/keypress.h"
35#include "netsurf/plotters.h"
36#include "netsurf/core_window.h"
38
39#include "desktop/knockout.h"
40#include "desktop/page-info.h"
43
44/**
45 * Plot style for heading font.
46 */
50 .size = 14 * PLOT_STYLE_SCALE,
51 .flags = FONTF_NONE,
52 .weight = 400,
53 },
56 .size = 14 * PLOT_STYLE_SCALE,
57 .flags = FONTF_NONE,
58 .weight = 400,
59 },
62 .size = 14 * PLOT_STYLE_SCALE,
63 .flags = FONTF_NONE,
64 .weight = 400,
65 },
68 .size = 14 * PLOT_STYLE_SCALE,
69 .flags = FONTF_NONE,
70 .weight = 400,
71 },
74 .size = 14 * PLOT_STYLE_SCALE,
75 .flags = FONTF_NONE,
76 .weight = 400,
77 },
80 .size = 14 * PLOT_STYLE_SCALE,
81 .flags = FONTF_NONE,
82 .weight = 400,
83 },
86 .size = 14 * PLOT_STYLE_SCALE,
87 .flags = FONTF_NONE,
88 .weight = 400,
89 },
90};
91
92/**
93 * Plot style for domain font.
94 */
97 .size = 8 * PLOT_STYLE_SCALE,
98 .flags = FONTF_NONE,
99 .weight = 700,
100};
101
102/**
103 * Plot style for item font.
104 */
107 .size = 11 * PLOT_STYLE_SCALE,
108 .flags = FONTF_NONE,
109 .weight = 400,
110};
111
112/**
113 * Plot style for item detail font.
114 */
117 .size = 11 * PLOT_STYLE_SCALE,
118 .flags = FONTF_NONE,
119 .weight = 400,
120};
121
122/**
123 * Plot style for window background.
124 */
127};
128
129/**
130 * Plot style for hover background.
131 */
134};
135
136/**
137 * An "text" type page info entry.
138 */
140 const char *text;
142 int width;
145};
146
147/**
148 * An "item" type page info entry.
149 */
156 bool hover;
157};
158
159/**
160 * List of page info window entries.
161 */
168};
169
170/**
171 * An entry on a page info window.
172 */
174 /**
175 * List of page info entry types.
176 */
181 /**
182 * Type-specific page info entry data.
183 */
184 union {
187 } u;
188};
189
190/**
191 * The default page info window data.
192 */
194 [PI_ENTRY_HEADER] = {
196 },
197 [PI_ENTRY_DOMAIN] = {
199 .u = {
200 .text = {
201 .style = &pi__domain,
202 },
203 },
204 },
205 [PI_ENTRY_CERT] = {
207 .u = {
208 .item = {
209 .item = {
210 .style = &pi__item,
211 },
212 .detail = {
213 .style = &pi__item_detail,
214 },
215 .hover_bg = &pi__hover,
216 },
217 },
218 },
219 [PI_ENTRY_COOKIES] = {
221 .u = {
222 .item = {
223 .item = {
224 .style = &pi__item,
225 },
226 .detail = {
227 .style = &pi__item_detail,
228 },
229 .hover_bg = &pi__hover,
230 },
231 },
232 },
233};
234
235/**
236 * The page info window structure.
237 */
238struct page_info {
240 struct core_window *cw_h;
241
243 lwc_string *domain;
245
247 unsigned cookies;
248
249 char cookie_text[64];
251
252 int width;
254
256};
257
258/* Exported interface documented in desktop/page_info.h */
260{
263
266
269
272
287
288 return NSERROR_OK;
289}
290
291/* Exported interface documented in desktop/page_info.h */
293{
294 return NSERROR_OK;
295}
296
297/**
298 * Measure the text in the page_info window.
299 *
300 * \param[in] pi The page info window handle.
301 * \return NSERROR_OK on success, appropriate error code otherwise.
302 */
304 struct page_info_text *pit)
305{
306 nserror err;
307 int height_px;
308
309 err = guit->layout->width(pit->style,
310 pit->text, strlen(pit->text),
311 &pit->width);
312 if (err != NSERROR_OK) {
313 return err;
314 }
315
316 /* \todo: This needs to be a helper in plot style or in nscss. */
317 height_px = ((pit->style->size / PLOT_STYLE_SCALE) *
318 FIXTOINT(nscss_screen_dpi) + 36) / 72;
319
320 pit->height = (height_px * 8 + 3) / 6;
321
322 return NSERROR_OK;
323}
324
325/**
326 * Measure the text in the page_info window.
327 *
328 * \param[in] pi The page info window handle.
329 * \return NSERROR_OK on success, appropriate error code otherwise.
330 */
332 struct page_info *pi)
333{
334 nserror err;
335
336 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
337 struct page_info_entry *entry = pi->entries + i;
338 int padding;
339
340 switch (entry->type) {
343 &entry->u.text);
344 if (err != NSERROR_OK) {
345 return err;
346 }
347 if (i == PI_ENTRY_DOMAIN) {
348 entry->u.text.padding_bottom =
349 entry->u.text.height * 3 / 2;
350 }
351 break;
352
355 &entry->u.item.item);
356 if (err != NSERROR_OK) {
357 return err;
358 }
360 &entry->u.item.detail);
361 if (err != NSERROR_OK) {
362 return err;
363 }
364 padding = entry->u.item.item.height / 4;
365 entry->u.item.padding_top = padding;
366 entry->u.item.padding_bottom = padding;
367
368 break;
369 }
370 }
371
373 .u.item.item.height / 2;
374
375 return NSERROR_OK;
376}
377
378/**
379 * Set the text for the page_info window.
380 *
381 * \todo Use messages for internationalisation.
382 *
383 * \param[in] pi The page info window handle.
384 * \return NSERROR_OK on success, appropriate error code otherwise.
385 */
387 struct page_info *pi)
388{
389 int printed;
390 static const char *header[PAGE_STATE__COUNT] = {
391 [PAGE_STATE_UNKNOWN] = "Provenance unknown",
392 [PAGE_STATE_INTERNAL] = "NetSurf data",
393 [PAGE_STATE_LOCAL] = "Local data",
394 [PAGE_STATE_INSECURE] = "Connection not secure",
395 [PAGE_STATE_SECURE_OVERRIDE] = "Connection not secure",
396 [PAGE_STATE_SECURE_ISSUES] = "Connection not secure",
397 [PAGE_STATE_SECURE] = "Connection is secure",
398 };
399 static const char *certificate[PAGE_STATE__COUNT] = {
400 [PAGE_STATE_UNKNOWN] = "Missing",
401 [PAGE_STATE_INTERNAL] = "None",
402 [PAGE_STATE_LOCAL] = "None",
403 [PAGE_STATE_INSECURE] = "Not valid",
404 [PAGE_STATE_SECURE_OVERRIDE] = "Not valid",
405 [PAGE_STATE_SECURE_ISSUES] = "Not valid",
406 [PAGE_STATE_SECURE] = "Valid",
407 };
408
409 assert(pi != NULL);
410 assert(pi->state < PAGE_STATE__COUNT);
411
413 pi->entries[PI_ENTRY_HEADER].u.text.text = header[pi->state];
414 pi->entries[PI_ENTRY_DOMAIN].u.text.text = (pi->domain) ?
415 lwc_string_data(pi->domain) : "<No domain>";
416
417 pi->entries[PI_ENTRY_CERT].u.item.item.text = "Certificate: ";
418 pi->entries[PI_ENTRY_CERT].u.item.detail.text = certificate[pi->state];
419
420 printed = snprintf(pi->cookie_text, sizeof(pi->cookie_text),
421 "(%u in use)", pi->cookies);
422 if (printed < 0) {
423 return NSERROR_UNKNOWN;
424
425 } else if ((unsigned) printed >= sizeof(pi->cookie_text)) {
426 return NSERROR_NOSPACE;
427 }
428 pi->entries[PI_ENTRY_COOKIES].u.item.item.text = "Cookies: ";
430
431 return page_info__measure_text(pi);
432}
433
434/**
435 * Create page info from a browser window.
436 *
437 * \param[in] pi The page info window handle.
438 * \param[in] bw Browser window to show page info for.
439 * \return NSERROR_OK on success, appropriate error code otherwise.
440 */
442 struct page_info *pi,
443 struct browser_window *bw)
444{
446
447 pi->bw = bw;
451 pi->scheme = nsurl_get_scheme_type(url);
452
453 return page_info__set_text(pi);
454}
455
456/**
457 * Check whether an entry is relevant.
458 *
459 * \param[in] entry The page info entry to consider.
460 * \param[in] scheme URL scheme that the page info is for.
461 * \return true if the entry should be hidden, otherwise false.
462 */
463static inline bool page_info__hide_entry(
464 enum pi_entry entry,
465 enum nsurl_scheme_type scheme)
466{
467 switch (entry) {
468 case PI_ENTRY_CERT:
469 if (scheme != NSURL_SCHEME_HTTPS) {
470 return true;
471 }
472 break;
473 case PI_ENTRY_COOKIES:
474 if (scheme != NSURL_SCHEME_HTTP &&
475 scheme != NSURL_SCHEME_HTTPS) {
476 return true;
477 }
478 break;
479 default:
480 break;
481 }
482
483 return false;
484}
485
486/**
487 * Lay out the page info window.
488 *
489 * \param[in] pi The page info window handle.
490 * \return NSERROR_OK on success, appropriate error code otherwise.
491 */
493 struct page_info *pi)
494{
495 int cur_y = 0;
496 int max_x = 0;
497
498 cur_y += pi->window_padding;
499 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
500 struct page_info_entry *entry = pi->entries + i;
501
502 if (page_info__hide_entry(i, pi->scheme)) {
503 continue;
504 }
505
506 switch (entry->type) {
508 cur_y += entry->u.text.height;
509 if (max_x < entry->u.text.width) {
510 max_x = entry->u.text.width;
511 }
512 cur_y += entry->u.text.padding_bottom;
513 break;
514
516 {
517 int full_width = entry->u.item.item.width +
518 entry->u.item.detail.width;
519 cur_y += entry->u.item.padding_top;
520 cur_y += entry->u.item.item.height;
521 if (max_x < full_width) {
522 max_x = full_width;
523 }
524 cur_y += entry->u.item.padding_bottom;
525 }
526 break;
527 }
528 }
529 cur_y += pi->window_padding;
530 max_x += pi->window_padding * 2;
531
532 pi->width = max_x;
533 pi->height = cur_y;
534 return pi->cw_t->update_size(pi->cw_h, max_x, cur_y);
535}
536
537/* Exported interface documented in desktop/page_info.h */
539 const struct core_window_callback_table *cw_t,
540 struct core_window *cw_h,
541 struct browser_window *bw,
542 struct page_info **pi_out)
543{
544 struct page_info *pi;
545 nserror err;
546
547 pi = calloc(1, sizeof(*pi));
548 if (pi == NULL) {
549 return NSERROR_NOMEM;
550 }
551
552 pi->cw_t = cw_t;
553 pi->cw_h = cw_h;
554
555 memcpy(pi->entries, pi__entries, sizeof(pi__entries));
556
557 err = page_info__create_from_bw(pi, bw);
558 if (err != NSERROR_OK) {
560 return err;
561 }
562
563 err = page_info__layout(pi);
564 if (err != NSERROR_OK) {
566 return err;
567 }
568
569 *pi_out = pi;
570 return NSERROR_OK;
571}
572
573/* Exported interface documented in desktop/page_info.h */
575{
576 if (pi->domain != NULL) {
577 lwc_string_unref(pi->domain);
578 }
579 free(pi);
580 return NSERROR_OK;
581}
582
583/* Exported interface documented in desktop/page_info.h */
585{
586 nserror res;
587
588 if (pgi->domain != NULL) {
589 lwc_string_unref(pgi->domain);
590 }
591
592 res = page_info__create_from_bw(pgi, bw);
593 if (res == NSERROR_OK) {
594 res = page_info__layout(pgi);
595 }
596
597 return res;
598}
599
600/**
601 * Render a text entry.
602 *
603 * \param[in] pit The page info window handle.
604 * \param[in] x X-coordinate to plot at.
605 * \param[in] y Y-coordinate to plot at.
606 * \param[in] ctx Current redraw context.
607 * \return NSERROR_OK on success, appropriate error code otherwise.
608 */
610 const struct page_info_text *pit,
611 int x,
612 int y,
613 const struct redraw_context *ctx)
614{
615 int baseline = (pit->height * 3 + 2) / 4;
616
617 ctx->plot->text(ctx, pit->style, x, y + baseline,
618 pit->text, strlen(pit->text));
619
620 return NSERROR_OK;
621}
622
623/* Exported interface documented in desktop/page_info.h */
625 const struct page_info *pi,
626 int x,
627 int y,
628 const struct rect *clip,
629 const struct redraw_context *ctx)
630{
631 struct redraw_context new_ctx = *ctx;
632 struct rect r = {
633 .x0 = clip->x0 + x,
634 .y0 = clip->y0 + y,
635 .x1 = clip->x1 + x,
636 .y1 = clip->y1 + y,
637 };
638 int cur_y = y;
639 nserror err;
640
641 /* Start knockout rendering if it's available for this plotter. */
642 if (ctx->plot->option_knockout) {
643 bool res = knockout_plot_start(ctx, &new_ctx);
644 if (res == false) {
645 return NSERROR_UNKNOWN;
646 }
647 }
648
649 /* Set up clip rectangle and draw background. */
650 new_ctx.plot->clip(&new_ctx, &r);
651 new_ctx.plot->rectangle(&new_ctx, &pi__bg, &r);
652
653 cur_y += pi->window_padding;
654 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
655 const struct page_info_entry *entry = pi->entries + i;
656 int cur_x = x + pi->window_padding;
657
658 if (page_info__hide_entry(i, pi->scheme)) {
659 continue;
660 }
661
662 switch (entry->type) {
665 &entry->u.text,
666 cur_x, cur_y,
667 &new_ctx);
668 if (err != NSERROR_OK) {
669 goto cleanup;
670 }
671 cur_y += entry->u.text.height;
672 cur_y += entry->u.text.padding_bottom;
673 break;
674
676 if (entry->u.item.hover) {
677 r.y0 = cur_y;
678 r.y1 = cur_y + entry->u.item.padding_top +
679 entry->u.item.item.height +
680 entry->u.item.padding_bottom;
681 new_ctx.plot->rectangle(&new_ctx,
682 &pi__hover, &r);
683 }
684 cur_y += entry->u.item.padding_top;
686 &entry->u.item.item,
687 cur_x, cur_y,
688 &new_ctx);
689 if (err != NSERROR_OK) {
690 goto cleanup;
691 }
692 cur_x += entry->u.item.item.width;
694 &entry->u.item.detail,
695 cur_x, cur_y,
696 &new_ctx);
697 if (err != NSERROR_OK) {
698 goto cleanup;
699 }
700 cur_y += entry->u.item.item.height;
701 cur_y += entry->u.item.padding_bottom;
702 break;
703 }
704 }
705
706cleanup:
707 /* Rendering complete */
708 if (ctx->plot->option_knockout) {
709 bool res = knockout_plot_end(ctx);
710 if (res == false) {
711 return NSERROR_UNKNOWN;
712 }
713 }
714
715 return NSERROR_OK;
716}
717
718/**
719 * Handle any clicks on an item.
720 *
721 * \param[in] pi The page info window handle.
722 * \param[in] mouse The current mouse state.
723 * \param[in] clicked The page info window entry to consider clicks on.
724 * \param[out] did_something Set to true if this click did something
725 * \return NSERROR_OK on success, appropriate error code otherwise.
726 */
728 struct page_info *pi,
729 enum browser_mouse_state mouse,
730 enum pi_entry clicked,
731 bool *did_something)
732{
733 nserror err;
734
735 if (!(mouse & BROWSER_MOUSE_CLICK_1)) {
736 return NSERROR_OK;
737 }
738
739 switch (clicked) {
740 case PI_ENTRY_CERT:
742 *did_something = true;
743 break;
744 case PI_ENTRY_COOKIES:
746 *did_something = true;
747 break;
748 default:
749 err = NSERROR_OK;
750 break;
751 }
752
753 return err;
754}
755
756/* Exported interface documented in desktop/page_info.h */
758 struct page_info *pi,
759 enum browser_mouse_state mouse,
760 int x,
761 int y,
762 bool *did_something)
763{
764 int cur_y = 0;
765 nserror err;
766
767 cur_y += pi->window_padding;
768 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
769 struct page_info_entry *entry = pi->entries + i;
770 bool hovering = false;
771 int height;
772
773 if (page_info__hide_entry(i, pi->scheme)) {
774 continue;
775 }
776
777 switch (entry->type) {
779 cur_y += entry->u.text.height;
780 cur_y += entry->u.text.padding_bottom;
781 break;
782
784 height = entry->u.item.padding_top +
785 entry->u.item.item.height +
786 entry->u.item.padding_bottom;
787
788 if (y >= cur_y && y < cur_y + height) {
789 hovering = true;
791 pi, mouse, i, did_something);
792 if (err != NSERROR_OK) {
793 return err;
794 }
795 }
796 if (entry->u.item.hover != hovering) {
797 int w, h;
798 struct rect r = {
799 .x0 = 0,
800 .y0 = cur_y,
801 .y1 = cur_y + height,
802 };
804 pi->cw_h, &w, &h);
805 r.x1 = (pi->width > w) ? pi->width : w;
806
807 pi->cw_t->invalidate(pi->cw_h, &r);
808 }
809 entry->u.item.hover = hovering;
810 cur_y += height;
811 break;
812 }
813 }
814
815 return NSERROR_OK;
816}
817
818/* Exported interface documented in desktop/page_info.h */
820 struct page_info *pi,
821 int32_t key)
822{
823 return NSERROR_OK;
824}
825
826/* Exported interface documented in desktop/page_info.h */
828 struct page_info *pi,
829 int *width,
830 int *height)
831{
832 *width = pi->width;
833 *height = pi->height;
834
835 return NSERROR_OK;
836}
Browser window creation and manipulation interface.
nserror browser_window_show_certificates(struct browser_window *bw)
Show the certificate page for the current page.
nserror browser_window_show_cookies(const struct browser_window *bw)
Open cookie viewer for the current page.
struct nsurl * browser_window_access_url(const struct browser_window *bw)
Access a browser window's URL.
browser_window_page_info_state
Browser window page information states.
@ PAGE_STATE_INSECURE
Insecure page load.
@ PAGE_STATE_UNKNOWN
Unable to determine.
@ PAGE_STATE_SECURE_ISSUES
Secure load, but has insecure elements.
@ PAGE_STATE__COUNT
Count of number of valid page states.
@ PAGE_STATE_SECURE
Secure load.
@ PAGE_STATE_SECURE_OVERRIDE
Secure load, but had to override.
@ PAGE_STATE_LOCAL
Page loaded from file:/// etc.
@ PAGE_STATE_INTERNAL
Page loaded from internal handler.
int browser_window_get_cookie_count(const struct browser_window *bw)
Get the number of cookies in use for the current page.
browser_window_page_info_state browser_window_get_page_info_state(const struct browser_window *bw)
Request the current browser window page info state.
Interface to core window handling.
css_fixed nscss_screen_dpi
Screen DPI in fixed point units: defaults to 90, which RISC OS uses.
Definition: css.c:44
nserror
Enumeration of error codes.
Definition: errors.h:29
@ NSERROR_NOSPACE
Insufficient space.
Definition: errors.h:59
@ NSERROR_UNKNOWN
Unknown error - DO NOT USE.
Definition: errors.h:31
@ NSERROR_NOMEM
Memory exhaustion.
Definition: errors.h:32
@ NSERROR_OK
No error.
Definition: errors.h:30
static struct core_window_callback_table cw_t
Declare Core Window Callbacks:
Definition: treeview.c:534
struct netsurf_table * guit
The global interface table.
Definition: gui_factory.c:49
Interface to core interface table.
Interface to platform-specific layout operation table.
Core mouse and pointer states.
browser_mouse_state
Mouse state.
Definition: mouse.h:43
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
Definition: mouse.h:55
Target independent plotting interface.
Interface to key press operations.
bool knockout_plot_end(const struct redraw_context *ctx)
End a knockout plotting session.
Definition: knockout.c:997
bool knockout_plot_start(const struct redraw_context *ctx, struct redraw_context *knk_ctx)
Start a knockout plotting session.
Definition: knockout.c:971
Knockout rendering (interface).
colour nscolours[NSCOLOUR__COUNT]
NetSurf UI colour table.
Definition: nscolour.c:38
NetSurf UI colours (interface).
@ NSCOLOUR_WIN_EVEN_FG
Definition: nscolour.h:44
@ NSCOLOUR_WIN_EVEN_BG_HOVER
Definition: nscolour.h:43
@ NSCOLOUR_WIN_EVEN_FG_BAD
Definition: nscolour.h:48
@ NSCOLOUR_WIN_EVEN_BG
Definition: nscolour.h:42
@ NSCOLOUR_WIN_EVEN_FG_FADED
Definition: nscolour.h:46
@ NSCOLOUR_WIN_EVEN_FG_GOOD
Definition: nscolour.h:47
NetSurf URL handling (interface).
enum nsurl_scheme_type nsurl_get_scheme_type(const nsurl *url)
Get the scheme type from a NetSurf URL object.
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
@ NSURL_HOST
Definition: nsurl.h:49
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
nsurl_scheme_type
A type for URL schemes.
Definition: nsurl.h:34
@ NSURL_SCHEME_HTTPS
Definition: nsurl.h:37
@ NSURL_SCHEME_HTTP
Definition: nsurl.h:36
nserror page_info_get_size(struct page_info *pi, int *width, int *height)
Get size of page info content area.
Definition: page-info.c:827
static nserror page_info__layout(struct page_info *pi)
Lay out the page info window.
Definition: page-info.c:492
nserror page_info_destroy(struct page_info *pi)
Destroy a page info corewindow.
Definition: page-info.c:574
static plot_font_style_t pi__domain
Plot style for domain font.
Definition: page-info.c:95
static nserror page_info__measure_text(struct page_info *pi)
Measure the text in the page_info window.
Definition: page-info.c:331
nserror page_info_fini(void)
Finalise the page_info module.
Definition: page-info.c:292
nserror page_info_redraw(const struct page_info *pi, int x, int y, const struct rect *clip, const struct redraw_context *ctx)
Redraw the page info window.
Definition: page-info.c:624
static plot_style_t pi__hover
Plot style for hover background.
Definition: page-info.c:132
static nserror page_info__redraw_text_entry(const struct page_info_text *pit, int x, int y, const struct redraw_context *ctx)
Render a text entry.
Definition: page-info.c:609
static plot_font_style_t pi__item
Plot style for item font.
Definition: page-info.c:105
nserror page_info_init(void)
Initialise the page_info module.
Definition: page-info.c:259
bool page_info_keypress(struct page_info *pi, int32_t key)
Key press handling.
Definition: page-info.c:819
static nserror page_info__create_from_bw(struct page_info *pi, struct browser_window *bw)
Create page info from a browser window.
Definition: page-info.c:441
struct page_info_entry pi__entries[PI_ENTRY__COUNT]
The default page info window data.
Definition: page-info.c:193
static bool page_info__hide_entry(enum pi_entry entry, enum nsurl_scheme_type scheme)
Check whether an entry is relevant.
Definition: page-info.c:463
static plot_font_style_t pi__heading[PAGE_STATE__COUNT]
Plot style for heading font.
Definition: page-info.c:47
nserror page_info_set(struct page_info *pgi, struct browser_window *bw)
change the browser window the page information refers to
Definition: page-info.c:584
nserror page_info_create(const struct core_window_callback_table *cw_t, struct core_window *cw_h, struct browser_window *bw, struct page_info **pi_out)
Create a page info corewindow.
Definition: page-info.c:538
static nserror page_info__measure_text_entry(struct page_info_text *pit)
Measure the text in the page_info window.
Definition: page-info.c:303
pi_entry
List of page info window entries.
Definition: page-info.c:162
@ PI_ENTRY__COUNT
Definition: page-info.c:167
@ PI_ENTRY_COOKIES
Definition: page-info.c:166
@ PI_ENTRY_HEADER
Definition: page-info.c:163
@ PI_ENTRY_DOMAIN
Definition: page-info.c:164
@ PI_ENTRY_CERT
Definition: page-info.c:165
static plot_font_style_t pi__item_detail
Plot style for item detail font.
Definition: page-info.c:115
static nserror page_info__handle_item_click(struct page_info *pi, enum browser_mouse_state mouse, enum pi_entry clicked, bool *did_something)
Handle any clicks on an item.
Definition: page-info.c:727
static nserror page_info__set_text(struct page_info *pi)
Set the text for the page_info window.
Definition: page-info.c:386
nserror page_info_mouse_action(struct page_info *pi, enum browser_mouse_state mouse, int x, int y, bool *did_something)
Mouse action handling.
Definition: page-info.c:757
static plot_style_t pi__bg
Plot style for window background.
Definition: page-info.c:125
Pave info viewer window interface.
@ PLOT_OP_TYPE_SOLID
Solid colour.
Definition: plot_style.h:67
@ FONTF_NONE
Definition: plot_style.h:102
@ PLOT_FONT_FAMILY_SANS_SERIF
Definition: plot_style.h:89
#define PLOT_STYLE_SCALE
Scaling factor for plot styles.
Definition: plot_style.h:45
int width
Definition: gui.c:159
int height
Definition: gui.c:160
Interface to utility string handling.
Browser window data.
Callbacks to achieve various core window functionality.
Definition: core_window.h:51
nserror(* get_window_dimensions)(const struct core_window *cw, int *width, int *height)
Get window viewport dimensions.
Definition: core_window.h:113
nserror(* update_size)(struct core_window *cw, int width, int height)
Update the limits of the window.
Definition: core_window.h:79
nserror(* invalidate)(struct core_window *cw, const struct rect *rect)
Invalidate an area of a window.
Definition: core_window.h:69
nserror(* width)(const struct plot_font_style *fstyle, const char *string, size_t length, int *width)
Measure the width of a string.
Definition: layout.h:49
struct gui_layout_table * layout
Layout table.
Definition: gui_table.h:154
An entry on a page info window.
Definition: page-info.c:173
enum page_info_entry::page_info_entry_type type
union page_info_entry::@74 u
Type-specific page info entry data.
struct page_info_item item
Definition: page-info.c:186
page_info_entry_type
List of page info entry types.
Definition: page-info.c:177
@ PAGE_INFO_ENTRY_TYPE_ITEM
Definition: page-info.c:179
@ PAGE_INFO_ENTRY_TYPE_TEXT
Definition: page-info.c:178
struct page_info_text text
Definition: page-info.c:185
An "item" type page info entry.
Definition: page-info.c:150
int padding_bottom
Definition: page-info.c:154
struct page_info_text detail
Definition: page-info.c:152
const plot_style_t * hover_bg
Definition: page-info.c:153
struct page_info_text item
Definition: page-info.c:151
An "text" type page info entry.
Definition: page-info.c:139
const plot_font_style_t * style
Definition: page-info.c:141
const char * text
Definition: page-info.c:140
int padding_bottom
Definition: page-info.c:144
The page info window structure.
Definition: page-info.c:238
int window_padding
Definition: page-info.c:255
enum nsurl_scheme_type scheme
Definition: page-info.c:244
struct browser_window * bw
Definition: page-info.c:242
int width
Definition: page-info.c:252
struct core_window * cw_h
Definition: page-info.c:240
const struct core_window_callback_table * cw_t
Definition: page-info.c:239
unsigned cookies
Definition: page-info.c:247
lwc_string * domain
Definition: page-info.c:243
char cookie_text[64]
Definition: page-info.c:249
browser_window_page_info_state state
Definition: page-info.c:246
int height
Definition: page-info.c:253
struct page_info_entry entries[PI_ENTRY__COUNT]
Definition: page-info.c:250
Font style for plotting.
Definition: plot_style.h:111
plot_font_generic_family_t family
Generic family to plot with.
Definition: plot_style.h:118
colour foreground
Colour of text.
Definition: plot_style.h:123
plot_style_fixed size
Font size, in pt.
Definition: plot_style.h:119
colour background
Background colour to blend to, if appropriate.
Definition: plot_style.h:122
Plot style for stroke/fill plotters.
Definition: plot_style.h:76
colour fill_colour
Colour of fill.
Definition: plot_style.h:81
plot_operation_type_t fill_type
Fill plot type.
Definition: plot_style.h:80
bool option_knockout
flag to enable knockout rendering.
Definition: plotters.h:328
nserror(* text)(const struct redraw_context *ctx, const plot_font_style_t *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
Definition: plotters.h:278
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
Definition: plotters.h:188
nserror(* clip)(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plotters.h:111
Rectangle coordinates.
Definition: types.h:40
int x0
Definition: types.h:41
int y0
Top left.
Definition: types.h:41
int x1
Definition: types.h:42
int y1
Bottom right.
Definition: types.h:42
Redraw context.
Definition: plotters.h:51
const struct plotter_table * plot
Current plot operation table.
Definition: plotters.h:73
Interface to system colour values.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:357