Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Issue 114323004: Simplify RenderImage::imageDimensionsChanged() (Closed)

Created:
6 years, 11 months ago by rhogan
Modified:
6 years, 8 months ago
Reviewers:
pdr., ojan
CC:
blink-reviews, bemjb+rendering_chromium.org, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering, zoltan1
Visibility:
Public.

Description

Simplify RenderImage::imageDimensionsChanged() This function decides if a change to the image requires relayout or if repainting will suffice. It only needs to worry about layout-related updates to the element that won't be detected elsewhere. These are: a change to the image's intrinsic size (e.g. when the resource changes) or a change in size to accomodate alt text for an image that failed to load - otherwise a repaint will do just as well. We don't need to recalculate height and width to figure this out - and the basis of this patch is that doing so is a false economy. If the intrinsic size has changed the only conditions that would avoid the need for triggering a layout are: - if the first layout hasn't happened yet; - if the CSS dimensions of the image prevent the intrinsic size ever affecting the used size of the image, i.e. if it has fixed, percent, or calculated dimensions. We don't need to worry about: - Absolutely positioned images with top/left/right/bottom specified. If the intrinsic dimensions of such an image changes, the used dimensions do too. So currently when intrinsic size has changed we will calculate width/height twice - once in order to figure out that a layout is required and a second time during layout itself. Remove this unnecessary extra work by laying out if the intrinsic size has changed and it affects the size of the image, otherwise just repaint. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=171915

Patch Set 1 #

Total comments: 2

Patch Set 2 : Updated per Ojan's comments #

Total comments: 5

Patch Set 3 : Updated #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -54 lines) Patch
M Source/core/rendering/RenderImage.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/rendering/RenderImage.cpp View 1 2 4 chunks +38 lines, -52 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
rhogan
6 years, 11 months ago (2014-01-15 18:49:40 UTC) #1
ojan
I'm not sure this is an improvement. It's less code, which is nice. But, it's ...
6 years, 11 months ago (2014-01-22 01:45:56 UTC) #2
rhogan
On 2014/01/22 01:45:56, ojan wrote: > I'm not sure this is an improvement. It's less ...
6 years, 8 months ago (2014-04-02 18:11:26 UTC) #3
ojan
https://codereview.chromium.org/114323004/diff/80001/Source/core/rendering/RenderImage.cpp File Source/core/rendering/RenderImage.cpp (right): https://codereview.chromium.org/114323004/diff/80001/Source/core/rendering/RenderImage.cpp#newcode222 Source/core/rendering/RenderImage.cpp:222: bool needsLayout = !selfNeedsLayout() && !hasSpecifiedSize && (intrinsicSizeChanged || ...
6 years, 8 months ago (2014-04-10 22:36:35 UTC) #4
ojan
Sorry to keep you waiting so long on this. I looked at this patch a ...
6 years, 8 months ago (2014-04-10 22:38:44 UTC) #5
rhogan
https://codereview.chromium.org/114323004/diff/80001/Source/core/rendering/RenderImage.cpp File Source/core/rendering/RenderImage.cpp (right): https://codereview.chromium.org/114323004/diff/80001/Source/core/rendering/RenderImage.cpp#newcode222 Source/core/rendering/RenderImage.cpp:222: bool needsLayout = !selfNeedsLayout() && !hasSpecifiedSize && (intrinsicSizeChanged || ...
6 years, 8 months ago (2014-04-16 20:55:42 UTC) #6
ojan
lgtm Sorry again that it too me so long to review this. https://codereview.chromium.org/114323004/diff/80001/Source/core/rendering/RenderImage.cpp File Source/core/rendering/RenderImage.cpp ...
6 years, 8 months ago (2014-04-18 01:26:51 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/robhogan@gmail.com/114323004/120001
6 years, 8 months ago (2014-04-18 01:27:08 UTC) #8
commit-bot: I haz the power
6 years, 8 months ago (2014-04-18 01:36:30 UTC) #9
Message was sent while issue was closed.
Change committed as 171915

Powered by Google App Engine
This is Rietveld 408576698