| OLD | NEW |
| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 before_child = LastChild(); | 336 before_child = LastChild(); |
| 337 | 337 |
| 338 if (!new_child->IsInline() && !new_child->IsFloatingOrOutOfFlowPositioned() && | 338 if (!new_child->IsInline() && !new_child->IsFloatingOrOutOfFlowPositioned() && |
| 339 !new_child->IsTablePart()) { | 339 !new_child->IsTablePart()) { |
| 340 // We are placing a block inside an inline. We have to perform a split of | 340 // We are placing a block inside an inline. We have to perform a split of |
| 341 // this inline into continuations. This involves creating an anonymous | 341 // this inline into continuations. This involves creating an anonymous |
| 342 // block box to hold |newChild|. We then make that block box a continuation | 342 // block box to hold |newChild|. We then make that block box a continuation |
| 343 // of this inline. We take all of the children after |beforeChild| and put | 343 // of this inline. We take all of the children after |beforeChild| and put |
| 344 // them in a clone of this object. | 344 // them in a clone of this object. |
| 345 RefPtr<ComputedStyle> new_style = | 345 RefPtr<ComputedStyle> new_style = |
| 346 ComputedStyle::CreateAnonymousStyleWithDisplay( | 346 ComputedStyle::CreateAnonymousStyleWithDisplay(StyleRef(), |
| 347 ContainingBlock()->StyleRef(), EDisplay::kBlock); | 347 EDisplay::kBlock); |
| 348 // The anon block we create here doesn't exist in the CSS spec, so |
| 349 // we need to ensure that any blocks it contains inherit properly |
| 350 // from its true parent. This means they must use the direction set by the |
| 351 // anon block's containing block, so we need to prevent the anon block |
| 352 // from inheriting direction from the inline. If there are any other |
| 353 // inheritable properties that apply to block and inline elements |
| 354 // but only affect the layout of children we will want to special-case |
| 355 // them here too. Writing-mode would be one if it didn't create a |
| 356 // formatting context of its own, removing the need for continuations. |
| 357 new_style->SetDirection(ContainingBlock()->StyleRef().Direction()); |
| 348 | 358 |
| 349 // If inside an inline affected by in-flow positioning the block needs to be | 359 // If inside an inline affected by in-flow positioning the block needs to be |
| 350 // affected by it too. Giving the block a layer like this allows it to | 360 // affected by it too. Giving the block a layer like this allows it to |
| 351 // collect the x/y offsets from inline parents later. | 361 // collect the x/y offsets from inline parents later. |
| 352 if (LayoutObject* positioned_ancestor = | 362 if (LayoutObject* positioned_ancestor = |
| 353 InFlowPositionedInlineAncestor(this)) | 363 InFlowPositionedInlineAncestor(this)) |
| 354 new_style->SetPosition(positioned_ancestor->Style()->GetPosition()); | 364 new_style->SetPosition(positioned_ancestor->Style()->GetPosition()); |
| 355 | 365 |
| 356 LayoutBlockFlow* new_box = LayoutBlockFlow::CreateAnonymous(&GetDocument()); | 366 LayoutBlockFlow* new_box = LayoutBlockFlow::CreateAnonymous(&GetDocument()); |
| 357 new_box->SetStyle(std::move(new_style)); | 367 new_box->SetStyle(std::move(new_style)); |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 paint_invalidator.InvalidateDisplayItemClient(*box, invalidation_reason); | 1552 paint_invalidator.InvalidateDisplayItemClient(*box, invalidation_reason); |
| 1543 } | 1553 } |
| 1544 | 1554 |
| 1545 // TODO(lunalu): Not to just dump 0, 0 as the x and y here | 1555 // TODO(lunalu): Not to just dump 0, 0 as the x and y here |
| 1546 LayoutRect LayoutInline::DebugRect() const { | 1556 LayoutRect LayoutInline::DebugRect() const { |
| 1547 IntRect lines_box = EnclosingIntRect(LinesBoundingBox()); | 1557 IntRect lines_box = EnclosingIntRect(LinesBoundingBox()); |
| 1548 return LayoutRect(IntRect(0, 0, lines_box.Width(), lines_box.Height())); | 1558 return LayoutRect(IntRect(0, 0, lines_box.Width(), lines_box.Height())); |
| 1549 } | 1559 } |
| 1550 | 1560 |
| 1551 } // namespace blink | 1561 } // namespace blink |
| OLD | NEW |