Auto merge of #22396 - jdm:no-spam-iframe-size, r=asajeffrey

Reduce unnecessary iframe size messages

This should be an improvement on pages that include iframes, since we currently run two layout jobs for every display-oriented layout request. When building the display list, we send a message to the constellation that includes the sizes of all iframes present, and the constellation sends resize messages to the script thread. This results in a mouse event on the outer page causing all frames to be re-laid out even if no changes occurred to the iframe sizes, which is ridiculous.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #22394
- [x] These changes do not require tests because there is no way to test this internal detail.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22396)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2019-01-14 19:12:59 -05:00 committed by GitHub
commit 2e439fa7cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 76 additions and 21 deletions

View file

@ -37,9 +37,10 @@ use gfx::text::glyph::ByteIndex;
use gfx::text::TextRun;
use gfx_traits::{combine_id_with_fragment_type, FragmentType, StackingContextId};
use ipc_channel::ipc;
use msg::constellation_msg::{BrowsingContextId, PipelineId};
use msg::constellation_msg::PipelineId;
use net_traits::image_cache::UsePlaceholder;
use range::Range;
use script_traits::IFrameSize;
use servo_config::opts;
use servo_geometry::MaxRect;
use std::default::Default;
@ -61,7 +62,6 @@ use style::values::generics::background::BackgroundSize;
use style::values::generics::image::{GradientKind, Image, PaintWorklet};
use style::values::{Either, RGBA};
use style_traits::cursor::CursorKind;
use style_traits::CSSPixel;
use style_traits::ToCss;
use webrender_api::{
self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF, ColorU,
@ -318,7 +318,7 @@ pub struct DisplayListBuildState<'a> {
/// Vector containing iframe sizes, used to inform the constellation about
/// new iframe sizes
pub iframe_sizes: Vec<(BrowsingContextId, TypedSize2D<f32, CSSPixel>)>,
pub iframe_sizes: Vec<IFrameSize>,
/// Stores text runs to answer text queries used to place a cursor inside text.
pub indexable_text: IndexableText,
@ -1785,9 +1785,10 @@ impl Fragment {
}));
let size = Size2D::new(item.bounds().size.width, item.bounds().size.height);
state
.iframe_sizes
.push((browsing_context_id, TypedSize2D::from_untyped(&size)));
state.iframe_sizes.push(IFrameSize {
id: browsing_context_id,
size: TypedSize2D::from_untyped(&size),
});
state.add_display_item(item);
}