1 /* 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * (C) 2007 David Smith (catfish.man@gmail.com) 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) 2013 Google Inc. All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are 11 * met: 12 * 13 * * Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * * Redistributions in binary form must reproduce the above 16 * copyright notice, this list of conditions and the following disclaimer 17 * in the documentation and/or other materials provided with the 18 * distribution. 19 * * Neither the name of Google Inc. nor the names of its 20 * contributors may be used to endorse or promote products derived from 21 * this software without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 */ 35 36 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_BLOCK_FLOW_H_ 37 #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_BLOCK_FLOW_H_ 38 39 #include <memory> 40 #include "third_party/blink/renderer/core/core_export.h" 41 #include "third_party/blink/renderer/core/layout/api/line_layout_item.h" 42 #include "third_party/blink/renderer/core/layout/floating_objects.h" 43 #include "third_party/blink/renderer/core/layout/layout_block.h" 44 #include "third_party/blink/renderer/core/layout/line/line_box_list.h" 45 #include "third_party/blink/renderer/core/layout/line/root_inline_box.h" 46 #include "third_party/blink/renderer/core/layout/line/trailing_objects.h" 47 48 namespace blink { 49 50 template <class Run> 51 class BidiRunList; 52 class BlockChildrenLayoutInfo; 53 class LayoutInline; 54 class LineInfo; 55 class LineLayoutState; 56 class LineWidth; 57 class LayoutMultiColumnFlowThread; 58 class LayoutMultiColumnSpannerPlaceholder; 59 class LayoutRubyRun; 60 class MarginInfo; 61 class NGBlockBreakToken; 62 class NGOffsetMapping; 63 class NGPhysicalContainerFragment; 64 class NGPhysicalFragment; 65 66 struct NGInlineNodeData; 67 68 enum IndentTextOrNot { kDoNotIndentText, kIndentText }; 69 70 // LayoutBlockFlow is the class that implements a block container in CSS 2.1. 71 // http://www.w3.org/TR/CSS21/visuren.html#block-boxes 72 // 73 // LayoutBlockFlows are the only LayoutObject allowed to own floating objects 74 // (aka floats): http://www.w3.org/TR/CSS21/visuren.html#floats . 75 // 76 // Floats are inserted into |m_floatingObjects| (see FloatingObjects for more 77 // information on how floats are modelled) during layout. This happens either as 78 // part of laying out blocks (layoutBlockChildren) or line layout (LineBreaker 79 // class). This is because floats can be part of an inline or a block context. 80 // 81 // An interesting feature of floats is that they can intrude into the next 82 // block(s). This means that |m_floatingObjects| can potentially contain 83 // pointers to a previous sibling LayoutBlockFlow's float. 84 // 85 // LayoutBlockFlow is also the only LayoutObject to own a line box tree and 86 // perform inline layout. See LayoutBlockFlowLine.cpp for these parts. 87 // 88 // TODO(jchaffraix): We need some float and line box expert to expand on this. 89 // 90 // LayoutBlockFlow enforces the following invariant: 91 // 92 // All in-flow children (ie excluding floating and out-of-flow positioned) are 93 // either all blocks or all inline boxes. 94 // 95 // This is suggested by CSS to correctly the layout mixed inlines and blocks 96 // lines (http://www.w3.org/TR/CSS21/visuren.html#anonymous-block-level). See 97 // LayoutBlock::addChild about how the invariant is enforced. 98 class CORE_EXPORT LayoutBlockFlow : public LayoutBlock { 99 public: 100 explicit LayoutBlockFlow(ContainerNode*); 101 ~LayoutBlockFlow() override; 102 103 static LayoutBlockFlow* CreateAnonymous(Document*, 104 scoped_refptr<ComputedStyle>, 105 LegacyLayout); 106 IsLayoutBlockFlow()107 bool IsLayoutBlockFlow() const final { 108 NOT_DESTROYED(); 109 return true; 110 } 111 112 void UpdateBlockLayout(bool relayout_children) override; 113 114 void ComputeVisualOverflow(bool recompute_floats) override; 115 void ComputeLayoutOverflow(LayoutUnit old_client_after_edge, 116 bool recompute_floats = false) override; 117 118 void DeleteLineBoxTree(); 119 120 bool CanContainFirstFormattedLine() const; 121 122 LayoutUnit AvailableLogicalWidthForLine( 123 LayoutUnit position, 124 IndentTextOrNot indent_text, 125 LayoutUnit logical_height = LayoutUnit()) const { 126 NOT_DESTROYED(); 127 return (LogicalRightOffsetForLine(position, indent_text, logical_height) - 128 LogicalLeftOffsetForLine(position, indent_text, logical_height)) 129 .ClampNegativeToZero(); 130 } 131 LayoutUnit LogicalRightOffsetForLine( 132 LayoutUnit position, 133 IndentTextOrNot indent_text, 134 LayoutUnit logical_height = LayoutUnit()) const { 135 NOT_DESTROYED(); 136 return LogicalRightOffsetForLine(position, LogicalRightOffsetForContent(), 137 indent_text, logical_height); 138 } 139 LayoutUnit LogicalLeftOffsetForLine( 140 LayoutUnit position, 141 IndentTextOrNot indent_text, 142 LayoutUnit logical_height = LayoutUnit()) const { 143 NOT_DESTROYED(); 144 return LogicalLeftOffsetForLine(position, LogicalLeftOffsetForContent(), 145 indent_text, logical_height); 146 } 147 LayoutUnit StartOffsetForLine( 148 LayoutUnit position, 149 IndentTextOrNot indent_text, 150 LayoutUnit logical_height = LayoutUnit()) const { 151 NOT_DESTROYED(); 152 return StyleRef().IsLeftToRightDirection() 153 ? LogicalLeftOffsetForLine(position, indent_text, logical_height) 154 : LogicalWidth() - LogicalRightOffsetForLine( 155 position, indent_text, logical_height); 156 } 157 158 LayoutUnit AvailableLogicalWidthForAvoidingFloats( 159 LayoutUnit position, 160 LayoutUnit logical_height = LayoutUnit()) const { 161 NOT_DESTROYED(); 162 return (LogicalRightOffsetForAvoidingFloats(position, logical_height) - 163 LogicalLeftOffsetForAvoidingFloats(position, logical_height)) 164 .ClampNegativeToZero(); 165 } 166 LayoutUnit LogicalLeftOffsetForAvoidingFloats( 167 LayoutUnit position, 168 LayoutUnit logical_height = LayoutUnit()) const { 169 NOT_DESTROYED(); 170 return LogicalLeftFloatOffsetForAvoidingFloats( 171 position, LogicalLeftOffsetForContent(), logical_height); 172 } 173 LayoutUnit LogicalRightOffsetForAvoidingFloats( 174 LayoutUnit position, 175 LayoutUnit logical_height = LayoutUnit()) const { 176 NOT_DESTROYED(); 177 return LogicalRightFloatOffsetForAvoidingFloats( 178 position, LogicalRightOffsetForContent(), logical_height); 179 } 180 LayoutUnit StartOffsetForAvoidingFloats( 181 LayoutUnit position, 182 LayoutUnit logical_height = LayoutUnit()) const { 183 NOT_DESTROYED(); 184 return StyleRef().IsLeftToRightDirection() 185 ? LogicalLeftOffsetForAvoidingFloats(position, logical_height) 186 : LogicalWidth() - LogicalRightOffsetForAvoidingFloats( 187 position, logical_height); 188 } 189 LayoutUnit EndOffsetForAvoidingFloats( 190 LayoutUnit position, 191 LayoutUnit logical_height = LayoutUnit()) const { 192 NOT_DESTROYED(); 193 return !StyleRef().IsLeftToRightDirection() 194 ? LogicalLeftOffsetForAvoidingFloats(position, logical_height) 195 : LogicalWidth() - LogicalRightOffsetForAvoidingFloats( 196 position, logical_height); 197 } 198 LineBoxes()199 const LineBoxList& LineBoxes() const { 200 NOT_DESTROYED(); 201 return line_boxes_; 202 } LineBoxes()203 LineBoxList* LineBoxes() { 204 NOT_DESTROYED(); 205 return &line_boxes_; 206 } FirstLineBox()207 InlineFlowBox* FirstLineBox() const { 208 NOT_DESTROYED(); 209 return line_boxes_.First(); 210 } LastLineBox()211 InlineFlowBox* LastLineBox() const { 212 NOT_DESTROYED(); 213 return line_boxes_.Last(); 214 } FirstRootBox()215 RootInlineBox* FirstRootBox() const { 216 NOT_DESTROYED(); 217 return static_cast<RootInlineBox*>(FirstLineBox()); 218 } LastRootBox()219 RootInlineBox* LastRootBox() const { 220 NOT_DESTROYED(); 221 return static_cast<RootInlineBox*>(LastLineBox()); 222 } 223 224 RootInlineBox* CreateAndAppendRootInlineBox(); 225 RootInlineBox* ConstructLine(BidiRunList<BidiRun>&, const LineInfo&); 226 227 // Return the number of lines in *this* block flow. Does not recurse into 228 // block flow children. 229 // Will start counting from the first line, and stop counting right after 230 // |stopRootInlineBox|, if specified. 231 int LineCount(const RootInlineBox* stop_root_inline_box = nullptr) const; 232 233 LayoutUnit FirstLineBoxBaseline() const override; 234 LayoutUnit InlineBlockBaseline(LineDirectionMode) const override; 235 236 void RemoveFloatingObjectsFromDescendants(); 237 void MarkAllDescendantsWithFloatsForLayout( 238 LayoutBox* float_to_remove = nullptr, 239 bool in_layout = true); 240 void MarkSiblingsWithFloatsForLayout(LayoutBox* float_to_remove = nullptr); 241 ContainsFloats()242 bool ContainsFloats() const { 243 NOT_DESTROYED(); 244 return floating_objects_ && !floating_objects_->Set().IsEmpty(); 245 } 246 bool ContainsFloat(LayoutBox*) const; 247 248 void RemoveFloatingObjects(); 249 VirtualContinuation()250 LayoutBoxModelObject* VirtualContinuation() const final { 251 NOT_DESTROYED(); 252 return Continuation(); 253 } IsAnonymousBlockContinuation()254 bool IsAnonymousBlockContinuation() const { 255 NOT_DESTROYED(); 256 return Continuation() && IsAnonymousBlock(); 257 } 258 259 using LayoutBoxModelObject::Continuation; 260 using LayoutBoxModelObject::SetContinuation; 261 262 LayoutInline* InlineElementContinuation() const; 263 264 void AddChild(LayoutObject* new_child, 265 LayoutObject* before_child = nullptr) override; 266 void RemoveChild(LayoutObject*) override; 267 268 void MoveAllChildrenIncludingFloatsTo(LayoutBlock* to_block, 269 bool full_remove_insert); 270 271 void ChildBecameFloatingOrOutOfFlow(LayoutBox* child); 272 void CollapseAnonymousBlockChild(LayoutBlockFlow* child); 273 274 bool GeneratesLineBoxesForInlineChild(LayoutObject*); 275 LogicalTopForFloat(const FloatingObject & floating_object)276 LayoutUnit LogicalTopForFloat(const FloatingObject& floating_object) const { 277 NOT_DESTROYED(); 278 return IsHorizontalWritingMode() ? floating_object.Y() 279 : floating_object.X(); 280 } LogicalBottomForFloat(const FloatingObject & floating_object)281 LayoutUnit LogicalBottomForFloat( 282 const FloatingObject& floating_object) const { 283 NOT_DESTROYED(); 284 return IsHorizontalWritingMode() ? floating_object.MaxY() 285 : floating_object.MaxX(); 286 } LogicalLeftForFloat(const FloatingObject & floating_object)287 LayoutUnit LogicalLeftForFloat(const FloatingObject& floating_object) const { 288 NOT_DESTROYED(); 289 return IsHorizontalWritingMode() ? floating_object.X() 290 : floating_object.Y(); 291 } LogicalRightForFloat(const FloatingObject & floating_object)292 LayoutUnit LogicalRightForFloat(const FloatingObject& floating_object) const { 293 NOT_DESTROYED(); 294 return IsHorizontalWritingMode() ? floating_object.MaxX() 295 : floating_object.MaxY(); 296 } LogicalWidthForFloat(const FloatingObject & floating_object)297 LayoutUnit LogicalWidthForFloat(const FloatingObject& floating_object) const { 298 NOT_DESTROYED(); 299 return IsHorizontalWritingMode() ? floating_object.Width() 300 : floating_object.Height(); 301 } 302 SetLogicalTopForFloat(FloatingObject & floating_object,LayoutUnit logical_top)303 void SetLogicalTopForFloat(FloatingObject& floating_object, 304 LayoutUnit logical_top) { 305 NOT_DESTROYED(); 306 if (IsHorizontalWritingMode()) 307 floating_object.SetY(logical_top); 308 else 309 floating_object.SetX(logical_top); 310 } SetLogicalLeftForFloat(FloatingObject & floating_object,LayoutUnit logical_left)311 void SetLogicalLeftForFloat(FloatingObject& floating_object, 312 LayoutUnit logical_left) { 313 NOT_DESTROYED(); 314 if (IsHorizontalWritingMode()) 315 floating_object.SetX(logical_left); 316 else 317 floating_object.SetY(logical_left); 318 } SetLogicalHeightForFloat(FloatingObject & floating_object,LayoutUnit logical_height)319 void SetLogicalHeightForFloat(FloatingObject& floating_object, 320 LayoutUnit logical_height) { 321 NOT_DESTROYED(); 322 if (IsHorizontalWritingMode()) 323 floating_object.SetHeight(logical_height); 324 else 325 floating_object.SetWidth(logical_height); 326 } SetLogicalWidthForFloat(FloatingObject & floating_object,LayoutUnit logical_width)327 void SetLogicalWidthForFloat(FloatingObject& floating_object, 328 LayoutUnit logical_width) { 329 NOT_DESTROYED(); 330 if (IsHorizontalWritingMode()) 331 floating_object.SetWidth(logical_width); 332 else 333 floating_object.SetHeight(logical_width); 334 } 335 336 LayoutUnit StartAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot); 337 338 void SetStaticInlinePositionForChild(LayoutBox&, LayoutUnit inline_position); 339 void UpdateStaticInlinePositionForChild(LayoutBox&, 340 LayoutUnit logical_top, 341 IndentTextOrNot = kDoNotIndentText); 342 ShouldSkipCreatingRunsForObject(LineLayoutItem obj)343 static bool ShouldSkipCreatingRunsForObject(LineLayoutItem obj) { 344 return obj.IsFloating() || (obj.IsOutOfFlowPositioned() && 345 !obj.StyleRef().IsOriginalDisplayInlineType() && 346 !obj.Container().IsLayoutInline()); 347 } 348 MultiColumnFlowThread()349 LayoutMultiColumnFlowThread* MultiColumnFlowThread() const { 350 NOT_DESTROYED(); 351 return rare_data_ ? rare_data_->multi_column_flow_thread_ : nullptr; 352 } ResetMultiColumnFlowThread()353 void ResetMultiColumnFlowThread() { 354 NOT_DESTROYED(); 355 if (rare_data_) 356 rare_data_->multi_column_flow_thread_ = nullptr; 357 } 358 359 void AddVisualOverflowFromInlineChildren(); 360 361 void AddLayoutOverflowFromInlineChildren(); 362 363 // FIXME: This should be const to avoid a const_cast, but can modify child 364 // dirty bits and LayoutTextCombine. 365 void ComputeInlinePreferredLogicalWidths(LayoutUnit& min_logical_width, 366 LayoutUnit& max_logical_width); 367 368 bool AllowsPaginationStrut() const; 369 // Pagination strut caused by the first line or child block inside this 370 // block-level object. 371 // 372 // When the first piece of content (first child block or line) inside an 373 // object wants to insert a soft page or column break, rather than setting a 374 // pagination strut on itself it normally propagates the strut to its 375 // containing block (|this|), as long as our implementation can handle it. 376 // The idea is that we want to push the entire object to the next page or 377 // column along with the child content that caused the break, instead of 378 // leaving unusable space at the beginning of the object at the end of one 379 // column or page and just push the first line or block to the next column or 380 // page. That would waste space in the container for no good reason, and it 381 // would also be a spec violation, since there is no break opportunity defined 382 // between the content logical top of an object and its first child or line 383 // (only *between* blocks or lines). PaginationStrutPropagatedFromChild()384 LayoutUnit PaginationStrutPropagatedFromChild() const { 385 NOT_DESTROYED(); 386 return rare_data_ ? rare_data_->pagination_strut_propagated_from_child_ 387 : LayoutUnit(); 388 } 389 void SetPaginationStrutPropagatedFromChild(LayoutUnit); 390 FirstForcedBreakOffset()391 LayoutUnit FirstForcedBreakOffset() const { 392 NOT_DESTROYED(); 393 if (!rare_data_) 394 return LayoutUnit(); 395 return rare_data_->first_forced_break_offset_; 396 } 397 void SetFirstForcedBreakOffset(LayoutUnit); 398 399 const AtomicString StartPageName() const final; 400 const AtomicString EndPageName() const final; 401 402 void PositionSpannerDescendant(LayoutMultiColumnSpannerPlaceholder& child); 403 404 bool CreatesNewFormattingContext() const override; 405 406 using LayoutBoxModelObject::MoveChildrenTo; 407 void MoveChildrenTo(LayoutBoxModelObject* to_box_model_object, 408 LayoutObject* start_child, 409 LayoutObject* end_child, 410 LayoutObject* before_child, 411 bool full_remove_insert = false) override; 412 XPositionForFloatIncludingMargin(const FloatingObject & child)413 LayoutUnit XPositionForFloatIncludingMargin( 414 const FloatingObject& child) const { 415 NOT_DESTROYED(); 416 LayoutUnit scrollbar_adjustment(OriginAdjustmentForScrollbars().Width()); 417 if (IsHorizontalWritingMode()) { 418 return child.X() + child.GetLayoutObject()->MarginLeft() + 419 scrollbar_adjustment; 420 } 421 return child.X() + MarginBeforeForChild(*child.GetLayoutObject()); 422 } 423 424 DISABLE_CFI_PERF YPositionForFloatIncludingMargin(const FloatingObject & child)425 LayoutUnit YPositionForFloatIncludingMargin( 426 const FloatingObject& child) const { 427 NOT_DESTROYED(); 428 if (IsHorizontalWritingMode()) 429 return child.Y() + MarginBeforeForChild(*child.GetLayoutObject()); 430 431 return child.Y() + child.GetLayoutObject()->MarginTop(); 432 } 433 434 LayoutPoint FlipFloatForWritingModeForChild(const FloatingObject&, 435 const LayoutPoint&) const; 436 GetName()437 const char* GetName() const override { 438 NOT_DESTROYED(); 439 return "LayoutBlockFlow"; 440 } 441 442 FloatingObject* InsertFloatingObject(LayoutBox&); 443 444 // Return the last placed float. If |iterator| is non-null, it will be set to 445 // the float right after said float. 446 FloatingObject* LastPlacedFloat( 447 FloatingObjectSetIterator* iterator = nullptr) const; 448 449 // Position and lay out all floats that have not yet been positioned. 450 // 451 // This will mark them as "placed", which means that they have found their 452 // final location in this layout pass. 453 // 454 // |logicalTopMarginEdge| is the minimum logical top for the floats. The 455 // final logical top of the floats will also be affected by clearance and 456 // space available after having positioned earlier floats. 457 // 458 // Returns true if and only if it has placed any floats. 459 bool PlaceNewFloats(LayoutUnit logical_top_margin_edge, LineWidth* = nullptr); 460 461 // Position and lay out the float, if it needs layout. 462 // |logicalTopMarginEdge| is the minimum logical top offset for the float. 463 // The value returned is the minimum logical top offset for subsequent 464 // floats. 465 LayoutUnit PositionAndLayoutFloat(FloatingObject&, 466 LayoutUnit logical_top_margin_edge); 467 468 LayoutUnit NextFloatLogicalBottomBelow(LayoutUnit) const; 469 LayoutUnit NextFloatLogicalBottomBelowForBlock(LayoutUnit) const; 470 LastFloatFromPreviousLine()471 FloatingObject* LastFloatFromPreviousLine() const { 472 NOT_DESTROYED(); 473 return ContainsFloats() ? floating_objects_->Set().back().get() : nullptr; 474 } 475 476 void SetShouldDoFullPaintInvalidationForFirstLine(); 477 478 void SimplifiedNormalFlowInlineLayout(); 479 RecalcLayoutOverflowResult RecalcInlineChildrenLayoutOverflow(); 480 void RecalcInlineChildrenVisualOverflow(); 481 482 PositionWithAffinity PositionForPoint(const PhysicalOffset&) const override; 483 PositionWithAffinity PositionForPoint(const LayoutObject& offset_parent, 484 const PhysicalOffset& offset) const; 485 bool ShouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom() const; 486 487 LayoutUnit LowestFloatLogicalBottom(EClear = EClear::kBoth) const; 488 HasOverhangingFloats()489 bool HasOverhangingFloats() const { 490 NOT_DESTROYED(); 491 return Parent() && ContainsFloats() && 492 LowestFloatLogicalBottom() > LogicalHeight(); 493 } IsOverhangingFloat(const FloatingObject & float_object)494 bool IsOverhangingFloat(const FloatingObject& float_object) const { 495 NOT_DESTROYED(); 496 return LogicalBottomForFloat(float_object) > LogicalHeight(); 497 } 498 499 LayoutUnit LogicalHeightWithVisibleOverflow() const final; 500 SetIsSelfCollapsingFromNG(bool is_self_collapsing)501 void SetIsSelfCollapsingFromNG(bool is_self_collapsing) { 502 NOT_DESTROYED(); 503 is_self_collapsing_ = is_self_collapsing; 504 } 505 506 // These functions are only public so we can call it from NGBlockNode while 507 // we're still working on LayoutNG. 508 void AddVisualOverflowFromFloats(); 509 void AddVisualOverflowFromFloats(const NGPhysicalContainerFragment& fragment); 510 void AddLayoutOverflowFromFloats(); 511 TakeNGInlineNodeData()512 virtual NGInlineNodeData* TakeNGInlineNodeData() { 513 NOT_DESTROYED(); 514 return nullptr; 515 } GetNGInlineNodeData()516 virtual NGInlineNodeData* GetNGInlineNodeData() const { 517 NOT_DESTROYED(); 518 return nullptr; 519 } ResetNGInlineNodeData()520 virtual void ResetNGInlineNodeData() { NOT_DESTROYED(); } ClearNGInlineNodeData()521 virtual void ClearNGInlineNodeData() { NOT_DESTROYED(); } HasNGInlineNodeData()522 virtual bool HasNGInlineNodeData() const { 523 NOT_DESTROYED(); 524 return false; 525 } WillCollectInlines()526 virtual void WillCollectInlines() { NOT_DESTROYED(); } 527 virtual void SetPaintFragment(const NGBlockBreakToken*, 528 scoped_refptr<const NGPhysicalFragment>); 529 530 #if DCHECK_IS_ON() 531 void ShowLineTreeAndMark(const InlineBox* = nullptr, 532 const char* = nullptr, 533 const InlineBox* = nullptr, 534 const char* = nullptr, 535 const LayoutObject* = nullptr) const; 536 #endif 537 538 protected: 539 void RebuildFloatsFromIntruding(); 540 void LayoutInlineChildren(bool relayout_children, LayoutUnit after_edge); 541 void AddLowestFloatFromChildren(LayoutBlockFlow*); 542 543 void CreateFloatingObjects(); 544 545 void WillBeDestroyed() override; 546 void StyleWillChange(StyleDifference, 547 const ComputedStyle& new_style) override; 548 void StyleDidChange(StyleDifference, const ComputedStyle* old_style) override; 549 550 void UpdateBlockChildDirtyBitsBeforeLayout(bool relayout_children, 551 LayoutBox&); 552 void AbsoluteQuads(Vector<FloatQuad>&, 553 MapCoordinatesFlags mode = 0) const override; 554 void AbsoluteQuadsForSelf(Vector<FloatQuad>& quads, 555 MapCoordinatesFlags mode = 0) const override; 556 LayoutObject* HoverAncestor() const final; 557 558 LayoutUnit LogicalRightOffsetForLine( 559 LayoutUnit logical_top, 560 LayoutUnit fixed_offset, 561 IndentTextOrNot apply_text_indent, 562 LayoutUnit logical_height = LayoutUnit()) const { 563 NOT_DESTROYED(); 564 return AdjustLogicalRightOffsetForLine( 565 LogicalRightFloatOffsetForLine(logical_top, fixed_offset, 566 logical_height), 567 apply_text_indent); 568 } 569 LayoutUnit LogicalLeftOffsetForLine( 570 LayoutUnit logical_top, 571 LayoutUnit fixed_offset, 572 IndentTextOrNot apply_text_indent, 573 LayoutUnit logical_height = LayoutUnit()) const { 574 NOT_DESTROYED(); 575 return AdjustLogicalLeftOffsetForLine( 576 LogicalLeftFloatOffsetForLine(logical_top, fixed_offset, 577 logical_height), 578 apply_text_indent); 579 } 580 581 virtual LayoutObject* LayoutSpecialExcludedChild(bool /*relayoutChildren*/, 582 SubtreeLayoutScope&); 583 bool UpdateLogicalWidthAndColumnWidth() override; 584 585 void SetLogicalLeftForChild(LayoutBox& child, LayoutUnit logical_left); 586 void SetLogicalTopForChild(LayoutBox& child, LayoutUnit logical_top); 587 void DetermineLogicalLeftPositionForChild(LayoutBox& child); 588 589 void AddOutlineRects(Vector<PhysicalRect>&, 590 const PhysicalOffset& additional_offset, 591 NGOutlineType) const override; 592 593 void InvalidateDisplayItemClients(PaintInvalidationReason) const override; 594 595 Node* NodeForHitTest() const final; 596 bool HitTestChildren(HitTestResult&, 597 const HitTestLocation&, 598 const PhysicalOffset& accumulated_offset, 599 HitTestAction) override; 600 601 PhysicalOffset AccumulateRelativePositionOffsets() const override; 602 603 private: 604 void ResetLayout(); 605 void LayoutChildren(bool relayout_children, SubtreeLayoutScope&); 606 void AddOverhangingFloatsFromChildren(LayoutUnit unconstrained_height); 607 void LayoutBlockChildren(bool relayout_children, 608 SubtreeLayoutScope&, 609 LayoutUnit before_edge, 610 LayoutUnit after_edge); 611 612 void MarkDescendantsWithFloatsForLayoutIfNeeded( 613 LayoutBlockFlow& child, 614 LayoutUnit new_logical_top, 615 LayoutUnit previous_float_logical_bottom); 616 bool PositionAndLayoutOnceIfNeeded(LayoutBox& child, 617 LayoutUnit new_logical_top, 618 BlockChildrenLayoutInfo&); 619 620 // Handle breaking policy before the child, and insert a forced break in front 621 // of it if needed. 622 void InsertForcedBreakBeforeChildIfNeeded(LayoutBox& child, 623 BlockChildrenLayoutInfo&); 624 625 void LayoutBlockChild(LayoutBox& child, BlockChildrenLayoutInfo&); 626 void AdjustPositionedBlock(LayoutBox& child, const BlockChildrenLayoutInfo&); 627 void AdjustFloatingBlock(const MarginInfo&); 628 629 LayoutPoint ComputeLogicalLocationForFloat( 630 const FloatingObject&, 631 LayoutUnit logical_top_offset) const; 632 633 void RemoveFloatingObject(LayoutBox*); 634 void RemoveFloatingObjectsBelow(FloatingObject*, LayoutUnit logical_offset); 635 636 LayoutUnit GetClearDelta(LayoutBox* child, LayoutUnit y_pos); 637 638 bool HasOverhangingFloat(LayoutBox*); 639 void AddIntrudingFloats(LayoutBlockFlow* prev, 640 LayoutUnit xoffset, 641 LayoutUnit yoffset); 642 void AddOverhangingFloats(LayoutBlockFlow* child, 643 bool make_child_paint_other_floats); 644 645 bool HitTestFloats(HitTestResult&, 646 const HitTestLocation&, 647 const PhysicalOffset& accumulated_offset); 648 649 void ClearFloats(EClear); 650 651 LayoutUnit LogicalRightFloatOffsetForLine(LayoutUnit logical_top, 652 LayoutUnit fixed_offset, 653 LayoutUnit logical_height) const; 654 LayoutUnit LogicalLeftFloatOffsetForLine(LayoutUnit logical_top, 655 LayoutUnit fixed_offset, 656 LayoutUnit logical_height) const; 657 658 LayoutUnit LogicalLeftFloatOffsetForAvoidingFloats( 659 LayoutUnit logical_top, 660 LayoutUnit fixed_offset, 661 LayoutUnit logical_height) const; 662 LayoutUnit LogicalRightFloatOffsetForAvoidingFloats( 663 LayoutUnit logical_top, 664 LayoutUnit fixed_offset, 665 LayoutUnit logical_height) const; 666 667 LayoutUnit LogicalRightOffsetForPositioningFloat( 668 LayoutUnit logical_top, 669 LayoutUnit fixed_offset, 670 LayoutUnit* height_remaining) const; 671 LayoutUnit LogicalLeftOffsetForPositioningFloat( 672 LayoutUnit logical_top, 673 LayoutUnit fixed_offset, 674 LayoutUnit* height_remaining) const; 675 676 LayoutUnit AdjustLogicalRightOffsetForLine( 677 LayoutUnit offset_from_floats, 678 IndentTextOrNot apply_text_indent) const; 679 LayoutUnit AdjustLogicalLeftOffsetForLine( 680 LayoutUnit offset_from_floats, 681 IndentTextOrNot apply_text_indent) const; 682 683 virtual RootInlineBox* CreateRootInlineBox(); // Subclassed by SVG 684 685 void DirtyLinesFromChangedChild( 686 LayoutObject* child, 687 MarkingBehavior marking_behaviour = kMarkContainerChain) override { 688 NOT_DESTROYED(); 689 line_boxes_.DirtyLinesFromChangedChild( 690 LineLayoutItem(this), LineLayoutItem(child), 691 marking_behaviour == kMarkContainerChain); 692 } 693 694 void CreateOrDestroyMultiColumnFlowThreadIfNeeded( 695 const ComputedStyle* old_style); 696 697 // Merge children of |siblingThatMayBeDeleted| into this object if possible, 698 // and delete |siblingThatMayBeDeleted|. Returns true if we were able to 699 // merge. In that case, |siblingThatMayBeDeleted| will be dead. We'll only be 700 // able to merge if both blocks are anonymous. 701 bool MergeSiblingContiguousAnonymousBlock( 702 LayoutBlockFlow* sibling_that_may_be_deleted); 703 704 // Reparent subsequent or preceding adjacent floating or out-of-flow siblings 705 // into this object. 706 void ReparentSubsequentFloatingOrOutOfFlowSiblings(); 707 void ReparentPrecedingFloatingOrOutOfFlowSiblings(); 708 709 void MakeChildrenInlineIfPossible(); 710 711 void MakeChildrenNonInline(LayoutObject* insertion_point = nullptr); 712 void ChildBecameNonInline(LayoutObject* child) final; 713 714 void UpdateLogicalWidthForAlignment(const ETextAlign&, 715 const RootInlineBox*, 716 BidiRun* trailing_space_run, 717 LayoutUnit& logical_left, 718 LayoutUnit& total_logical_width, 719 LayoutUnit& available_logical_width, 720 unsigned expansion_opportunity_count); 721 ShouldBreakAtLineToAvoidWidow()722 bool ShouldBreakAtLineToAvoidWidow() const { 723 NOT_DESTROYED(); 724 return rare_data_ && rare_data_->line_break_to_avoid_widow_ >= 0; 725 } 726 void ClearShouldBreakAtLineToAvoidWidow() const; LineBreakToAvoidWidow()727 int LineBreakToAvoidWidow() const { 728 NOT_DESTROYED(); 729 return rare_data_ ? rare_data_->line_break_to_avoid_widow_ : -1; 730 } 731 void SetBreakAtLineToAvoidWidow(int); 732 void ClearDidBreakAtLineToAvoidWidow(); 733 void SetDidBreakAtLineToAvoidWidow(); DidBreakAtLineToAvoidWidow()734 bool DidBreakAtLineToAvoidWidow() const { 735 NOT_DESTROYED(); 736 return rare_data_ && rare_data_->did_break_at_line_to_avoid_widow_; 737 } 738 739 // Start page name propagated from the first child, if there are children, and 740 // the first child has a start page name associated with it. 741 const AtomicString PropagatedStartPageName() const; 742 void SetPropagatedStartPageName(const AtomicString&); 743 744 // End page name propagated from the last child, if there are children, and 745 // the last child has a end page name associated with it. 746 const AtomicString PropagatedEndPageName() const; 747 void SetPropagatedEndPageName(const AtomicString&); 748 749 public: 750 struct FloatWithRect { 751 DISALLOW_NEW(); FloatWithRectFloatWithRect752 FloatWithRect(LayoutBox* f) 753 : object(f), rect(f->FrameRect()), ever_had_layout(f->EverHadLayout()) { 754 rect.Expand(f->MarginBoxOutsets()); 755 } 756 757 LayoutBox* object; 758 LayoutRect rect; 759 bool ever_had_layout; 760 }; 761 762 // MarginValues holds the margins in the block direction 763 // used during collapsing margins computation. 764 // CSS mandates to keep track of both positive and negative margins: 765 // "When two or more margins collapse, the resulting margin width is the 766 // maximum of the collapsing margins' widths. In the case of negative 767 // margins, the maximum of the absolute values of the negative adjoining 768 // margins is deducted from the maximum of the positive adjoining margins. 769 // If there are no positive margins, the maximum of the absolute values of 770 // the adjoining margins is deducted from zero." 771 // https://drafts.csswg.org/css2/box.html#collapsing-margins 772 class MarginValues { 773 DISALLOW_NEW(); 774 775 public: MarginValues(LayoutUnit before_pos,LayoutUnit before_neg,LayoutUnit after_pos,LayoutUnit after_neg)776 MarginValues(LayoutUnit before_pos, 777 LayoutUnit before_neg, 778 LayoutUnit after_pos, 779 LayoutUnit after_neg) 780 : positive_margin_before_(before_pos), 781 negative_margin_before_(before_neg), 782 positive_margin_after_(after_pos), 783 negative_margin_after_(after_neg) {} 784 PositiveMarginBefore()785 LayoutUnit PositiveMarginBefore() const { return positive_margin_before_; } NegativeMarginBefore()786 LayoutUnit NegativeMarginBefore() const { return negative_margin_before_; } PositiveMarginAfter()787 LayoutUnit PositiveMarginAfter() const { return positive_margin_after_; } NegativeMarginAfter()788 LayoutUnit NegativeMarginAfter() const { return negative_margin_after_; } 789 SetPositiveMarginBefore(LayoutUnit pos)790 void SetPositiveMarginBefore(LayoutUnit pos) { 791 positive_margin_before_ = pos; 792 } SetNegativeMarginBefore(LayoutUnit neg)793 void SetNegativeMarginBefore(LayoutUnit neg) { 794 negative_margin_before_ = neg; 795 } SetPositiveMarginAfter(LayoutUnit pos)796 void SetPositiveMarginAfter(LayoutUnit pos) { 797 positive_margin_after_ = pos; 798 } SetNegativeMarginAfter(LayoutUnit neg)799 void SetNegativeMarginAfter(LayoutUnit neg) { 800 negative_margin_after_ = neg; 801 } 802 803 private: 804 LayoutUnit positive_margin_before_; 805 LayoutUnit negative_margin_before_; 806 LayoutUnit positive_margin_after_; 807 LayoutUnit negative_margin_after_; 808 }; 809 MarginValues MarginValuesForChild(LayoutBox& child) const; 810 811 // Allocated only when some of these fields have non-default values 812 struct LayoutBlockFlowRareData final 813 : public GarbageCollected<LayoutBlockFlowRareData> { 814 public: 815 explicit LayoutBlockFlowRareData(const LayoutBlockFlow* block); 816 LayoutBlockFlowRareData(const LayoutBlockFlowRareData&) = delete; 817 LayoutBlockFlowRareData& operator=(const LayoutBlockFlowRareData&) = delete; 818 ~LayoutBlockFlowRareData(); 819 PositiveMarginBeforeDefaultfinal820 static LayoutUnit PositiveMarginBeforeDefault( 821 const LayoutBlockFlow* block) { 822 return block->MarginBefore().ClampNegativeToZero(); 823 } NegativeMarginBeforeDefaultfinal824 static LayoutUnit NegativeMarginBeforeDefault( 825 const LayoutBlockFlow* block) { 826 return (-block->MarginBefore()).ClampNegativeToZero(); 827 } PositiveMarginAfterDefaultfinal828 static LayoutUnit PositiveMarginAfterDefault(const LayoutBlockFlow* block) { 829 return block->MarginAfter().ClampNegativeToZero(); 830 } NegativeMarginAfterDefaultfinal831 static LayoutUnit NegativeMarginAfterDefault(const LayoutBlockFlow* block) { 832 return (-block->MarginAfter()).ClampNegativeToZero(); 833 } 834 Tracefinal835 void Trace(Visitor*) const {} 836 837 MarginValues margins_; 838 LayoutUnit pagination_strut_propagated_from_child_; 839 840 LayoutUnit first_forced_break_offset_; 841 842 LayoutMultiColumnFlowThread* multi_column_flow_thread_ = nullptr; 843 844 // |offset_mapping_| is used only for legacy layout tree for caching offset 845 // mapping for |NGInlineNode::GetOffsetMapping()|. 846 // TODO(yosin): Once we have no legacy support, we should get rid of 847 // |offset_mapping_| here. 848 std::unique_ptr<NGOffsetMapping> offset_mapping_; 849 850 // Name of the start page for this object, if propagated from a descendant; 851 // see https://drafts.csswg.org/css-page-3/#start-page-value 852 AtomicString propagated_start_page_name_; 853 854 // Name of the end page for this object, if propagated from a descendant; 855 // see https://drafts.csswg.org/css-page-3/#end-page-value 856 AtomicString propagated_end_page_name_; 857 858 unsigned break_before_ : 4; 859 unsigned break_after_ : 4; 860 int line_break_to_avoid_widow_; 861 bool did_break_at_line_to_avoid_widow_ : 1; 862 }; 863 864 void ClearOffsetMappingIfNeeded(); 865 const NGOffsetMapping* GetOffsetMapping() const; 866 void SetOffsetMapping(std::unique_ptr<NGOffsetMapping>); 867 GetFloatingObjects()868 const FloatingObjects* GetFloatingObjects() const { 869 NOT_DESTROYED(); 870 return floating_objects_.get(); 871 } 872 873 static void UpdateAncestorShouldPaintFloatingObject( 874 const LayoutBox& float_box); 875 876 bool ShouldTruncateOverflowingText() const; 877 878 protected: MaxPositiveMarginBefore()879 LayoutUnit MaxPositiveMarginBefore() const { 880 NOT_DESTROYED(); 881 return rare_data_ 882 ? rare_data_->margins_.PositiveMarginBefore() 883 : LayoutBlockFlowRareData::PositiveMarginBeforeDefault(this); 884 } MaxNegativeMarginBefore()885 LayoutUnit MaxNegativeMarginBefore() const { 886 NOT_DESTROYED(); 887 return rare_data_ 888 ? rare_data_->margins_.NegativeMarginBefore() 889 : LayoutBlockFlowRareData::NegativeMarginBeforeDefault(this); 890 } MaxPositiveMarginAfter()891 LayoutUnit MaxPositiveMarginAfter() const { 892 NOT_DESTROYED(); 893 return rare_data_ 894 ? rare_data_->margins_.PositiveMarginAfter() 895 : LayoutBlockFlowRareData::PositiveMarginAfterDefault(this); 896 } MaxNegativeMarginAfter()897 LayoutUnit MaxNegativeMarginAfter() const { 898 NOT_DESTROYED(); 899 return rare_data_ 900 ? rare_data_->margins_.NegativeMarginAfter() 901 : LayoutBlockFlowRareData::NegativeMarginAfterDefault(this); 902 } 903 904 void SetMaxMarginBeforeValues(LayoutUnit pos, LayoutUnit neg); 905 void SetMaxMarginAfterValues(LayoutUnit pos, LayoutUnit neg); 906 InitMaxMarginValues()907 void InitMaxMarginValues() { 908 NOT_DESTROYED(); 909 if (rare_data_) { 910 rare_data_->margins_ = MarginValues( 911 LayoutBlockFlowRareData::PositiveMarginBeforeDefault(this), 912 LayoutBlockFlowRareData::NegativeMarginBeforeDefault(this), 913 LayoutBlockFlowRareData::PositiveMarginAfterDefault(this), 914 LayoutBlockFlowRareData::NegativeMarginAfterDefault(this)); 915 } 916 } 917 918 virtual ETextAlign TextAlignmentForLine(bool ends_with_soft_break) const; 919 920 private: CollapsedMarginBefore()921 LayoutUnit CollapsedMarginBefore() const final { 922 NOT_DESTROYED(); 923 return MaxPositiveMarginBefore() - MaxNegativeMarginBefore(); 924 } CollapsedMarginAfter()925 LayoutUnit CollapsedMarginAfter() const final { 926 NOT_DESTROYED(); 927 return MaxPositiveMarginAfter() - MaxNegativeMarginAfter(); 928 } 929 930 LayoutUnit AdjustedMarginBeforeForPagination( 931 const LayoutBox&, 932 LayoutUnit logical_top_margin_edge, 933 LayoutUnit logical_top_border_edge, 934 const BlockChildrenLayoutInfo&) const; 935 936 LayoutUnit CollapseMargins(LayoutBox& child, 937 BlockChildrenLayoutInfo&, 938 bool child_is_self_collapsing); 939 LayoutUnit ClearFloatsIfNeeded(LayoutBox& child, 940 MarginInfo&, 941 LayoutUnit old_top_pos_margin, 942 LayoutUnit old_top_neg_margin, 943 LayoutUnit y_pos, 944 bool child_is_self_collapsing); 945 LayoutUnit EstimateLogicalTopPosition( 946 LayoutBox& child, 947 const BlockChildrenLayoutInfo&, 948 LayoutUnit& estimate_without_pagination); 949 void MarginBeforeEstimateForChild(LayoutBox&, LayoutUnit&, LayoutUnit&) const; 950 void HandleAfterSideOfBlock(LayoutBox* last_child, 951 LayoutUnit top, 952 LayoutUnit bottom, 953 MarginInfo&); 954 void SetCollapsedBottomMargin(const MarginInfo&); 955 956 static void RecalcFloatingDescendantsVisualOverflow( 957 const NGPhysicalContainerFragment& fragment); 958 959 // Apply any forced fragmentainer break that's set on the current class A 960 // break point. 961 LayoutUnit ApplyForcedBreak(LayoutUnit logical_offset, EBreakBetween); 962 963 void SetBreakBefore(EBreakBetween); 964 void SetBreakAfter(EBreakBetween); 965 EBreakBetween BreakBefore() const override; 966 EBreakBetween BreakAfter() const override; 967 968 LayoutUnit AdjustBlockChildForPagination(LayoutUnit logical_top, 969 LayoutBox& child, 970 BlockChildrenLayoutInfo&, 971 bool at_before_side_of_block); 972 973 // If a float cannot fit in the current fragmentainer, return the logical top 974 // margin edge that the float needs to have in order to be pushed to the top 975 // of the next fragmentainer. Otherwise, just return |logicalTopMarginEdge|. 976 LayoutUnit AdjustFloatLogicalTopForPagination( 977 LayoutBox&, 978 LayoutUnit logical_top_margin_edge); 979 980 // Computes a deltaOffset value that put a line at the top of the next page if 981 // it doesn't fit on the current page. 982 void AdjustLinePositionForPagination(RootInlineBox&, 983 LayoutUnit& delta_offset); 984 985 // If the child is unsplittable and can't fit on the current page, return the 986 // top of the next page/column. 987 LayoutUnit AdjustForUnsplittableChild(LayoutBox&, 988 LayoutUnit logical_offset) const; 989 990 // Used to store state between styleWillChange and styleDidChange 991 static bool can_propagate_float_into_sibling_; 992 993 LineBoxList line_boxes_; // All of the root line boxes created for this block 994 // flow. For example, <div>Hello<br>world.</div> 995 // will have two total lines for the <div>. 996 997 LayoutBlockFlowRareData& EnsureRareData(); 998 999 bool IsSelfCollapsingBlock() const override; 1000 bool CheckIfIsSelfCollapsingBlock() const; 1001 1002 protected: 1003 Persistent<LayoutBlockFlowRareData> rare_data_; 1004 std::unique_ptr<FloatingObjects> floating_objects_; 1005 1006 friend class MarginInfo; 1007 friend class LineWidth; // needs to know FloatingObject 1008 1009 // LayoutRubyBase objects need to be able to split and merge, moving their 1010 // children around (calling makeChildrenNonInline). 1011 // TODO(mstensho): Try to get rid of this friendship. 1012 friend class LayoutRubyBase; 1013 1014 // FIXME-BLOCKFLOW: These methods have implementations in 1015 // LayoutBlockFlowLine. They should be moved to the proper header once the 1016 // line layout code is separated from LayoutBlock and LayoutBlockFlow. 1017 // START METHODS DEFINED IN LayoutBlockFlowLine 1018 private: 1019 InlineFlowBox* CreateLineBoxes(LineLayoutItem, 1020 const LineInfo&, 1021 InlineBox* child_box); 1022 void SetMarginsForRubyRun(BidiRun*, 1023 LayoutRubyRun*, 1024 LayoutObject*, 1025 const LineInfo&); 1026 void ComputeInlineDirectionPositionsForLine(RootInlineBox*, 1027 const LineInfo&, 1028 BidiRun* first_run, 1029 BidiRun* trailing_space_run, 1030 bool reached_end, 1031 GlyphOverflowAndFallbackFontsMap&, 1032 VerticalPositionCache&, 1033 const WordMeasurements&); 1034 BidiRun* ComputeInlineDirectionPositionsForSegment( 1035 RootInlineBox*, 1036 const LineInfo&, 1037 LayoutUnit& logical_left, 1038 LayoutUnit& available_logical_width, 1039 BidiRun* first_run, 1040 BidiRun* trailing_space_run, 1041 GlyphOverflowAndFallbackFontsMap& text_box_data_map, 1042 VerticalPositionCache&, 1043 const WordMeasurements&); 1044 void ComputeBlockDirectionPositionsForLine(RootInlineBox*, 1045 BidiRun*, 1046 GlyphOverflowAndFallbackFontsMap&, 1047 VerticalPositionCache&); 1048 void AppendFloatingObjectToLastLine(FloatingObject&); 1049 void AppendFloatsToLastLine(LineLayoutState&, 1050 const InlineIterator& clean_line_start, 1051 const InlineBidiResolver&, 1052 const BidiStatus& clean_line_bidi_status); 1053 // Helper function for layoutInlineChildren() 1054 RootInlineBox* CreateLineBoxesFromBidiRuns(unsigned bidi_level, 1055 BidiRunList<BidiRun>&, 1056 const InlineIterator& end, 1057 LineInfo&, 1058 VerticalPositionCache&, 1059 BidiRun* trailing_space_run, 1060 const WordMeasurements&); 1061 void LayoutRunsAndFloats(LineLayoutState&); 1062 const InlineIterator& RestartLayoutRunsAndFloatsInRange( 1063 LayoutUnit old_logical_height, 1064 LayoutUnit new_logical_height, 1065 FloatingObject* last_float_from_previous_line, 1066 InlineBidiResolver&, 1067 const InlineIterator&); 1068 void LayoutRunsAndFloatsInRange(LineLayoutState&, 1069 InlineBidiResolver&, 1070 const InlineIterator& clean_line_start, 1071 const BidiStatus& clean_line_bidi_status); 1072 void LinkToEndLineIfNeeded(LineLayoutState&); 1073 void MarkDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& floats); 1074 RootInlineBox* DetermineStartPosition(LineLayoutState&, InlineBidiResolver&); 1075 void DetermineEndPosition(LineLayoutState&, 1076 RootInlineBox* start_box, 1077 InlineIterator& clean_line_start, 1078 BidiStatus& clean_line_bidi_status); 1079 bool LineBoxHasBRWithClearance(RootInlineBox*); 1080 bool CheckPaginationAndFloatsAtEndLine(LineLayoutState&); 1081 bool MatchedEndLine(LineLayoutState&, 1082 const InlineBidiResolver&, 1083 const InlineIterator& end_line_start, 1084 const BidiStatus& end_line_status); 1085 void DeleteEllipsisLineBoxes(); 1086 void CheckLinesForTextOverflow(); 1087 void TryPlacingEllipsisOnAtomicInlines(RootInlineBox*, 1088 LayoutUnit block_right_edge, 1089 LayoutUnit block_left_edge, 1090 LayoutUnit width, 1091 const AtomicString&, 1092 InlineBox*); 1093 void ClearTruncationOnAtomicInlines(RootInlineBox*); 1094 void MarkLinesDirtyInBlockRange(LayoutUnit logical_top, 1095 LayoutUnit logical_bottom, 1096 RootInlineBox* highest = nullptr); 1097 1098 // END METHODS DEFINED IN LayoutBlockFlowLine 1099 }; 1100 1101 template <> 1102 struct DowncastTraits<LayoutBlockFlow> { 1103 static bool AllowFrom(const LayoutObject& object) { 1104 return object.IsLayoutBlockFlow(); 1105 } 1106 }; 1107 1108 } // namespace blink 1109 1110 #endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_LAYOUT_BLOCK_FLOW_H_ 1111