Commit ee930b05 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Revert "[Blink] Unify pre-snapping of <video> to match <iframe>"

This reverts commit 0ea138d6.

Reason for revert: The CL probably broke a number of tests:
https://ci.chromium.org/buildbot/chromium.webkit/WebKit%20Mac10.13%20%28retina%29/63


Original change's description:
> [Blink] Unify pre-snapping of <video> to match <iframe>
> 
> This CL changes the pre-snapping policy of <video> so that only the size
> of the contents is pre-snapped, while the location will exactly match the
> content box's final location.
> 
> BUG=730284
> 
> Change-Id: Id10bd0fbd8021a11b7db4a2950a908f3d1b50ac0
> Reviewed-on: https://chromium-review.googlesource.com/1141328
> Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
> Commit-Queue: Tien-Ren Chen <trchen@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#576317}

TBR=trchen@chromium.org,chrishtr@chromium.org

Change-Id: I518e659cbab820263480b02ae347c99468dd95fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 730284
Reviewed-on: https://chromium-review.googlesource.com/1143205Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576438}
parent 4a27ce9d
......@@ -292,16 +292,19 @@ CursorDirective LayoutEmbeddedContent::GetCursor(const LayoutPoint& point,
}
LayoutRect LayoutEmbeddedContent::ReplacedContentRect() const {
LayoutRect content_rect = ContentBoxRect();
// IFrames set as the root scroller should get their size from their parent.
if (ChildFrameView() && View() && RootScrollerUtil::IsEffective(*this))
content_rect = LayoutRect(LayoutPoint(), View()->ViewRect().Size());
// We don't propagate sub-pixel into sub-frame layout, in other words, the
// rect is snapped at the document boundary, and sub-pixel movement could
// cause the sub-frame to layout due to the 1px snap difference. In order to
// avoid that, the size of sub-frame is rounded in advance.
return PreSnappedRectForPersistentSizing(content_rect);
LayoutRect size_rounded_rect = ContentBoxRect();
// IFrames set as the root scroller should get their size from their parent.
if (ChildFrameView() && View() && RootScrollerUtil::IsEffective(*this))
size_rounded_rect = LayoutRect(LayoutPoint(), View()->ViewRect().Size());
size_rounded_rect.SetSize(
LayoutSize(RoundedIntSize(size_rounded_rect.Size())));
return size_rounded_rect;
}
void LayoutEmbeddedContent::UpdateOnEmbeddedContentViewChange() {
......
......@@ -636,11 +636,6 @@ LayoutRect LayoutReplaced::ReplacedContentRect() const {
return ComputeObjectFit();
}
LayoutRect LayoutReplaced::PreSnappedRectForPersistentSizing(LayoutRect rect) {
rect.SetSize(LayoutSize(RoundedIntSize(rect.Size())));
return rect;
}
void LayoutReplaced::ComputeIntrinsicSizingInfo(
IntrinsicSizingInfo& intrinsic_sizing_info) const {
if (ShouldApplySizeContainment()) {
......
......@@ -63,12 +63,6 @@ class CORE_EXPORT LayoutReplaced : public LayoutBox {
// This function returns the local rect of the replaced content.
virtual LayoutRect ReplacedContentRect() const;
// This is used by a few special elements, e.g. <video>, <iframe> to ensure
// a persistent sizing under different subpixel offset, because these
// elements have a high cost to resize. The drawback is that we may overflow
// or underflow the final content box by 1px.
static LayoutRect PreSnappedRectForPersistentSizing(LayoutRect);
bool NeedsPreferredWidthsRecalculation() const override;
// These values are specified to be 300 and 150 pixels in the CSS 2.1 spec.
......
......@@ -171,7 +171,10 @@ LayoutRect LayoutVideo::ReplacedContentRect() const {
if (ShouldDisplayVideo()) {
// Video codecs may need to restart from an I-frame when the output is
// resized. Round size in advance to avoid 1px snap difference.
return PreSnappedRectForPersistentSizing(ComputeObjectFit());
// TODO(trchen): The way of rounding is different from LayoutEmbeddedContent
// just to match existing behavior. This is probably a bug and We should
// unify it with LayoutEmbeddedContent.
return LayoutRect(PixelSnappedIntRect(ComputeObjectFit()));
}
// If we are displaying the poster image no pre-rounding is needed, but the
// size of the image should be used for fitting instead.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment