Skip to content

Html content not displaying, but can be selected. #17

@cessen

Description

@cessen

I have a simple project with the following code, based on the example in the docs:

use fltk::{app, prelude::*, window::Window};

fn main() {
    let app = app::App::default();
    let mut win = Window::default()
        .with_size(800, 600)
        .with_label("Hi there!");
    
    let mut webview_win = Window::default()
        .with_size(790, 590)
        .center_of_parent();
    
    win.end();
    win.make_resizable(true);
    win.show();
    
    let webview = fltk_webview::Webview::create(true, &mut webview_win);
    webview.set_html(r#"
<!doctype html>
<html>
    <head>
        <title>A title.</title>
    </head>
    <body style="color: rgb(0, 0, 0);">
        <h1>Hi there!</h1>
        <p>This is a test.</p>
    </body>
</html>
    "#);
    
    app.run().unwrap();
}

It compiles and runs just fine, but the view is blank:

fltk_webview

Interestingly, if I right-click and bring up the inspector, the content does seem to be there:

fltk_webview_inspector

Furthermore, the cursor changes to the text cursor when I hover over the areas where the text ought to be displayed, and I can drag-select (without any visible highlighting) and copy it, and paste the content into a text editor, and that works correctly with the expected content of the page being pasted.

At first I thought it might be a styling thing (e.g. the text is rendered white), but that doesn't seem to be the case, and is the reason for the style attribute on the body.

If I try to open a website with the navigate() method the same thing happens: the expected content seems to be there (shows up in the inspector, can be (invisibly) selected and copy/pasted into other applications), but just not rendered.

This feels particularly bizarre since the inspector obviously draws just fine—no idea why it would be able to draw that but not the actual web content.

I realize this may be a tricky bug to track down, and seems like the kind of thing that might be system-specific. So I'm ready to provide any help I reasonably can. Please let me know if there's anything you want me to check/test, etc.

System Info

I'm running NixOS 22.05 with X11 and AwesomeWM. Hardware-wise, I'm on an AMD x86/64 system with nVidia graphics (with the proprietary drivers). I can provide more details if that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions