Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutInline.cpp

Issue 2806123002: Restore behaviour of middle anonymous blocks inheriting style from inline parents (Closed)
Patch Set: bug 706324 Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 beforeChild = lastChild(); 339 beforeChild = lastChild();
340 340
341 if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned() && 341 if (!newChild->isInline() && !newChild->isFloatingOrOutOfFlowPositioned() &&
342 !newChild->isTablePart()) { 342 !newChild->isTablePart()) {
343 // We are placing a block inside an inline. We have to perform a split of 343 // We are placing a block inside an inline. We have to perform a split of
344 // this inline into continuations. This involves creating an anonymous 344 // this inline into continuations. This involves creating an anonymous
345 // block box to hold |newChild|. We then make that block box a continuation 345 // block box to hold |newChild|. We then make that block box a continuation
346 // of this inline. We take all of the children after |beforeChild| and put 346 // of this inline. We take all of the children after |beforeChild| and put
347 // them in a clone of this object. 347 // them in a clone of this object.
348 RefPtr<ComputedStyle> newStyle = 348 RefPtr<ComputedStyle> newStyle =
349 ComputedStyle::createAnonymousStyleWithDisplay( 349 ComputedStyle::createAnonymousStyleWithDisplay(styleRef(),
350 containingBlock()->styleRef(), EDisplay::kBlock); 350 EDisplay::kBlock);
351 // Block elements in the anon block must use the direction set by the
352 // anon block's containing block, so we need to prevent the anon block
353 // from inheriting direction from the inline. If there are any other
354 // inheritable properties that apply to block and inline elements
355 // but only affect the layout of children we will want to special-case
356 // them here too. Writing-mode would be one if it didn't create a
357 // formatting context of its own, removing the need for continuations.
mstensho (USE GERRIT) 2017/04/19 09:32:48 Great comment. Could you also add that this anonym
358 newStyle->setDirection(containingBlock()->styleRef().direction());
351 359
352 // If inside an inline affected by in-flow positioning the block needs to be 360 // If inside an inline affected by in-flow positioning the block needs to be
353 // affected by it too. Giving the block a layer like this allows it to 361 // affected by it too. Giving the block a layer like this allows it to
354 // collect the x/y offsets from inline parents later. 362 // collect the x/y offsets from inline parents later.
355 if (LayoutObject* positionedAncestor = inFlowPositionedInlineAncestor(this)) 363 if (LayoutObject* positionedAncestor = inFlowPositionedInlineAncestor(this))
356 newStyle->setPosition(positionedAncestor->style()->position()); 364 newStyle->setPosition(positionedAncestor->style()->position());
357 365
358 LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&document()); 366 LayoutBlockFlow* newBox = LayoutBlockFlow::createAnonymous(&document());
359 newBox->setStyle(std::move(newStyle)); 367 newBox->setStyle(std::move(newStyle));
360 LayoutBoxModelObject* oldContinuation = continuation(); 368 LayoutBoxModelObject* oldContinuation = continuation();
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1543 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1536 } 1544 }
1537 1545
1538 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1546 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1539 LayoutRect LayoutInline::debugRect() const { 1547 LayoutRect LayoutInline::debugRect() const {
1540 IntRect linesBox = enclosingIntRect(linesBoundingBox()); 1548 IntRect linesBox = enclosingIntRect(linesBoundingBox());
1541 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); 1549 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
1542 } 1550 }
1543 1551
1544 } // namespace blink 1552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698