-
Notifications
You must be signed in to change notification settings - Fork 3
Add support for background-blend-mode and background-clip CSS properties #119
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
Conversation
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
| using BoxSizing = specified::BoxSizing; | ||
| using Overflow = specified::Overflow; | ||
| using BackgroundBlendMode = specified::BackgroundBlendMode; | ||
| using BackgroundClip = specified::BackgroundClip; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BackgroundBlendMode and BackgroundClip should be in background.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 905d0dd. Created values/computed/background.hpp with the BackgroundBlendMode and BackgroundClip aliases, and updated computed/box.hpp to include it instead of the specified files directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move common logic to values/generics/background.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 905d0dd. Created values/generics/background.hpp with GenericBackgroundBlendMode<T> template containing the common logic. The specified file now inherits from the generic, reducing code from 200+ lines to just 10 lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move common logic to values/generics/background.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 905d0dd. Created values/generics/background.hpp with GenericBackgroundClip<T> template containing the common logic. The specified file now inherits from the generic, reducing code from 100+ lines to just 10 lines.
Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this file to values/specified/background.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 84363b4. Moved both background_clip.hpp and background_blend_mode.hpp into a single consolidated values/specified/background.hpp file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this file to values/specified/background.hpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 84363b4. Moved both background_blend_mode.hpp and background_clip.hpp into a single consolidated values/specified/background.hpp file.
| namespace client_cssom::values::generics | ||
| { | ||
| template <typename T> | ||
| class GenericBackgroundBlendMode : public Parse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parse should be implemented in specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 84363b4. Moved the Parse implementation from the generic class to the BackgroundBlendMode specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Parse inheritance should move the specified class, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Moved Parse inheritance from GenericBackgroundBlendMode to the BackgroundBlendMode specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Moved Parse inheritance from GenericBackgroundBlendMode to the BackgroundBlendMode specified class.
| }; | ||
|
|
||
| template <typename T> | ||
| class GenericBackgroundClip : public Parse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, Parse should be implemented in specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 84363b4. Moved the Parse implementation from the generic class to the BackgroundClip specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, the inheritance from Parse should be moved to specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Moved Parse inheritance from GenericBackgroundClip to the BackgroundClip specified class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Moved Parse inheritance from GenericBackgroundClip to the BackgroundClip specified class.
|
|
||
| #include <client/cssom/values/generics/rect.hpp> | ||
| #include <client/cssom/values/specified/box.hpp> | ||
| #include <client/cssom/values/computed/background.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this #include, this is unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 84363b4. Removed the unnecessary #include from computed/box.hpp.
… implementation to specified classes Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
| namespace client_cssom::values::generics | ||
| { | ||
| template <typename T> | ||
| class GenericBackgroundBlendMode : public Parse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Parse inheritance should move the specified class, too.
| }; | ||
|
|
||
| template <typename T> | ||
| class GenericBackgroundClip : public Parse, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, the inheritance from Parse should be moved to specified class.
| protected: | ||
| Tag tag_; | ||
| }; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. The file now ends with the closing brace without extra blank lines.
| return true; | ||
| } | ||
| }; | ||
| } No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the EOF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file structure has been updated and there are no trailing newlines at the end of the file. The EOF issue has been resolved in commit 55ea546.
| namespace client_cssom::values::computed | ||
| { | ||
| using BackgroundBlendMode = specified::BackgroundBlendMode; | ||
| using BackgroundClip = specified::BackgroundClip; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use generics instead of specified classes in computed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Updated computed/background.hpp to use generics::GenericBackgroundBlendMode and generics::GenericBackgroundClip instead of the specified classes.
| template <typename T> | ||
| class GenericBackgroundBlendMode : public Parse, | ||
| public ToCss, | ||
| public ToComputedValue<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToComputeValue should also moved to specified, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Moved ToComputedValue inheritance from GenericBackgroundBlendMode to the BackgroundBlendMode specified class.
| template <typename T> | ||
| class GenericBackgroundClip : public Parse, | ||
| public ToCss, | ||
| public ToComputedValue<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToComputeValue should also moved to specified, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 55ea546. Moved ToComputedValue inheritance from GenericBackgroundClip to the BackgroundClip specified class.
…ix computed types Co-authored-by: yorkie <1935767+yorkie@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
This PR implements support for the
background-blend-modeandbackground-clipCSS properties in the CSSOM implementation, extending the runtime's CSS capabilities.Changes Made
New CSS Properties Supported
background-blend-mode- Controls how background images blend with each other and the background color:normal,multiply,screen,overlay,darken,lightencolor-dodge,color-burn,hard-light,soft-lightdifference,exclusion,hue,saturation,color,luminositybackground-clip- Controls how far a background extends within an element:border-box,padding-box,content-box,textImplementation Details
Added Files:
src/client/cssom/values/specified/background_blend_mode.hpp- Complete enum-based implementation with all 16 CSS blend modessrc/client/cssom/values/specified/background_clip.hpp- Complete enum-based implementation with all 4 CSS clip modesModified Files:
src/client/cssom/computed_style.hpp- Added accessor methods and member variables for the new propertiessrc/client/cssom/computed_style.cpp- Added CSS parsing logic following existing patternssrc/client/cssom/values/computed/box.hpp- Added computed value type aliasessrc/client/cssom/style_traits.hpp- Fixed missing<vector>includeTechnical Implementation
The implementation follows the established patterns in the codebase:
BackgroundBlendMode::Multiply())Parse,ToCss,ToComputedValuenormalfor blend-mode,border-boxfor clip)Usage Example
The properties were already declared in
properties.hppbut lacked implementation. This PR provides the complete value type definitions and integration into the computed style system.Fixes #118.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.