I know that the JavaFX WebEngine component has some features not included that are available in most modern browsers (WebGL, UserMedia, GeoLoacation). But I just found out that css3 features like background-gradient don't seem to be supported as well.
Does somebody know of a feature list of the JavaFX WebEngine concerning CSS3? The official documentation from Oracle just says: "The embedded browser component is based on WebKit, an open source web browser engine. It supports Cascading Style Sheets (CSS), JavaScript, Document Object Model (DOM), and HTML5."
[Edit]: gradient is supported. Seems I had a mistake in my css. But nevertheless I'd be thankful about some documentation of supported features.
CSS and the JavaFX Scene Graph. CSS styles are applied to nodes in the JavaFX scene graph in a way similar to the way CSS styles are applied to elements in the HTML DOM. Styles are first applied to the parent, then to its children.
In the SceneBuilder view, click on the AnchorPane that was added first. In the Properties tab, under the 'JavaFX CSS' section, click on the 'Stylesheets' option. Select the CSS file, and that's it.
Each item in the scene graph is called a Node . Branch nodes are of type Parent , whose concrete subclasses are Group , Region , and Control , or subclasses thereof. Leaf nodes are classes such as Rectangle , Text , ImageView , MediaView , or other such leaf classes which cannot have children.
A Background is an immutable object which encapsulates the entire set of data required to render the background of a Region. Because this class is immutable, you can freely reuse the same Background on many different Regions.
I don't think there is a list of the features it supports or not. As stated in your question, WebEngine is based in WebKit, but even if you know the exact version it is based on, you will have to check if it was tweaked/changed.
I think the best option here is to run a bunch of tests (like the ones provided by css3test.com) in the WebEngine and use that as a guideline
import java.io.IOException;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class CSS3Test extends Application {
@Override
public void start(Stage stage) throws Exception {
StackPane pane = new StackPane();
WebView view = new WebView();
WebEngine engine = view.getEngine();
engine.load("http://css3test.com/");
pane.getChildren().add(view);
Scene scene = new Scene(pane, 960, 600);
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) throws IOException {
Application.launch(args);
}
}
It's far from perfect (even if it supports feature "X", this does not mean that feature is correctly implemented, or even works at all), but should help you get an overview of the supported features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With