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 if (pi->domain != NULL) {
573 lwc_string_unref(pi->domain);
574 }
575 free(pi);
576 return NSERROR_OK;
577}
578
579/* Exported interface documented in desktop/page_info.h */
581{
582 nserror res;
583
584 if (pgi->domain != NULL) {
585 lwc_string_unref(pgi->domain);
586 }
587
588 res = page_info__create_from_bw(pgi, bw);
589 if (res == NSERROR_OK) {
590 res = page_info__layout(pgi);
591 }
592
593 return res;
594}
595
596/**
597 * Render a text entry.
598 *
599 * \param[in] pit The page info window handle.
600 * \param[in] x X-coordinate to plot at.
601 * \param[in] y Y-coordinate to plot at.
602 * \param[in] ctx Current redraw context.
603 * \return NSERROR_OK on success, appropriate error code otherwise.
604 */
606 const struct page_info_text *pit,
607 int x,
608 int y,
609 const struct redraw_context *ctx)
610{
611 int baseline = (pit->height * 3 + 2) / 4;
612
613 ctx->plot->text(ctx, pit->style, x, y + baseline,
614 pit->text, strlen(pit->text));
615
616 return NSERROR_OK;
617}
618
619/* Exported interface documented in desktop/page_info.h */
621 const struct page_info *pi,
622 int x,
623 int y,
624 const struct rect *clip,
625 const struct redraw_context *ctx)
626{
627 struct redraw_context new_ctx = *ctx;
628 struct rect r = {
629 .x0 = clip->x0 + x,
630 .y0 = clip->y0 + y,
631 .x1 = clip->x1 + x,
632 .y1 = clip->y1 + y,
633 };
634 int cur_y = y;
635 nserror err;
636
637 /* Start knockout rendering if it's available for this plotter. */
638 if (ctx->plot->option_knockout) {
639 bool res = knockout_plot_start(ctx, &new_ctx);
640 if (res == false) {
641 return NSERROR_UNKNOWN;
642 }
643 }
644
645 /* Set up clip rectangle and draw background. */
646 new_ctx.plot->clip(&new_ctx, &r);
647 new_ctx.plot->rectangle(&new_ctx, &pi__bg, &r);
648
649 cur_y += pi->window_padding;
650 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
651 const struct page_info_entry *entry = pi->entries + i;
652 int cur_x = x + pi->window_padding;
653
654 if (page_info__hide_entry(i, pi->scheme)) {
655 continue;
656 }
657
658 switch (entry->type) {
661 &entry->u.text,
662 cur_x, cur_y,
663 &new_ctx);
664 if (err != NSERROR_OK) {
665 goto cleanup;
666 }
667 cur_y += entry->u.text.height;
668 cur_y += entry->u.text.padding_bottom;
669 break;
670
672 if (entry->u.item.hover) {
673 r.y0 = cur_y;
674 r.y1 = cur_y + entry->u.item.padding_top +
675 entry->u.item.item.height +
676 entry->u.item.padding_bottom;
677 new_ctx.plot->rectangle(&new_ctx,
678 &pi__hover, &r);
679 }
680 cur_y += entry->u.item.padding_top;
682 &entry->u.item.item,
683 cur_x, cur_y,
684 &new_ctx);
685 if (err != NSERROR_OK) {
686 goto cleanup;
687 }
688 cur_x += entry->u.item.item.width;
690 &entry->u.item.detail,
691 cur_x, cur_y,
692 &new_ctx);
693 if (err != NSERROR_OK) {
694 goto cleanup;
695 }
696 cur_y += entry->u.item.item.height;
697 cur_y += entry->u.item.padding_bottom;
698 break;
699 }
700 }
701
702cleanup:
703 /* Rendering complete */
704 if (ctx->plot->option_knockout) {
705 bool res = knockout_plot_end(ctx);
706 if (res == false) {
707 return NSERROR_UNKNOWN;
708 }
709 }
710
711 return NSERROR_OK;
712}
713
714/**
715 * Handle any clicks on an item.
716 *
717 * \param[in] pi The page info window handle.
718 * \param[in] mouse The current mouse state.
719 * \param[in] clicked The page info window entry to consider clicks on.
720 * \param[out] did_something Set to true if this click did something
721 * \return NSERROR_OK on success, appropriate error code otherwise.
722 */
724 struct page_info *pi,
725 enum browser_mouse_state mouse,
726 enum pi_entry clicked,
727 bool *did_something)
728{
729 nserror err;
730
731 if (!(mouse & BROWSER_MOUSE_CLICK_1)) {
732 return NSERROR_OK;
733 }
734
735 switch (clicked) {
736 case PI_ENTRY_CERT:
738 *did_something = true;
739 break;
740 case PI_ENTRY_COOKIES:
742 *did_something = true;
743 break;
744 default:
745 err = NSERROR_OK;
746 break;
747 }
748
749 return err;
750}
751
752/* Exported interface documented in desktop/page_info.h */
754 struct page_info *pi,
755 enum browser_mouse_state mouse,
756 int x,
757 int y,
758 bool *did_something)
759{
760 int cur_y = 0;
761 nserror err;
762
763 cur_y += pi->window_padding;
764 for (unsigned i = 0; i < PI_ENTRY__COUNT; i++) {
765 struct page_info_entry *entry = pi->entries + i;
766 bool hovering = false;
767 int height;
768
769 if (page_info__hide_entry(i, pi->scheme)) {
770 continue;
771 }
772
773 switch (entry->type) {
775 cur_y += entry->u.text.height;
776 cur_y += entry->u.text.padding_bottom;
777 break;
778
780 height = entry->u.item.padding_top +
781 entry->u.item.item.height +
782 entry->u.item.padding_bottom;
783
784 if (y >= cur_y && y < cur_y + height) {
785 hovering = true;
787 pi, mouse, i, did_something);
788 if (err != NSERROR_OK) {
789 return err;
790 }
791 }
792 if (entry->u.item.hover != hovering) {
793 int w, h;
794 struct rect r = {
795 .x0 = 0,
796 .y0 = cur_y,
797 .y1 = cur_y + height,
798 };
799 guit->corewindow->get_dimensions(pi->cw_h, &w, &h);
800 r.x1 = (pi->width > w) ? pi->width : w;
801
802 guit->corewindow->invalidate(pi->cw_h, &r);
803 }
804 entry->u.item.hover = hovering;
805 cur_y += height;
806 break;
807 }
808 }
809
810 return NSERROR_OK;
811}
812
813/* Exported interface documented in desktop/page_info.h */
815 struct page_info *pi,
816 int32_t key)
817{
818 return NSERROR_OK;
819}
820
821/* Exported interface documented in desktop/page_info.h */
823 struct page_info *pi,
824 int *width,
825 int *height)
826{
827 *width = pi->width;
828 *height = pi->height;
829
830 return NSERROR_OK;
831}
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.
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:822
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:620
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:605
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:814
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:580
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:723
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:753
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:160
int height
Definition: gui.c:161
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: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