Add new CSS properties in CEF to be used through V8

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Add new CSS properties in CEF to be used through V8

Postby sugoyal » Mon Dec 11, 2017 6:22 am

I am using CEF V8 scripting engine. I want to add new CSS properties to V8/CEF to be interpreted by my application when integrated with CEF and V8.

I am trying following code:-

Object.defineProperty(CSSStyleDeclaration.prototype, "myproperty", {
get: function () {
return (this.getPropertyValue('-my-property'));

},
set: function (myproperty) {
return this.setProperty("-my-property", myproperty);
},
});`

element.style.myproperty = 'customvalue';
console.log(element.style.myproperty);

Output:- Empty string


But this code does not work and 'myproperty' is not set.

If instead of '-my-property', I use the name prefixed with double hyphen '--my-property', it works fine.

But I want to add new properties with single prefix.

I googled and found that one option is that I need to get complete chromium code, add my new CSS property and check the code:-

https://www.chromium.org/blink/runtime-enabled-features

As this is very lengthy process, I just want to know if there is any other option to add a new CSS property and get/set it through Element.style.prop. For example is there any possibility through any of the following:-

CSS Polyfills.
Chrome Extensions.
Extending V8 by making it aware of new properties( I searched and found that for this option I have to run V8 in embedded mode and provide the complete C++ implementation. Just want to know if it is possible to provide implementation for only new properties and reused the existing ones.).

Thanks in advance.
sugoyal
Newbie
 
Posts: 1
Joined: Mon Dec 11, 2017 6:17 am

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 23 guests