diff options
Diffstat (limited to 'Source/WebCore/rendering/line/LineInlineHeaders.h')
-rw-r--r-- | Source/WebCore/rendering/line/LineInlineHeaders.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/WebCore/rendering/line/LineInlineHeaders.h b/Source/WebCore/rendering/line/LineInlineHeaders.h index 0b0c44e6e..db7ad2e83 100644 --- a/Source/WebCore/rendering/line/LineInlineHeaders.h +++ b/Source/WebCore/rendering/line/LineInlineHeaders.h @@ -22,8 +22,7 @@ * */ -#ifndef LineInlineHeaders_h -#define LineInlineHeaders_h +#pragma once #include "RenderLayer.h" @@ -43,7 +42,7 @@ inline bool hasInlineDirectionBordersPaddingOrMargin(const RenderInline& flow) return shouldApplyEndBorderPaddingOrMargin && (flow.borderEnd() || flow.marginEnd() || flow.paddingEnd()); } -inline const RenderStyle& lineStyle(const RenderElement& renderer, const LineInfo& lineInfo) +inline const RenderStyle& lineStyle(const RenderObject& renderer, const LineInfo& lineInfo) { return lineInfo.isFirstLine() ? renderer.firstLineStyle() : renderer.style(); } @@ -56,7 +55,7 @@ inline bool requiresLineBoxForContent(const RenderInline& flow, const LineInfo& const RenderStyle& parentStyle = lineStyle(*parent, lineInfo); if (flowStyle.lineHeight() != parentStyle.lineHeight() || flowStyle.verticalAlign() != parentStyle.verticalAlign() - || !parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(flowStyle.font().fontMetrics())) + || !parentStyle.fontCascade().fontMetrics().hasIdenticalAscentDescentAndLineGap(flowStyle.fontCascade().fontMetrics())) return true; } return false; @@ -105,8 +104,8 @@ inline bool requiresLineBox(const InlineIterator& it, const LineInfo& lineInfo = return true; bool rendererIsEmptyInline = false; - if (it.renderer()->isRenderInline()) { - const RenderInline& inlineRenderer = toRenderInline(*it.renderer()); + if (is<RenderInline>(*it.renderer())) { + const auto& inlineRenderer = downcast<RenderInline>(*it.renderer()); if (!alwaysRequiresLineBox(inlineRenderer) && !requiresLineBoxForContent(inlineRenderer, lineInfo)) return false; rendererIsEmptyInline = isEmptyInline(inlineRenderer); @@ -120,23 +119,21 @@ inline bool requiresLineBox(const InlineIterator& it, const LineInfo& lineInfo = return notJustWhitespace || rendererIsEmptyInline; } -inline void setStaticPositions(RenderBlockFlow& block, RenderBox& child) +inline void setStaticPositions(RenderBlockFlow& block, RenderBox& child, IndentTextOrNot shouldIndentText) { // FIXME: The math here is actually not really right. It's a best-guess approximation that // will work for the common cases RenderElement* containerBlock = child.container(); LayoutUnit blockHeight = block.logicalHeight(); - if (containerBlock->isRenderInline()) { + if (is<RenderInline>(*containerBlock)) { // A relative positioned inline encloses us. In this case, we also have to determine our // position as though we were an inline. Set |staticInlinePosition| and |staticBlockPosition| on the relative positioned // inline so that we can obtain the value later. - toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, false)); - toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHeight); + downcast<RenderInline>(*containerBlock).layer()->setStaticInlinePosition(block.startAlignedOffsetForLine(blockHeight, DoNotIndentText)); + downcast<RenderInline>(*containerBlock).layer()->setStaticBlockPosition(blockHeight); } - block.updateStaticInlinePositionForChild(child, blockHeight); + block.updateStaticInlinePositionForChild(child, blockHeight, shouldIndentText); child.layer()->setStaticBlockPosition(blockHeight); } -} - -#endif +} // namespace WebCore |