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

Update Style class to more fully support computed property usage #2134

Merged
merged 13 commits into from
Apr 26, 2020

Conversation

bsweeney
Copy link
Member

No description provided.

Calculations based on font size should be calculated based on the current font size, not the default.
- Only set the computed property on fallback to the passed-in value if it is not blank or "inherit".
- When getting a property, only set it to the default if there is no specified value
- When getting a property, call the setter with the specified value if there is no computed value
- word-spacing
- letter-spacing
- line-height
- background
- background-attachment
- background-image-resolution
- background-position
- background-repeat
- background-size
- border (color, style, width for each side)
- border-radius (for each corner)
- border-spacing
- outline (color, style, width)

This includes generic helpers utilized by the getters/setters:
- _get_width
- _set_border_radius_corner
- _set_style_side_type
- color (and helper methods)
- image-resolution
- list-style (list-style-image)
- page-break-after
- page-break-before
- transform
- transform-origin
- z-index
@bsweeney bsweeney added this to the 0.8.6 milestone Apr 12, 2020
@bsweeney
Copy link
Member Author

@simonberger I know you want to move forward with implementing a CSS parser, but this update should address a number of issues I identified in the current release. Let's plan on looking at integrating the parser for 0.8.7.

@simonberger
Copy link
Member

simonberger commented Apr 12, 2020

The style changes which came in my mind would not replace this part. Just the parsing and the DOM matching. Maybe at some point the style class could or even should be changed but this would be another dimension. But I am completely uncertain if I want to do the project at all.

Regarding this pull request I already had a quick look and I like the improved transparency of the processes inside the class it gives. I'll dive deeper some time the next days and test it with the RTL branch where the problems came up.

@bsweeney
Copy link
Member Author

ahhaha that's right 😅

I didn't include the text-align update since that didn't exist yet prior to you adding it to the rtl branch. But I did go ahead and work out what it needs to be. I can add it here or wait until we merge this back into your branch and update there.

@simonberger
Copy link
Member

simonberger commented Apr 12, 2020

I noted that you didn't add a set method for text-align but thought it might still work.
It would be nice if you could add it here. I do not want to merge another branch that's not in develop yet into mine.
But I created a temporary merge branch for us to test.
#2135

I reverted the text-align initial patch and restored an earlier state (just there and not in the rtl main branch yet) we discussed (#2107 (comment))

I think the final version moves the logic to set_text_align instead of set_direction but we can do it after your changes. You can surely add patches to #2107 as well. I just would not like to merge the combined branch at the end.

Getter is excluded under the assumption that the user is hooking into the generic getter/setter, which will evaluate to the correct value if no value is set. Per the spec: a nameless value that acts as 'left' if 'direction' is 'ltr', 'right' if 'direction' is 'rtl'.
- add keyword check
- add dependency on direction
@bsweeney bsweeney merged commit 3736ef6 into develop Apr 26, 2020
@bsweeney bsweeney deleted the css-computed-props branch April 26, 2020 19:47
src/Css/Style.php Show resolved Hide resolved
src/Css/Style.php Show resolved Hide resolved
src/Css/Style.php Show resolved Hide resolved
src/Css/Style.php Outdated Show resolved Hide resolved
src/Css/Style.php Outdated Show resolved Hide resolved
src/Css/Style.php Show resolved Hide resolved
@bsweeney bsweeney restored the css-computed-props branch April 26, 2020 23:24
@bsweeney
Copy link
Member Author

Sorry, looks like I got ahead of myself. I thought you were happy with the state of the branch so I went ahead and merged.

I made a few changes as suggested and will push them after you have a chance to review my responses to your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants