Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8267554: Support loading stylesheets from data-URIs #536

Closed
wants to merge 7 commits into from

Conversation

mstr2
Copy link
Collaborator

@mstr2 mstr2 commented Jun 18, 2021

This PR extends data URI support to allow stylesheets to be loaded from data URIs.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8267554: Support loading stylesheets from data-URIs

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/536/head:pull/536
$ git checkout pull/536

Update a local copy of the PR:
$ git checkout pull/536
$ git pull https://git.openjdk.java.net/jfx pull/536/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 536

View PR using the GUI difftool:
$ git pr show -t 536

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/536.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 18, 2021

👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Jun 18, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 18, 2021

@kevinrushforth
Copy link
Member

/reviewers 2
/csr

@openjdk
Copy link

openjdk bot commented Jun 18, 2021

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@openjdk openjdk bot added the csr Need approved CSR to integrate pull request label Jun 18, 2021
@openjdk
Copy link

openjdk bot commented Jun 18, 2021

@kevinrushforth has indicated that a compatibility and specification (CSR) request is needed for this pull request.
@mstr2 please create a CSR request for issue JDK-8267554. This pull request cannot be integrated until the CSR request is approved.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at just the public API and spec, and have two comments:

@mstr2
Copy link
Collaborator Author

mstr2 commented Jun 20, 2021

Data URIs also work for user-agent stylesheets. I added documentation to each of the methods.

@kevinrushforth
Copy link
Member

The API and spec changes look good. As I mentioned in a comment added to the CSR, it is ready to move to "Proposed". Once we are farther along in the code review, I'll formally review the CSR.

One thing I noticed is that the diffs don't exactly match what you pasted in the CSR (looks like a copy/paste issue). The Scene::setUserAgentStylesheet and SubScene::setUserAgentStylesheet methods each have three unchanged lines that are marked with the + diff indicator. Can you double-check?

I'll review the implementation next.

@mstr2
Copy link
Collaborator Author

mstr2 commented Jun 23, 2021

One thing I noticed is that the diffs don't exactly match what you pasted in the CSR (looks like a copy/paste issue). The Scene::setUserAgentStylesheet and SubScene::setUserAgentStylesheet methods each have three unchanged lines that are marked with the + diff indicator. Can you double-check?

I've fixed that, and also cleaned up the <p> tags for the new paragraphs.

@kevinrushforth kevinrushforth self-requested a review June 24, 2021 14:07
Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spent some time analyzing the changes to StyleManager::loadStylesheetUnPrivileged, especially around the use of the local parse variable, since you no longer modify it during the processing in a couple places. I think everything is fine, but I'd like @aghaisas to also look at this when he reviews it. If @dsgrieve has any comments, they would be welcome.

The following is the current behavior for the case where fname ends with .css or .bss:

fname .css exists .bss exists Result
SOMENAME.bss YES NO fail
SOMENAME.bss NO YES Use SOMENAME.bss instead
SOMENAME.bss YES YES Use SOMENAME.bss
SOMENAME.css YES NO Use SOMENAME.css
SOMENAME.css NO YES Use SOMENAME.bss (NOTE: if -Dbinary.css=false then fail)
SOMENAME.css YES YES Use SOMENAME.bss (NOTE: if -Dbinary.css=false then SOMENAME.css)

In case where fname ends with neither .css nor .css, it is assumed to be a CSS file and parsed as such.

As near as I can tell, both from reading the code and from running tests, this is still working as expected. So there should be no regression in behavior.

The code to process a data URI looks good.

As for the tests, can you add at least one test of calling the public setUserAgentStylesheet method using a data URI? Maybe as part of StyleManagerTest? Also, I left a couple suggestions inline.

@kevinrushforth kevinrushforth self-requested a review June 24, 2021 23:32
@mstr2
Copy link
Collaborator Author

mstr2 commented Jun 24, 2021

I added a test for each of Application.setUserAgentStylesheet, Scene.setUserAgentStylesheet, and SubScene.setUserAgentStylesheet.

@kevinrushforth
Copy link
Member

Changes look good. I'll do a final pass tomorrow.

Copy link
Collaborator

@aghaisas aghaisas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes are OK.
I found an Exception being logged from newly added test. Please check.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@openjdk openjdk bot removed the csr Need approved CSR to integrate pull request label Jun 25, 2021
@openjdk
Copy link

openjdk bot commented Jun 25, 2021

@mstr2 This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8267554: Support loading stylesheets from data-URIs

Reviewed-by: kcr, aghaisas

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 6 new commits pushed to the master branch:

  • 3fd4c97: 8234920: Add SpotLight to the selection of 3D light types
  • 063bfe8: 8264137: Suppress deprecation and removal warnings of internal methods
  • 8e11b94: 8268915: WebKit build fails with Xcode 12.5
  • 45786ac: 8252238: TableView: Editable (pseudo-editable) cells should respect the row editability
  • 04493e5: 8165214: ListView.EditEvent.getIndex() does not return the correct index
  • 13cffba: 8269026: PasswordField doesn't render bullet character on Android

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @aghaisas) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Ready to be integrated label Jun 25, 2021
@mstr2
Copy link
Collaborator Author

mstr2 commented Jun 25, 2021

/integrate

@openjdk openjdk bot added the sponsor Ready to sponsor label Jun 25, 2021
@openjdk
Copy link

openjdk bot commented Jun 25, 2021

@mstr2
Your change (at version 230cc49) is now ready to be sponsored by a Committer.

@kevinrushforth
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jun 25, 2021

Going to push as commit 78179be.
Since your change was applied there have been 6 commits pushed to the master branch:

  • 3fd4c97: 8234920: Add SpotLight to the selection of 3D light types
  • 063bfe8: 8264137: Suppress deprecation and removal warnings of internal methods
  • 8e11b94: 8268915: WebKit build fails with Xcode 12.5
  • 45786ac: 8252238: TableView: Editable (pseudo-editable) cells should respect the row editability
  • 04493e5: 8165214: ListView.EditEvent.getIndex() does not return the correct index
  • 13cffba: 8269026: PasswordField doesn't render bullet character on Android

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Jun 25, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated rfr Ready for review sponsor Ready to sponsor labels Jun 25, 2021
@openjdk
Copy link

openjdk bot commented Jun 25, 2021

@kevinrushforth @mstr2 Pushed as commit 78179be.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@mstr2 mstr2 deleted the feature/stylesheet-datauri branch January 22, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
3 participants