Closed
Bug 1461858
Opened 7 years ago
Closed 7 years ago
Simplify code around building ComputedImageUrl
Categories
(Core :: CSS Parsing and Computation, enhancement)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla62
Tracking | Status | |
---|---|---|
firefox62 | --- | fixed |
People
(Reporter: xidorn, Assigned: xidorn)
References
Details
Attachments
(4 files)
See bug 1461288 comment 5, there are something inefficient, and something can be removed.
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 5•7 years ago
|
||
mozreview-review |
Comment on attachment 8976035 [details]
Bug 1461858 part 1 - Make creating CssUrl infallible.
https://reviewboard.mozilla.org/r/244230/#review250210
Attachment #8976035 -
Flags: review?(emilio) → review+
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8976036 [details]
Bug 1461858 part 2 - Make from_image_request infallible.
https://reviewboard.mozilla.org/r/244232/#review250212
Attachment #8976036 -
Flags: review?(emilio) → review+
Comment 7•7 years ago
|
||
mozreview-review |
Comment on attachment 8976037 [details]
Bug 1461858 part 3 - Have from_image_request reuse ImageValue from image request directly.
https://reviewboard.mozilla.org/r/244234/#review250214
::: layout/style/ServoBindings.cpp:1675
(Diff revision 1)
>
> -const mozilla::css::URLValueData*
> -Gecko_GetURLValue(const nsStyleImage* aImage)
> +const nsStyleImageRequest*
> +Gecko_GetImageRequest(const nsStyleImage* aImage)
> {
> - MOZ_ASSERT(aImage && aImage->GetType() == eStyleImageType_Image);
> - return aImage->GetURLValue();
> + MOZ_ASSERT(aImage);
> + return aImage->GetImageRequest();
We should probably rename GetImageRequest() to ImageRequest(), since it can't return null really.
Attachment #8976037 -
Flags: review?(emilio) → review+
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8976038 [details]
Bug 1461858 part 4 - Rename from_url_value_data to from_url_value and reuse URLValue passed in for ComputedUrl.
https://reviewboard.mozilla.org/r/244236/#review250216
Thanks for cleaning this up! :)
::: servo/components/style/gecko/conversions.rs:682
(Diff revision 1)
> impl<'a> From<&'a StyleShapeSource> for ClippingShape {
> fn from(other: &'a StyleShapeSource) -> Self {
> match other.mType {
> StyleShapeSourceType::URL => unsafe {
> let shape_image = &*other.mShapeImage.mPtr;
> - let other_url = &(**shape_image.__bindgen_anon_1.mURLValue.as_ref());
> + let other_url = RefPtr::from_ptr_ref(shape_image.__bindgen_anon_1.mURLValue.as_ref());
Huh, naming of from_ptr_ref is really confusing...
Anyhow this looks fine.
Attachment #8976038 -
Flags: review?(emilio) → review+
Comment 9•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8976038 [details]
Bug 1461858 part 4 - Rename from_url_value_data to from_url_value and reuse URLValue passed in for ComputedUrl.
https://reviewboard.mozilla.org/r/244236/#review250216
> Huh, naming of from_ptr_ref is really confusing...
>
> Anyhow this looks fine.
Perhaps you can use just RefPtr::new(), instead of from_ptr_ref + clone? It'd be slightly easier to read imo.
Assignee | ||
Comment 10•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8976037 [details]
Bug 1461858 part 3 - Have from_image_request reuse ImageValue from image request directly.
https://reviewboard.mozilla.org/r/244234/#review250214
> We should probably rename GetImageRequest() to ImageRequest(), since it can't return null really.
Let's do it in a followup bug. It seems to me that nsStyleImageRequest also has some method can be renamed.
Comment 11•7 years ago
|
||
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7358416f54f4
part 1 - Make creating CssUrl infallible. r=emilio
https://hg.mozilla.org/integration/autoland/rev/c728ab64fa12
part 2 - Make from_image_request infallible. r=emilio
https://hg.mozilla.org/integration/autoland/rev/ae886b67a96f
part 3 - Have from_image_request reuse ImageValue from image request directly. r=emilio
https://hg.mozilla.org/integration/autoland/rev/2e6a54985ec6
part 4 - Rename from_url_value_data to from_url_value and reuse URLValue passed in for ComputedUrl. r=emilio
Assignee | ||
Comment 12•7 years ago
|
||
mozreview-review-reply |
Comment on attachment 8976038 [details]
Bug 1461858 part 4 - Rename from_url_value_data to from_url_value and reuse URLValue passed in for ComputedUrl.
https://reviewboard.mozilla.org/r/244236/#review250216
> Perhaps you can use just RefPtr::new(), instead of from_ptr_ref + clone? It'd be slightly easier to read imo.
Oh... I missed this issue. So yeah, I agree. It is written this way because I initially have from_url_value accept `&RefPtr<URLValue>`, then I realized that `to_safe()` actually clones, thus I change that function to take ownership instead, and at that point, I just add clone everywhere... but yeah, using `::new` should be better. I'll push a followup.
Comment 13•7 years ago
|
||
Pushed by xquan@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/235b702765bb
followup - Use RefPtr::new instead of RefPtr::from_ptr_ref + clone.
Comment 14•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7358416f54f4
https://hg.mozilla.org/mozilla-central/rev/c728ab64fa12
https://hg.mozilla.org/mozilla-central/rev/ae886b67a96f
https://hg.mozilla.org/mozilla-central/rev/2e6a54985ec6
https://hg.mozilla.org/mozilla-central/rev/235b702765bb
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in
before you can comment on or make changes to this bug.
Description
•