Repository navigation
Adding sync method to update atrr from inline style updates - #9410
craftytrickster wants to merge 15 commits into
Conversation
|
r? @nox |
|
You're trying to update the attribute, keeping the previous value. This won't work. For example, this is valid: elt.setAttribute("style", "meh:42");
console.log(elt.getAttribute("style")); // prints "meh:42"
elt.style.color = "red"; //
console.log(elt.getAttribute("style")); // prints "color:red"With your code, i'd expect it to print:
Does it make sense? |
|
As stated before, you need to set the attribute value from the serialisation of the CSSStyleDeclaration instance. |
|
I think I understand what you are looking for. When I have time (hopefully tonight) to make the change, I will push it here. |
|
Just some comments:
|
|
You want to implement this algorithm. |
|
Thanks for comments, I will make the changes and implement algorithm as well. I should have done it beforehand. |
74d7e75 to
f0d522d
Compare
|
I know that @paulrouget mentioned that having issue #9307 solved would help in debugging. I have been extremely busy the past few weeks, it has been hard to find time and I feel bad that I am holding up this issue. I am looking into serializing this correctly, but I have not solved it yet. In the meantime, it might provide value to integrate the current changes. Then someone (perhaps me if I am able to complete it on time) can simple replace the implementation of Please let me know what you think. |
f0d522d to
cf67f01
Compare
|
I found some time to look at this tonight, I have a better idea of what to do now with the serialize piece, maybe I can finish this weekend. |
Don't worry about that. Fixing this was important for #9378, but we landed a temporary fix. So no hurry. |
|
That's good to hear, thanks. |
|
I would like some assistance looking at my latest commits if possible. During the serialize method, I do a lot of iter().cloned() that intuitively seems wrong. However, I am not sure of another way to do it. Also, it seems that the pre-existing method Thank you for the help and patience. |
There was a problem hiding this comment.
It'd be nice if you can put in some annotations about which step of the algorithm that the code is following. Just a // Step 1. above step 1 would be enough, for example. // Substep 1. for substeps, and so on.
There was a problem hiding this comment.
I will add that now.
dafbeef to
2a01887
Compare
|
☔ The latest upstream changes (presumably #9510) made this pull request unmergeable. Please resolve the merge conflicts. |
2a01887 to
e8f86c7
Compare
|
The failing reftests include |
|
I tested adding back the node.dirty calls on a different branch craftytrickster@847265c, but the rendering problem is still there. |
|
It seems that the root of the may be the use of The |
5b00e68 to
15407da
Compare
15407da to
c82f1da
Compare
|
The wpt test for tests/wpt/mozilla/tests/css/removeproperty.html was failing due to the fact that node.dirty was not called during property removals. After my latest commit, this is now passing. I still see some wpt-test failures locally (such as viewport_percentage_vmin_vmax_a.html), but they seem intermittent/unrelated to the changes I made here. Please let me know if anything else is missing here. |
|
☔ The latest upstream changes (presumably #11192) made this pull request unmergeable. Please resolve the merge conflicts. |
from cssstyledeclaration.rs file For PropertyDeclaration impl, added shorthands method to get the shorthands associated with the current longhand For PropertyDeclarationBlock impl, added serialize algorithm
…essary calls to document.content_changed
… when inline style is changed
…g to string buffers to save string allocations for every result
… to handle shorthand serialization better
… writing to string buffers to save string allocations for every result
…order to avoid reparsing serialized output
|
With the latest rebase and changes, the unit test and wpt-test results in this branch are the same as the results from master branch. @SimonSapin Is this able to be merged, or is there still something I am missing? |
|
☔ The latest upstream changes (presumably #11326) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I think this is good to go. I’ve rebased it and sent it to CI in #11377. |
|
Thank you everyone for your help and patience on this issue. I learned a quite a bit about Rust from doing this one (although it did take a little longer than expected). |
|
Thank you for keeping at it all this time! |
#9307
I am not terribly confident in this PR, but
getAttribute("style")does update correctly now. If the implementation here is more or less "correct", I will add unit tests to confirm that the attr for style is updated correctly. If it is completely off, I will gladly keep trying, but I also understand if someone else with more experience with Rust and this area of the application wants to do it.There are a few things I do not like here, such as:
new_styleinsync_property_with_attrs_stylefn update_inline_style, I needed to coerce the value to a string slice, so I did&format!("{}", &property_decl.name(), but I am sure there is a better way to do this.