Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upStop parsing style attributes during restyle in geckolib. #11787
Conversation
highfive
commented
Jun 18, 2016
|
|
|
A few questions on this updated patch:
|
Per the bug I think we should get rid of the pointer and the RefCell. And maybe just put the bool inside PropertyDeclarationBlock and conditionally compile it for geckolib?
N/A given the discussion in the bug.
Same.
I think you should be able to just use .as_ref() on the the *PropertyDeclarationBlock and the borrow checker should be satisfied. |
|
Per the IRC discussion we had, I've left the |
| #[no_mangle] | ||
| pub extern "C" fn Servo_GetDeclarationBlockCache(declarations: *mut ServoDeclarationBlock) | ||
| -> *mut nsHTMLCSSStyleSheet { | ||
| let declarations: &GeckoDeclarationBlock = unsafe { transmute(declarations) }; |
This comment has been minimized.
This comment has been minimized.
bholley
Jun 23, 2016
Contributor
We should be able to remove these transmutes by mapping the types together and then using .as_ref(). We do this elsewhere IIRC.
| if ptr.is_null() { | ||
| &NO_STYLE_ATTRIBUTE | ||
| } else { | ||
| let declarations: &GeckoDeclarationBlock = transmute(ptr); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bholley
Jun 23, 2016
Contributor
And .as_ref() will map nicely to the NO_STYLE_ATTRIBUTE case.
In general transmute is a big hammer, and we should restrict our uses to the cases where we really need it.
|
@bors-servo delegate+ with the transmutes removed. |
|
|
|
@bors-servo r=bholley |
|
|
Stop parsing style attributes during restyle in geckolib. <!-- Please describe your changes on the following line: --> This allows `PropertyDeclarationBlock`s parsed for `style=""` attributes to be stored on a Gecko node so that we don't have to re-parse it each time we compute style for an element. Works with [Gecko bug 1280772](https://bugzilla.mozilla.org/show_bug.cgi?id=1280772). r? @bholley CC @emilio --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11787) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
@bors-servo: r=bholley |
|
|
Stop parsing style attributes during restyle in geckolib. <!-- Please describe your changes on the following line: --> This allows `PropertyDeclarationBlock`s parsed for `style=""` attributes to be stored on a Gecko node so that we don't have to re-parse it each time we compute style for an element. Works with [Gecko bug 1280772](https://bugzilla.mozilla.org/show_bug.cgi?id=1280772). r? @bholley CC @emilio --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11787) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
|
|
|
heycam commentedJun 18, 2016
•
edited by larsbergstrom
This allows
PropertyDeclarationBlocks parsed forstyle=""attributes to be stored on a Gecko node so that we don't have to re-parse it each time we compute style for an element. Works with Gecko bug 1280772.r? @bholley
CC @emilio
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is