DescriptionSimplify 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 #
Messages
Total messages: 9 (0 generated)
|