summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael BrĂ¼ning <michael.bruning@qt.io>2020-09-29 15:51:18 +0200
committerMichael BrĂ¼ning <michael.bruning@qt.io>2020-10-05 12:02:19 +0000
commitd7c2cf253996bd5b4a893b52fd719b11c9ec7ba9 (patch)
tree4d4dd4e5a186f7db45098de34fac33614a77a157
parentb59af853f7b36829bda7c4947028e058017d4efd (diff)
downloadqtwebengine-chromium-d7c2cf253996bd5b4a893b52fd719b11c9ec7ba9.tar.gz
[Backport] Security issue 1102137
Remove anonymous block wrapper when inline continuation is removed. Keeping empty anonymous blocks around is bad. The only known actual problem is in multicol (but it may cause other issues too). Based on the layout object tree, multicol creates anonymous LayoutMultiColumnSet and LayoutMultiColumnSpannerPlaceholder objects, to keep track of what is regular column content and what are spanners. Leaving a LayoutMultiColumnSet around just for the sake of an empty anonymous block (which may get cleaned up without notifying the multicol code) will confuse multicol layout. (cherry picked from commit 48919b7a63545c092d11d2424cb4058ffa0ef7c3) Bug: 1102137 Change-Id: Ibfb46d0dc173ecfdb2e7903efee5a49de3da3ff3 Commit-Queue: Morten Stenshorne <mstensho@chromium.org> Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Rune Lillesveen <futhark@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#786197} Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org> Cr-Commit-Position: refs/branch-heads/4183@{#658} Cr-Branched-From: 740e9e8a40505392ba5c8e022a8024b3d018ca65-refs/heads/master@{#782793} Reviewed-by: Michal Klocek <michal.klocek@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/third_party/blink/renderer/core/layout/layout_object.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_object.cc b/chromium/third_party/blink/renderer/core/layout/layout_object.cc
index ba25b42c7d5..61592a7d3c6 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_object.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_object.cc
@@ -3272,9 +3272,26 @@ void LayoutObject::DestroyAndCleanupAnonymousWrappers() {
if (destroy_root_parent->IsLayoutFlowThread())
break;
- if (destroy_root->PreviousSibling() || destroy_root->NextSibling())
- break; // Need to keep the anonymous parent, since it won't become empty
- // by the removal of this LayoutObject.
+ // We need to keep the anonymous parent, if it won't become empty by the
+ // removal of this LayoutObject.
+ if (destroy_root->PreviousSibling())
+ break;
+ if (const LayoutObject* sibling = destroy_root->NextSibling()) {
+ if (destroy_root->GetNode()) {
+ // When there are inline continuations, there may be multiple layout
+ // objects generated from the same node, and those are special. They
+ // will be removed as part of destroying |this|, in
+ // LayoutInline::WillBeDestroyed(). So if that's all we have left, we
+ // need to realize now that the anonymous containing block will become
+ // empty. So we have to destroy it.
+ while (sibling && sibling->GetNode() == destroy_root->GetNode())
+ sibling = sibling->NextSibling();
+ }
+ if (sibling)
+ break;
+ DCHECK(destroy_root->IsLayoutInline());
+ DCHECK(ToLayoutInline(destroy_root)->Continuation());
+ }
}
destroy_root->Destroy();