Skip to content

Commit

Permalink
Merge "LayoutNGView, SVG: Fix invalidation of viewport-dependent size…
Browse files Browse the repository at this point in the history
…s" to M110 branch

This CL fixes a regression by LayoutNGView.

- Port a logic in LayoutView::UpdateBlockLayout() to LayoutNGView.
- Make ViewLogical*ForBoxSizing() protected.

(cherry picked from commit 016da2d)

Bug: 1403588
Change-Id: I2f59086a85f5af6464b00ae68fdc10309e1a4aa0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4135360
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1089172}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4145578
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5481@{#166}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Jan 7, 2023
1 parent c69f3b9 commit d8917af
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 9 deletions.
17 changes: 8 additions & 9 deletions third_party/blink/renderer/core/layout/layout_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ class CORE_EXPORT LayoutView : public LayoutBlockFlow {

protected:
void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override;
int ViewLogicalWidthForBoxSizing() const {
NOT_DESTROYED();
return ViewLogicalWidth(kIncludeScrollbars);
}
int ViewLogicalHeightForBoxSizing() const {
NOT_DESTROYED();
return ViewLogicalHeight(kIncludeScrollbars);
}

private:
bool CanHaveChildren() const override;
Expand All @@ -379,15 +387,6 @@ class CORE_EXPORT LayoutView : public LayoutBlockFlow {

void UpdateFromStyle() override;

int ViewLogicalWidthForBoxSizing() const {
NOT_DESTROYED();
return ViewLogicalWidth(kIncludeScrollbars);
}
int ViewLogicalHeightForBoxSizing() const {
NOT_DESTROYED();
return ViewLogicalHeight(kIncludeScrollbars);
}

bool UpdateLogicalWidthAndColumnWidth() override;

Member<LocalFrameView> frame_view_;
Expand Down
11 changes: 11 additions & 0 deletions third_party/blink/renderer/core/layout/ng/layout_ng_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "third_party/blink/renderer/core/layout/ng/ng_constraint_space_builder.h"
#include "third_party/blink/renderer/core/layout/ng/ng_layout_result.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
#include "third_party/blink/renderer/core/svg/svg_document_extensions.h"

namespace blink {

Expand All @@ -33,6 +34,16 @@ bool LayoutNGView::IsFragmentationContextRoot() const {
}

void LayoutNGView::UpdateBlockLayout(bool relayout_children) {
relayout_children |=
!ShouldUsePrintingLayout() &&
(!GetFrameView() || LogicalWidth() != ViewLogicalWidthForBoxSizing() ||
LogicalHeight() != ViewLogicalHeightForBoxSizing());
if (relayout_children && GetDocument().SvgExtensions()) {
GetDocument()
.AccessSVGExtensions()
.InvalidateSVGRootsWithRelativeLengthDescendents(nullptr);
}

NGConstraintSpace constraint_space =
NGConstraintSpace::CreateFromLayoutObject(*this);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="https://crbug.com/1403588">
<link rel="match" href="reference/mask-image-url-svg-ref.html">
<meta name="fuzzy" content="maxDifference=1-70;totalPixels=0-24">
<style>
.t {
width: 50vw;
height: 10vh;
background: blue;
margin: 8px;
}
.t-1 { -webkit-mask-image: url("support/mask-2.svg#test-1"); }
.t-2 { -webkit-mask-image: url("support/mask-2.svg#test-2"); }
.t-3 { -webkit-mask-image: url("support/mask-2.svg#test-3"); }
.t-4 { -webkit-mask-image: url("support/mask-2.svg#test-4"); }
.t-5 { -webkit-mask-image: url("support/mask-2.svg#test-5"); }
</style>
</head>
<body>
<div class="t t-1"></div>
<div class="t t-2"></div>
<div class="t t-3"></div>
<div class="t t-4"></div>
<div class="t t-5"></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<style>
.full {
width: 50vw;
height: 10vh;
margin: 8px;
}
.half {
width: 25vw;
height: 10vh;
overflow: hidden;
margin: 8px;
}
</style>

<div class="full">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<rect fill="blue" x="0" width="100%" height="100%" rx="10" />
</svg>
</div>
<div class="half">
<svg xmlns="http://www.w3.org/2000/svg" width="200%" height="200%">
<rect fill="blue" x="0" width="100%" height="100%" rx="10" />
</svg>
</div>
<div class="full">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<rect fill="blue" x="0" width="100%" height="100%" rx="10" />
</svg>
</div>
<div class="full">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<rect fill="blue" x="0" width="100%" height="100%" rx="10" />
</svg>
</div>
<div class="full">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
<rect fill="blue" x="0" width="100%" height="100%" rx="10" />
</svg>
</div>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d8917af

Please sign in to comment.