API request: WebEngine settings

Richard Bair richard.bair at oracle.com
Wed May 9 18:07:48 PDT 2012


Hi Peter,

I gave it a few days to see if I'd change my mind but really I like adding the settings directly on WebEngine. I'm not bothered if a bunch of settings get put there. I am bothered by the fact that in FXML it is not a 1-1 mapping (ie, we alias from <WebView>).

I'm wondering how this plays in SceneBuilder as well. Right now I don't think SB has any special support so you cannot set any web engine specific settings.

As m inch as possible we want to keep the FXML / CSS / API in sync such that you can look at the API and know how to express something in FXML or CSS. That is, the process would be mechanical. So I would have thought:

<WebView>
    <WebEngine location="http://oracle.com" />
</WebView>

And likewise, if settings were a separate class, I would then have a WebSettings tag within the WebEngine tag. And in SB we would have to show that hierarchy as well. Does that make sense? By synthesizing a property on WebView, we now have to face resolving:

<WebView location="http://apple.com">
    <WebEngine location="http://oracle.com" />
</WebView>

What do we do? I think this illustrates one of the problems with not having a 1-1 mapping. So if we have WebSettings, then we have an extra level of nesting -- in code, in SB, and in FXML. This is why I have wondered about whether we ought not just roll these settings into WebEngine.

Richard

On Apr 27, 2012, at 5:47 AM, Peter Zhelezniakov <Peter.Zhelezniakov at oracle.com> wrote:

> On Apr 26, 2012, at 6:53 PM, Richard Bair wrote:
>> What is the benefit of having Settings vs adding properties to WebEngine? What would it look like from FXML?
> 
> 
> Well, Webkit has 100+ different customizable settings. I don't think we need all of them, but I can imagine us having 20-30 settings (e.g. whether to load images, max number of network connections per server, turn page caching on/off, user agent ID string etc). So I thought a separate namespace for settings was appropriate.
> 
> From FXML standpoint the single entry point for javafx.scene.web is currently WebView. It has a custom builder class that passes some properties to the underlying WebEngine, e.g.
>    <WebView location="..."/>   calls   webView.getEngine().setLocation(...);
> and we can extend it so that
>    <WebView javaScriptEnabled="true"/>   calls   webEngine.getEngine().getSettings().setJavaScriptEnabled(true);
> 
> Thanks!
> -- 
> Peter
> 
> 


More information about the openjfx-dev mailing list