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, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
27 #include "RenderBox.h"
30 #include <wtf/ListHashSet.h>
35 class LineLayoutState;
36 class LogicalSelectionOffsetCaches;
43 typedef WTF::ListHashSet<RenderBox*> TrackedRendererListHashSet;
44 typedef WTF::HashMap<const RenderBlock*, std::unique_ptr<TrackedRendererListHashSet>> TrackedDescendantsMap;
45 typedef WTF::HashMap<const RenderBox*, std::unique_ptr<HashSet<RenderBlock*>>> TrackedContainerMap;
47 enum CaretType { CursorCaret, DragCaret };
48 enum ContainingBlockState { NewContainingBlock, SameContainingBlock };
51 DefaultTextRunFlags = 0,
52 RespectDirection = 1 << 0,
53 RespectDirectionOverride = 1 << 1
56 typedef unsigned TextRunFlags;
58 class RenderBlock : public RenderBox {
60 friend class LineLayoutState;
63 RenderBlock(Element&, Ref<RenderStyle>&&, unsigned baseTypeFlags);
64 RenderBlock(Document&, Ref<RenderStyle>&&, unsigned baseTypeFlags);
65 virtual ~RenderBlock();
68 // These two functions are overridden for inline-block.
69 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override final;
70 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
72 LayoutUnit minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const;
74 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
75 virtual void deleteLines();
77 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
78 virtual void removeChild(RenderObject&) override;
80 virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0);
82 virtual void invalidateLineLayoutPath() { }
84 void insertPositionedObject(RenderBox&);
85 static void removePositionedObject(RenderBox&);
86 void removePositionedObjects(RenderBlock*, ContainingBlockState = SameContainingBlock);
88 TrackedRendererListHashSet* positionedObjects() const;
89 bool hasPositionedObjects() const
91 TrackedRendererListHashSet* objects = positionedObjects();
92 return objects && !objects->isEmpty();
95 void addPercentHeightDescendant(RenderBox&);
96 static void removePercentHeightDescendant(RenderBox&);
97 TrackedRendererListHashSet* percentHeightDescendants() const;
98 static bool hasPercentHeightContainerMap();
99 static bool hasPercentHeightDescendant(RenderBox&);
100 static void clearPercentHeightDescendantsFrom(RenderBox&);
101 static void removePercentHeightDescendantIfNeeded(RenderBox&);
103 void setHasMarginBeforeQuirk(bool b) { setRenderBlockHasMarginBeforeQuirk(b); }
104 void setHasMarginAfterQuirk(bool b) { setRenderBlockHasMarginAfterQuirk(b); }
105 void setHasBorderOrPaddingLogicalWidthChanged(bool b) { setRenderBlockHasBorderOrPaddingLogicalWidthChanged(b); }
107 bool hasMarginBeforeQuirk() const { return renderBlockHasMarginBeforeQuirk(); }
108 bool hasMarginAfterQuirk() const { return renderBlockHasMarginAfterQuirk(); }
109 bool hasBorderOrPaddingLogicalWidthChanged() const { return renderBlockHasBorderOrPaddingLogicalWidthChanged(); }
111 bool hasMarginBeforeQuirk(const RenderBox& child) const;
112 bool hasMarginAfterQuirk(const RenderBox& child) const;
114 bool generatesLineBoxesForInlineChild(RenderObject*);
116 void markPositionedObjectsForLayout();
117 virtual void markForPaginationRelayoutIfNeeded() override;
119 // FIXME-BLOCKFLOW: Remove virtualizaion when all of the line layout code has been moved out of RenderBlock
120 virtual bool containsFloats() const { return false; }
122 // Versions that can compute line offsets with the region and page offset passed in. Used for speed to avoid having to
123 // compute the region all over again when you already know it.
124 LayoutUnit availableLogicalWidthForLineInRegion(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const
126 return std::max<LayoutUnit>(0, logicalRightOffsetForLineInRegion(position, shouldIndentText, region, logicalHeight)
127 - logicalLeftOffsetForLineInRegion(position, shouldIndentText, region, logicalHeight));
129 LayoutUnit logicalRightOffsetForLineInRegion(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const
131 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(region), shouldIndentText, logicalHeight);
133 LayoutUnit logicalLeftOffsetForLineInRegion(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const
135 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(region), shouldIndentText, logicalHeight);
137 LayoutUnit startOffsetForLineInRegion(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const
139 return style().isLeftToRightDirection() ? logicalLeftOffsetForLineInRegion(position, shouldIndentText, region, logicalHeight)
140 : logicalWidth() - logicalRightOffsetForLineInRegion(position, shouldIndentText, region, logicalHeight);
142 LayoutUnit endOffsetForLineInRegion(LayoutUnit position, bool shouldIndentText, RenderRegion* region, LayoutUnit logicalHeight = 0) const
144 return !style().isLeftToRightDirection() ? logicalLeftOffsetForLineInRegion(position, shouldIndentText, region, logicalHeight)
145 : logicalWidth() - logicalRightOffsetForLineInRegion(position, shouldIndentText, region, logicalHeight);
148 LayoutUnit availableLogicalWidthForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
150 return availableLogicalWidthForLineInRegion(position, shouldIndentText, regionAtBlockOffset(position), logicalHeight);
152 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
154 return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), shouldIndentText, logicalHeight);
156 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
158 return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), shouldIndentText, logicalHeight);
160 LayoutUnit startOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
162 return style().isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight)
163 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
165 LayoutUnit endOffsetForLine(LayoutUnit position, bool shouldIndentText, LayoutUnit logicalHeight = 0) const
167 return !style().isLeftToRightDirection() ? logicalLeftOffsetForLine(position, shouldIndentText, logicalHeight)
168 : logicalWidth() - logicalRightOffsetForLine(position, shouldIndentText, logicalHeight);
171 LayoutUnit textIndentOffset() const;
173 virtual VisiblePosition positionForPoint(const LayoutPoint&, const RenderRegion*) override;
175 GapRects selectionGapRectsForRepaint(const RenderLayerModelObject* repaintContainer);
176 LayoutRect logicalLeftSelectionGap(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
177 RenderBoxModelObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const LogicalSelectionOffsetCaches&, const PaintInfo*);
178 LayoutRect logicalRightSelectionGap(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
179 RenderBoxModelObject* selObj, LayoutUnit logicalRight, LayoutUnit logicalTop, LayoutUnit logicalHeight, const LogicalSelectionOffsetCaches&, const PaintInfo*);
180 void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
181 RenderBlock* blockBeforeWithinSelectionRoot(LayoutSize& offset) const;
183 LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, const LayoutRect& logicalRect);
185 void addContinuationWithOutline(RenderInline*);
186 bool paintsContinuationOutline(RenderInline*);
188 virtual RenderBoxModelObject* virtualContinuation() const override final { return continuation(); }
189 bool isAnonymousBlockContinuation() const { return isAnonymousBlock() && continuation(); }
190 WEBCORE_EXPORT RenderInline* inlineElementContinuation() const;
191 RenderBlock* blockElementContinuation() const;
193 using RenderBoxModelObject::continuation;
194 using RenderBoxModelObject::setContinuation;
196 static RenderBlock* createAnonymousWithParentRendererAndDisplay(const RenderObject*, EDisplay = BLOCK);
197 RenderBlock* createAnonymousBlock(EDisplay display = BLOCK) const { return createAnonymousWithParentRendererAndDisplay(this, display); }
198 static void collapseAnonymousBoxChild(RenderBlock& parent, RenderBlock* child);
200 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* parent) const override;
202 static bool shouldSkipCreatingRunsForObject(RenderObject& obj)
204 return obj.isFloating() || (obj.isOutOfFlowPositioned() && !obj.style().isOriginalDisplayInlineType() && !obj.container()->isRenderInline());
207 static TextRun constructTextRun(RenderObject* context, const FontCascade&, StringView, const RenderStyle&,
208 ExpansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextRunFlags = DefaultTextRunFlags);
209 static TextRun constructTextRun(RenderObject* context, const FontCascade&, const String&, const RenderStyle&,
210 ExpansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion, TextRunFlags = DefaultTextRunFlags);
211 static TextRun constructTextRun(RenderObject* context, const FontCascade&, const RenderText*, const RenderStyle&,
212 ExpansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion);
213 static TextRun constructTextRun(RenderObject* context, const FontCascade&, const RenderText*, unsigned offset, unsigned length, const RenderStyle&,
214 ExpansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion);
215 static TextRun constructTextRun(RenderObject* context, const FontCascade&, const LChar* characters, int length, const RenderStyle&,
216 ExpansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion);
217 static TextRun constructTextRun(RenderObject* context, const FontCascade&, const UChar* characters, int length, const RenderStyle&,
218 ExpansionBehavior = AllowTrailingExpansion | ForbidLeadingExpansion);
220 LayoutUnit paginationStrut() const;
221 void setPaginationStrut(LayoutUnit);
223 // The page logical offset is the object's offset from the top of the page in the page progression
224 // direction (so an x-offset in vertical text and a y-offset for horizontal text).
225 LayoutUnit pageLogicalOffset() const;
226 void setPageLogicalOffset(LayoutUnit);
228 // Accessors for logical width/height and margins in the containing block's block-flow direction.
229 enum ApplyLayoutDeltaMode { ApplyLayoutDelta, DoNotApplyLayoutDelta };
230 LayoutUnit logicalWidthForChild(const RenderBox& child) const { return isHorizontalWritingMode() ? child.width() : child.height(); }
231 LayoutUnit logicalHeightForChild(const RenderBox& child) const { return isHorizontalWritingMode() ? child.height() : child.width(); }
232 LayoutSize logicalSizeForChild(const RenderBox& child) const { return isHorizontalWritingMode() ? child.size() : child.size().transposedSize(); }
233 LayoutUnit logicalTopForChild(const RenderBox& child) const { return isHorizontalWritingMode() ? child.y() : child.x(); }
234 void setLogicalLeftForChild(RenderBox& child, LayoutUnit logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
235 void setLogicalTopForChild(RenderBox& child, LayoutUnit logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
236 LayoutUnit marginBeforeForChild(const RenderBoxModelObject& child) const { return child.marginBefore(&style()); }
237 LayoutUnit marginAfterForChild(const RenderBoxModelObject& child) const { return child.marginAfter(&style()); }
238 LayoutUnit marginStartForChild(const RenderBoxModelObject& child) const { return child.marginStart(&style()); }
239 LayoutUnit marginEndForChild(const RenderBoxModelObject& child) const { return child.marginEnd(&style()); }
240 void setMarginStartForChild(RenderBox& child, LayoutUnit value) const { child.setMarginStart(value, &style()); }
241 void setMarginEndForChild(RenderBox& child, LayoutUnit value) const { child.setMarginEnd(value, &style()); }
242 void setMarginBeforeForChild(RenderBox& child, LayoutUnit value) const { child.setMarginBefore(value, &style()); }
243 void setMarginAfterForChild(RenderBox& child, LayoutUnit value) const { child.setMarginAfter(value, &style()); }
244 LayoutUnit collapsedMarginBeforeForChild(const RenderBox& child) const;
245 LayoutUnit collapsedMarginAfterForChild(const RenderBox& child) const;
247 virtual void updateFirstLetter();
248 void getFirstLetter(RenderObject*& firstLetter, RenderElement*& firstLetterContainer, RenderObject* skipObject = nullptr);
250 virtual void scrollbarsChanged(bool /*horizontalScrollbarChanged*/, bool /*verticalScrollbarChanged*/) { }
252 LayoutUnit logicalLeftOffsetForContent(RenderRegion*) const;
253 LayoutUnit logicalRightOffsetForContent(RenderRegion*) const;
254 LayoutUnit availableLogicalWidthForContent(RenderRegion* region) const
256 return std::max<LayoutUnit>(0, logicalRightOffsetForContent(region) - logicalLeftOffsetForContent(region));
258 LayoutUnit startOffsetForContent(RenderRegion* region) const
260 return style().isLeftToRightDirection() ? logicalLeftOffsetForContent(region) : logicalWidth() - logicalRightOffsetForContent(region);
262 LayoutUnit endOffsetForContent(RenderRegion* region) const
264 return !style().isLeftToRightDirection() ? logicalLeftOffsetForContent(region) : logicalWidth() - logicalRightOffsetForContent(region);
266 LayoutUnit logicalLeftOffsetForContent(LayoutUnit blockOffset) const
268 return logicalLeftOffsetForContent(regionAtBlockOffset(blockOffset));
270 LayoutUnit logicalRightOffsetForContent(LayoutUnit blockOffset) const
272 return logicalRightOffsetForContent(regionAtBlockOffset(blockOffset));
274 LayoutUnit availableLogicalWidthForContent(LayoutUnit blockOffset) const
276 return availableLogicalWidthForContent(regionAtBlockOffset(blockOffset));
278 LayoutUnit startOffsetForContent(LayoutUnit blockOffset) const
280 return startOffsetForContent(regionAtBlockOffset(blockOffset));
282 LayoutUnit endOffsetForContent(LayoutUnit blockOffset) const
284 return endOffsetForContent(regionAtBlockOffset(blockOffset));
286 LayoutUnit logicalLeftOffsetForContent() const { return isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); }
287 LayoutUnit logicalRightOffsetForContent() const { return logicalLeftOffsetForContent() + availableLogicalWidth(); }
288 LayoutUnit startOffsetForContent() const { return style().isLeftToRightDirection() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForContent(); }
289 LayoutUnit endOffsetForContent() const { return !style().isLeftToRightDirection() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForContent(); }
291 LayoutUnit logicalLeftSelectionOffset(RenderBlock& rootBlock, LayoutUnit position, const LogicalSelectionOffsetCaches&);
292 LayoutUnit logicalRightSelectionOffset(RenderBlock& rootBlock, LayoutUnit position, const LogicalSelectionOffsetCaches&);
294 LayoutUnit computeStartPositionDeltaForChildAvoidingFloats(const RenderBox& child, LayoutUnit childMarginStart, RenderRegion* = 0);
297 void checkPositionedObjectsNeedLayout();
300 virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) override;
302 virtual bool canHaveChildren() const override { return true; }
303 virtual bool canCollapseAnonymousBlockChild() const { return true; }
305 RenderFlowThread* cachedFlowThreadContainingBlock() const;
306 void setCachedFlowThreadContainingBlockNeedsUpdate();
307 virtual bool cachedFlowThreadContainingBlockNeedsUpdate() const;
310 virtual RenderFlowThread* locateFlowThreadContainingBlock() const override;
311 virtual void willBeDestroyed() override;
313 virtual void layout() override;
315 void layoutPositionedObjects(bool relayoutChildren, bool fixedPositionObjectsOnly = false);
316 void markFixedPositionObjectForLayoutIfNeeded(RenderObject& child);
318 LayoutUnit marginIntrinsicLogicalWidthForChild(RenderBox&) const;
320 virtual void paint(PaintInfo&, const LayoutPoint&) override;
321 virtual void paintObject(PaintInfo&, const LayoutPoint&) override;
322 virtual void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect);
323 enum PaintBlockType { PaintAsBlock, PaintAsInlineBlock };
324 bool paintChild(RenderBox&, PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect, PaintBlockType paintType = PaintAsBlock);
326 LayoutUnit logicalRightOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const
328 return adjustLogicalRightOffsetForLine(logicalRightFloatOffsetForLine(logicalTop, fixedOffset, logicalHeight), applyTextIndent);
330 LayoutUnit logicalLeftOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit logicalHeight = 0) const
332 return adjustLogicalLeftOffsetForLine(logicalLeftFloatOffsetForLine(logicalTop, fixedOffset, logicalHeight), applyTextIndent);
335 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
337 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
338 virtual void computePreferredLogicalWidths() override;
340 virtual Optional<int> firstLineBaseline() const override;
341 virtual Optional<int> inlineBlockBaseline(LineDirectionMode) const override;
343 // Delay updating scrollbars until endAndCommitUpdateScrollInfoAfterLayoutTransaction() is called. These functions are used
344 // when a flexbox is laying out its descendants. If multiple calls are made to beginUpdateScrollInfoAfterLayoutTransaction()
345 // then endAndCommitUpdateScrollInfoAfterLayoutTransaction() will do nothing until it is called the same number of times.
346 void beginUpdateScrollInfoAfterLayoutTransaction();
347 void endAndCommitUpdateScrollInfoAfterLayoutTransaction();
349 void removeFromUpdateScrollInfoAfterLayoutTransaction();
351 void updateScrollInfoAfterLayout();
353 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
354 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
356 virtual bool hasLineIfEmpty() const;
358 bool simplifiedLayout();
359 virtual void simplifiedNormalFlowLayout();
361 bool childBoxIsUnsplittableForFragmentation(const RenderBox& child) const;
364 virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false);
365 void clearLayoutOverflow();
367 // Adjust from painting offsets to the local coords of this renderer
368 void offsetForContents(LayoutPoint&) const;
369 // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
371 virtual RenderBlock* firstLineBlock() const override;
374 virtual void addOverflowFromChildren();
375 // FIXME-BLOCKFLOW: Remove virtualization when all callers have moved to RenderBlockFlow
376 virtual void addOverflowFromInlineChildren() { }
377 void addOverflowFromBlockChildren();
378 void addOverflowFromPositionedObjects();
379 void addVisualOverflowFromTheme();
381 virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer = 0) override;
382 virtual void addFocusRingRectsForInlineChildren(Vector<IntRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer);
384 void computeRegionRangeForBoxChild(const RenderBox&) const;
386 void estimateRegionRangeForBoxChild(const RenderBox&) const;
387 bool updateRegionRangeForBoxChild(const RenderBox&) const;
389 void updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, RenderBox&);
391 void preparePaginationBeforeBlockLayout(bool&);
394 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
395 virtual LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit, LayoutUnit fixedOffset, LayoutUnit) const { return fixedOffset; };
396 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
397 virtual LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit, LayoutUnit fixedOffset, LayoutUnit) const { return fixedOffset; }
398 LayoutUnit adjustLogicalRightOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
399 LayoutUnit adjustLogicalLeftOffsetForLine(LayoutUnit offsetFromFloats, bool applyTextIndent) const;
401 virtual const char* renderName() const override;
403 virtual bool isInlineBlockOrInlineTable() const override final { return isInline() && isReplaced(); }
405 void makeChildrenNonInline(RenderObject* insertionPoint = nullptr);
406 virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
408 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
409 virtual void moveAllChildrenIncludingFloatsTo(RenderBlock& toBlock, bool fullRemoveInsert) { moveAllChildrenTo(&toBlock, fullRemoveInsert); }
411 void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild);
412 virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild) override;
414 virtual bool isSelfCollapsingBlock() const override final;
415 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
416 virtual bool hasLines() const { return false; }
418 void insertIntoTrackedRendererMaps(RenderBox& descendant, TrackedDescendantsMap*&, TrackedContainerMap*&);
419 static void removeFromTrackedRendererMaps(RenderBox& descendant, TrackedDescendantsMap*&, TrackedContainerMap*&);
421 void createFirstLetterRenderer(RenderElement* firstLetterBlock, RenderText* currentTextChild);
422 void updateFirstLetterStyle(RenderElement* firstLetterBlock, RenderObject* firstLetterContainer);
424 Node* nodeForHitTest() const;
426 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
427 virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool) { }
428 virtual void paintInlineChildren(PaintInfo&, const LayoutPoint&) { }
429 void paintContents(PaintInfo&, const LayoutPoint&);
430 virtual void paintColumnRules(PaintInfo&, const LayoutPoint&) { };
431 void paintSelection(PaintInfo&, const LayoutPoint&);
432 void paintCaret(PaintInfo&, const LayoutPoint&, CaretType);
434 virtual bool avoidsFloats() const override;
436 virtual bool hitTestContents(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
437 // FIXME-BLOCKFLOW: Remove virtualization when all callers have moved to RenderBlockFlow
438 virtual bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&) { return false; }
439 virtual bool hitTestInlineChildren(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) { return false; }
441 virtual bool isPointInOverflowControl(HitTestResult&, const LayoutPoint& locationInContainer, const LayoutPoint& accumulatedOffset);
443 void computeBlockPreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
445 virtual LayoutRect rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const override final;
446 virtual const RenderStyle& outlineStyleForRepaint() const override final;
448 virtual RenderElement* hoverAncestor() const override final;
449 virtual void updateDragState(bool dragOn) override final;
450 virtual void childBecameNonInline(RenderElement&) override final;
452 virtual LayoutRect selectionRectForRepaint(const RenderLayerModelObject* repaintContainer, bool /*clipToVisibleContent*/) override final
454 return selectionGapRectsForRepaint(repaintContainer);
456 virtual bool shouldPaintSelectionGaps() const override final;
457 bool isSelectionRoot() const;
458 GapRects selectionGaps(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
459 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const LogicalSelectionOffsetCaches&, const PaintInfo* = 0);
460 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
461 virtual GapRects inlineSelectionGaps(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
462 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const LogicalSelectionOffsetCaches&, const PaintInfo*);
463 GapRects blockSelectionGaps(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
464 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const LogicalSelectionOffsetCaches&, const PaintInfo*);
465 LayoutRect blockSelectionGap(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
466 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const LogicalSelectionOffsetCaches&, const PaintInfo*);
468 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
469 virtual void clipOutFloatingObjects(RenderBlock&, const PaintInfo*, const LayoutPoint&, const LayoutSize&) { };
470 friend class LogicalSelectionOffsetCaches;
472 virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
473 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
475 void paintContinuationOutlines(PaintInfo&, const LayoutPoint&);
477 virtual LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = 0) override final;
479 // FIXME-BLOCKFLOW: Remove virtualizaion when all callers have moved to RenderBlockFlow
480 virtual VisiblePosition positionForPointWithInlineChildren(const LayoutPoint&, const RenderRegion*);
482 RenderPtr<RenderBlock> clone() const;
483 RenderBlock* continuationBefore(RenderObject* beforeChild);
485 RenderFlowThread* updateCachedFlowThreadContainingBlock(RenderFlowThread*) const;
488 bool hasRareData() const;
491 void dirtyForLayoutFromPercentageHeightDescendants();
494 bool recomputeLogicalWidth();
497 virtual LayoutUnit offsetFromLogicalTopOfFirstPage() const override;
498 RenderRegion* regionAtBlockOffset(LayoutUnit) const;
500 // FIXME: This is temporary to allow us to move code from RenderBlock into RenderBlockFlow that accesses member variables that we haven't moved out of
502 friend class RenderBlockFlow;
503 // FIXME-BLOCKFLOW: Remove this when the line layout stuff has all moved out of RenderBlock
504 friend class LineBreaker;
506 // RenderRubyBase objects need to be able to split and merge, moving their children around
507 // (calling moveChildTo, moveAllChildrenTo, and makeChildrenNonInline).
508 friend class RenderRubyBase;
511 // Used to store state between styleWillChange and styleDidChange
512 static bool s_canPropagateFloatIntoSibling;
515 LayoutUnit blockDirectionOffset(RenderBlock& rootBlock, const LayoutSize& offsetFromRootBlock);
516 LayoutUnit inlineDirectionOffset(RenderBlock& rootBlock, const LayoutSize& offsetFromRootBlock);
517 VisiblePosition positionForPointRespectingEditingBoundaries(RenderBlock&, RenderBox&, const LayoutPoint&);
519 } // namespace WebCore
521 SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBlock, isRenderBlock())
523 #endif // RenderBlock_h