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

New style getters and cleanups in CSSNode #146

Merged
merged 2 commits into from
Oct 21, 2015
Merged

New style getters and cleanups in CSSNode #146

merged 2 commits into from
Oct 21, 2015

Conversation

lucasr
Copy link
Contributor

@lucasr lucasr commented Oct 21, 2015

This PR adds all missing getters for style properties in CSSNode for consistency and because now we have some use cases for it.

Furthermore, I've renamed the existing getters and some setters to follow a more consistent pattern. This involves an API break so I'm considering this part kinda optional (even though I really think we should do it).

Having "Style" in the method names seems redundant given that we currently have setters that implicitly set style and don't have "style" in their name. For example, we have setPadding() but the getter is called getStylePadding(). We should be more consistent about this.

The following methods are renamed:

  • getStyleWidth() -> getWidth()
  • getStyleHeight() -> getHeight()
  • setStyleWidth() -> setWidth()
  • setStyleHeight() -> setHeight()
  • getStyleDirection() -> getDirection()
  • getStylePadding() -> getPadding()

With these changes, the CSSNode API will be more like "all setters/getters members affect style, unless they "Layout" in their name, which sounds simpler and more consistent.

For consistency and because now we have some use cases for it.
@kmagiera
Copy link
Contributor

looks good.

@facebook-github-bot import

@facebook-github-bot
Copy link
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1476275942680136/int_phab to review.

So that we're consistent with other style-only methods. Move existing
getters to be close to their matching setters in CSSNode.
@lucasr
Copy link
Contributor Author

lucasr commented Oct 21, 2015

Changed my mind after fiddling a bit more with this new API. I think we should keep the "Style" in getters that are present in both style and layout for clarity e.g. node bounds and layout direction. It still makes sense to rename getStylePadding() to getPadding() as it's a style-only attribute.

kmagiera added a commit that referenced this pull request Oct 21, 2015
New style getters and cleanups in CSSNode
@kmagiera kmagiera merged commit 6e49930 into facebook:master Oct 21, 2015
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

3 participants