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 {
239 struct core_window *cw_h;
240
242 lwc_string *domain;
244
246 unsigned cookies;
247
248 char cookie_text[64];
250
251 int width;
253
255};
256
257/* Exported interface documented in desktop/page_info.h */
259{
262
265
268
271
286
287 return NSERROR_OK;
288}
289
290/* Exported interface documented in desktop/page_info.h */
292{
293 return NSERROR_OK;
294}
295
296/**
297 * Measure the text in the page_info window.
298 *
299 * \param[in] pi The page info window handle.
300 * \return NSERROR_OK on success, appropriate error code otherwise.
301 */
303 struct page_info_text *pit)
304{
305 nserror err;
306 int height_px;
307
308 err = guit->layout->width(pit->style,
309 pit->text, strlen(pit->text),
310 &pit->width);
311 if (err != NSERROR_OK) {
312 return err;
313 }
314
315 /* \todo: This needs to be a helper in plot style or in nscss. */
316 height_px = ((pit->style->size / PLOT_STYLE_SCALE) *
317 FIXTOINT(nscss_screen_dpi) + 36) / 72;
318
319 pit->height = (height_px * 8 + 3) / 6;
320
321 return NSERROR_OK;
322}
323
324/**
325 * Measure the text in the page_info window.
326 *
327 * \param[in] pi The page info window handle.
328 * \return NSERROR_OK on success, appropriate error code otherwise.
329 */
331 struct page_info *pi)
332{
333 nserror err;
334
335 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
336 struct page_info_entry *entry = pi->entries + i;
337 int padding;
338
339 switch (entry->type) {
342 &entry->u.text);
343 if (err != NSERROR_OK) {
344 return err;
345 }
346 if (i == PI_ENTRY_DOMAIN) {
347 entry->u.text.padding_bottom =
348 entry->u.text.height * 3 / 2;
349 }
350 break;
351
354 &entry->u.item.item);
355 if (err != NSERROR_OK) {
356 return err;
357 }
359 &entry->u.item.detail);
360 if (err != NSERROR_OK) {
361 return err;
362 }
363 padding = entry->u.item.item.height / 4;
364 entry->u.item.padding_top = padding;
365 entry->u.item.padding_bottom = padding;
366
367 break;
368 }
369 }
370
372 .u.item.item.height / 2;
373
374 return NSERROR_OK;
375}
376
377/**
378 * Set the text for the page_info window.
379 *
380 * \todo Use messages for internationalisation.
381 *
382 * \param[in] pi The page info window handle.
383 * \return NSERROR_OK on success, appropriate error code otherwise.
384 */
386 struct page_info *pi)
387{
388 int printed;
389 static const char *header[PAGE_STATE__COUNT] = {
390 [PAGE_STATE_UNKNOWN] = "Provenance unknown",
391 [PAGE_STATE_INTERNAL] = "NetSurf data",
392 [PAGE_STATE_LOCAL] = "Local data",
393 [PAGE_STATE_INSECURE] = "Connection not secure",
394 [PAGE_STATE_SECURE_OVERRIDE] = "Connection not secure",
395 [PAGE_STATE_SECURE_ISSUES] = "Connection not secure",
396 [PAGE_STATE_SECURE] = "Connection is secure",
397 };
398 static const char *certificate[PAGE_STATE__COUNT] = {
399 [PAGE_STATE_UNKNOWN] = "Missing",
400 [PAGE_STATE_INTERNAL] = "None",
401 [PAGE_STATE_LOCAL] = "None",
402 [PAGE_STATE_INSECURE] = "Not valid",
403 [PAGE_STATE_SECURE_OVERRIDE] = "Not valid",
404 [PAGE_STATE_SECURE_ISSUES] = "Not valid",
405 [PAGE_STATE_SECURE] = "Valid",
406 };
407
408 assert(pi != NULL);
409 assert(pi->state < PAGE_STATE__COUNT);
410
412 pi->entries[PI_ENTRY_HEADER].u.text.text = header[pi->state];
413 pi->entries[PI_ENTRY_DOMAIN].u.text.text = (pi->domain) ?
414 lwc_string_data(pi->domain) : "<No domain>";
415
416 pi->entries[PI_ENTRY_CERT].u.item.item.text = "Certificate: ";
417 pi->entries[PI_ENTRY_CERT].u.item.detail.text = certificate[pi->state];
418
419 printed = snprintf(pi->cookie_text, sizeof(pi->cookie_text),
420 "(%u in use)", pi->cookies);
421 if (printed < 0) {
422 return NSERROR_UNKNOWN;
423
424 } else if ((unsigned) printed >= sizeof(pi->cookie_text)) {
425 return NSERROR_NOSPACE;
426 }
427 pi->entries[PI_ENTRY_COOKIES].u.item.item.text = "Cookies: ";
429
430 return page_info__measure_text(pi);
431}
432
433/**
434 * Create page info from a browser window.
435 *
436 * \param[in] pi The page info window handle.
437 * \param[in] bw Browser window to show page info for.
438 * \return NSERROR_OK on success, appropriate error code otherwise.
439 */
441 struct page_info *pi,
442 struct browser_window *bw)
443{
445
446 pi->bw = bw;
450 pi->scheme = nsurl_get_scheme_type(url);
451
452 return page_info__set_text(pi);
453}
454
455/**
456 * Check whether an entry is relevant.
457 *
458 * \param[in] entry The page info entry to consider.
459 * \param[in] scheme URL scheme that the page info is for.
460 * \return true if the entry should be hidden, otherwise false.
461 */
462static inline bool page_info__hide_entry(
463 enum pi_entry entry,
464 enum nsurl_scheme_type scheme)
465{
466 switch (entry) {
467 case PI_ENTRY_CERT:
468 if (scheme != NSURL_SCHEME_HTTPS) {
469 return true;
470 }
471 break;
472 case PI_ENTRY_COOKIES:
473 if (scheme != NSURL_SCHEME_HTTP &&
474 scheme != NSURL_SCHEME_HTTPS) {
475 return true;
476 }
477 break;
478 default:
479 break;
480 }
481
482 return false;
483}
484
485/**
486 * Lay out the page info window.
487 *
488 * \param[in] pi The page info window handle.
489 * \return NSERROR_OK on success, appropriate error code otherwise.
490 */
492 struct page_info *pi)
493{
494 int cur_y = 0;
495 int max_x = 0;
496
497 cur_y += pi->window_padding;
498 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
499 struct page_info_entry *entry = pi->entries + i;
500
501 if (page_info__hide_entry(i, pi->scheme)) {
502 continue;
503 }
504
505 switch (entry->type) {
507 cur_y += entry->u.text.height;
508 if (max_x < entry->u.text.width) {
509 max_x = entry->u.text.width;
510 }
511 cur_y += entry->u.text.padding_bottom;
512 break;
513
515 {
516 int full_width = entry->u.item.item.width +
517 entry->u.item.detail.width;
518 cur_y += entry->u.item.padding_top;
519 cur_y += entry->u.item.item.height;
520 if (max_x < full_width) {
521 max_x = full_width;
522 }
523 cur_y += entry->u.item.padding_bottom;
524 }
525 break;
526 }
527 }
528 cur_y += pi->window_padding;
529 max_x += pi->window_padding * 2;
530
531 pi->width = max_x;
532 pi->height = cur_y;
533 return guit->corewindow->set_extent(pi->cw_h, max_x, cur_y);
534}
535
536/* Exported interface documented in desktop/page_info.h */
537nserror page_info_create(struct core_window *cw_h,
538 struct browser_window *bw,
539 struct page_info **pi_out)
540{
541 struct page_info *pi;
542 nserror err;
543
544 pi = calloc(1, sizeof(*pi));
545 if (pi == NULL) {
546 return NSERROR_NOMEM;
547 }
548
549 pi->cw_h = cw_h;
550
551 memcpy(pi->entries, pi__entries, sizeof(pi__entries));
552
553 err = page_info__create_from_bw(pi, bw);
554 if (err != NSERROR_OK) {
556 return err;
557 }
558
559 err = page_info__layout(pi);
560 if (err != NSERROR_OK) {
562 return err;
563 }
564
565 *pi_out = pi;
566 return NSERROR_OK;
567}
568
569/* Exported interface documented in desktop/page_info.h */
571{
572 lwc_string_unref(pi->domain);
573 free(pi);
574 return NSERROR_OK;
575}
576
577/* Exported interface documented in desktop/page_info.h */
579{
580 nserror res;
581
582 lwc_string_unref(pgi->domain);
583
584 res = page_info__create_from_bw(pgi, bw);
585 if (res == NSERROR_OK) {
586 res = page_info__layout(pgi);
587 }
588
589 return res;
590}
591
592/**
593 * Render a text entry.
594 *
595 * \param[in] pit The page info window handle.
596 * \param[in] x X-coordinate to plot at.
597 * \param[in] y Y-coordinate to plot at.
598 * \param[in] ctx Current redraw context.
599 * \return NSERROR_OK on success, appropriate error code otherwise.
600 */
602 const struct page_info_text *pit,
603 int x,
604 int y,
605 const struct redraw_context *ctx)
606{
607 int baseline = (pit->height * 3 + 2) / 4;
608
609 ctx->plot->text(ctx, pit->style, x, y + baseline,
610 pit->text, strlen(pit->text));
611
612 return NSERROR_OK;
613}
614
615/* Exported interface documented in desktop/page_info.h */
617 const struct page_info *pi,
618 int x,
619 int y,
620 const struct rect *clip,
621 const struct redraw_context *ctx)
622{
623 struct redraw_context new_ctx = *ctx;
624 struct rect r = {
625 .x0 = clip->x0 + x,
626 .y0 = clip->y0 + y,
627 .x1 = clip->x1 + x,
628 .y1 = clip->y1 + y,
629 };
630 int cur_y = y;
631 nserror err;
632
633 /* Start knockout rendering if it's available for this plotter. */
634 if (ctx->plot->option_knockout) {
635 bool res = knockout_plot_start(ctx, &new_ctx);
636 if (res == false) {
637 return NSERROR_UNKNOWN;
638 }
639 }
640
641 /* Set up clip rectangle and draw background. */
642 new_ctx.plot->clip(&new_ctx, &r);
643 new_ctx.plot->rectangle(&new_ctx, &pi__bg, &r);
644
645 cur_y += pi->window_padding;
646 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
647 const struct page_info_entry *entry = pi->entries + i;
648 int cur_x = x + pi->window_padding;
649
650 if (page_info__hide_entry(i, pi->scheme)) {
651 continue;
652 }
653
654 switch (entry->type) {
657 &entry->u.text,
658 cur_x, cur_y,
659 &new_ctx);
660 if (err != NSERROR_OK) {
661 goto cleanup;
662 }
663 cur_y += entry->u.text.height;
664 cur_y += entry->u.text.padding_bottom;
665 break;
666
668 if (entry->u.item.hover) {
669 r.y0 = cur_y;
670 r.y1 = cur_y + entry->u.item.padding_top +
671 entry->u.item.item.height +
672 entry->u.item.padding_bottom;
673 new_ctx.plot->rectangle(&new_ctx,
674 &pi__hover, &r);
675 }
676 cur_y += entry->u.item.padding_top;
678 &entry->u.item.item,
679 cur_x, cur_y,
680 &new_ctx);
681 if (err != NSERROR_OK) {
682 goto cleanup;
683 }
684 cur_x += entry->u.item.item.width;
686 &entry->u.item.detail,
687 cur_x, cur_y,
688 &new_ctx);
689 if (err != NSERROR_OK) {
690 goto cleanup;
691 }
692 cur_y += entry->u.item.item.height;
693 cur_y += entry->u.item.padding_bottom;
694 break;
695 }
696 }
697
698cleanup:
699 /* Rendering complete */
700 if (ctx->plot->option_knockout) {
701 bool res = knockout_plot_end(ctx);
702 if (res == false) {
703 return NSERROR_UNKNOWN;
704 }
705 }
706
707 return NSERROR_OK;
708}
709
710/**
711 * Handle any clicks on an item.
712 *
713 * \param[in] pi The page info window handle.
714 * \param[in] mouse The current mouse state.
715 * \param[in] clicked The page info window entry to consider clicks on.
716 * \param[out] did_something Set to true if this click did something
717 * \return NSERROR_OK on success, appropriate error code otherwise.
718 */
720 struct page_info *pi,
721 enum browser_mouse_state mouse,
722 enum pi_entry clicked,
723 bool *did_something)
724{
725 nserror err;
726
727 if (!(mouse & BROWSER_MOUSE_CLICK_1)) {
728 return NSERROR_OK;
729 }
730
731 switch (clicked) {
732 case PI_ENTRY_CERT:
734 *did_something = true;
735 break;
736 case PI_ENTRY_COOKIES:
738 *did_something = true;
739 break;
740 default:
741 err = NSERROR_OK;
742 break;
743 }
744
745 return err;
746}
747
748/* Exported interface documented in desktop/page_info.h */
750 struct page_info *pi,
751 enum browser_mouse_state mouse,
752 int x,
753 int y,
754 bool *did_something)
755{
756 int cur_y = 0;
757 nserror err;
758
759 cur_y += pi->window_padding;
760 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
761 struct page_info_entry *entry = pi->entries + i;
762 bool hovering = false;
763 int height;
764
765 if (page_info__hide_entry(i, pi->scheme)) {
766 continue;
767 }
768
769 switch (entry->type) {
771 cur_y += entry->u.text.height;
772 cur_y += entry->u.text.padding_bottom;
773 break;
774
776 height = entry->u.item.padding_top +
777 entry->u.item.item.height +
778 entry->u.item.padding_bottom;
779
780 if (y >= cur_y && y < cur_y + height) {
781 hovering = true;
783 pi, mouse, i, did_something);
784 if (err != NSERROR_OK) {
785 return err;
786 }
787 }
788 if (entry->u.item.hover != hovering) {
789 int w, h;
790 struct rect r = {
791 .x0 = 0,
792 .y0 = cur_y,
793 .y1 = cur_y + height,
794 };
795 guit->corewindow->get_dimensions(pi->cw_h, &w, &h);
796 r.x1 = (pi->width > w) ? pi->width : w;
797
798 guit->corewindow->invalidate(pi->cw_h, &r);
799 }
800 entry->u.item.hover = hovering;
801 cur_y += height;
802 break;
803 }
804 }
805
806 return NSERROR_OK;
807}
808
809/* Exported interface documented in desktop/page_info.h */
811 struct page_info *pi,
812 int32_t key)
813{
814 return NSERROR_OK;
815}
816
817/* Exported interface documented in desktop/page_info.h */
819 struct page_info *pi,
820 int *width,
821 int *height)
822{
823 *width = pi->width;
824 *height = pi->height;
825
826 return NSERROR_OK;
827}
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
struct netsurf_table * guit
The global interface table.
Definition: gui_factory.c:50
Interface to core interface table.
Interface to platform-specific layout operation table.
Core mouse and pointer states.
browser_mouse_state
Mouse state: 1 is primary mouse button.
Definition: mouse.h:52
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
Definition: mouse.h:70
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:818
static nserror page_info__layout(struct page_info *pi)
Lay out the page info window.
Definition: page-info.c:491
nserror page_info_destroy(struct page_info *pi)
Destroy a page info corewindow.
Definition: page-info.c:570
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:330
nserror page_info_fini(void)
Finalise the page_info module.
Definition: page-info.c:291
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:616
static plot_style_t pi__hover
Plot style for hover background.
Definition: page-info.c:132
nserror page_info_create(struct core_window *cw_h, struct browser_window *bw, struct page_info **pi_out)
Create a page info corewindow.
Definition: page-info.c:537
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:601
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:258
bool page_info_keypress(struct page_info *pi, int32_t key)
Key press handling.
Definition: page-info.c:810
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:440
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:462
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:578
static nserror page_info__measure_text_entry(struct page_info_text *pit)
Measure the text in the page_info window.
Definition: page-info.c:302
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:719
static nserror page_info__set_text(struct page_info *pi)
Set the text for the page_info window.
Definition: page-info.c:385
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:749
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:161
int height
Definition: gui.c:162
Interface to utility string handling.
Browser window data.
nserror(* set_extent)(struct core_window *cw, int width, int height)
Update the logical extent of the window.
Definition: core_window.h:81
nserror(* get_dimensions)(const struct core_window *cw, int *width, int *height)
Get window viewport dimensions.
Definition: core_window.h:115
nserror(* invalidate)(struct core_window *cw, const struct rect *rect)
Invalidate an area of a window.
Definition: core_window.h:71
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 core_window_table * corewindow
Core window table.
Definition: gui_table.h:75
struct gui_layout_table * layout
Layout table.
Definition: gui_table.h:163
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:254
enum nsurl_scheme_type scheme
Definition: page-info.c:243
struct browser_window * bw
Definition: page-info.c:241
int width
Definition: page-info.c:251
struct core_window * cw_h
Definition: page-info.c:239
unsigned cookies
Definition: page-info.c:246
lwc_string * domain
Definition: page-info.c:242
char cookie_text[64]
Definition: page-info.c:248
browser_window_page_info_state state
Definition: page-info.c:245
int height
Definition: page-info.c:252
struct page_info_entry entries[PI_ENTRY__COUNT]
Definition: page-info.c:249
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:340
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:290
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