https://bugs.webkit.org/show_bug.cgi?id=121575
Reviewed by David Hyatt.
In bug #121107 (r155565), I moved logicalHeightForLine into LineWidth.h as part of LineWidth
refactoring. LogicalHeightForLine without passing the second parameter uses RenderBlock::lineHeight
anyway, except it doesn't take -line-box-contain CSS property into account. For Shapes we don't
have implementation for variable-height lines (https://bugs.webkit.org/show_bug.cgi?id=95361) yet, so
so I modified the affected functions to call lineHeight directly. I renamed logicalHeightForLine
to minLineHeightForReplacedRenderer, and I made the second parameter a mandatory for that function.
No new tests, no behavior change.
* rendering/LineWidth.cpp:
(WebCore::LineWidth::updateAvailableWidth):
(WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):
* rendering/LineWidth.h:
* rendering/RenderBlock.cpp: Move the definition here.
(WebCore::RenderBlock::minLineHeightForReplacedRenderer):
* rendering/RenderBlock.h: Move the function here and rename it.
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutShapeInsideInfo):
(WebCore::updateLogicalInlinePositions):
(WebCore::updateSegmentsForShapes):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156197
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2013-09-20 Zoltan Horvath <zoltan@webkit.org>
+
+ Move logicalHeightForLine out of LineWidth.h
+ https://bugs.webkit.org/show_bug.cgi?id=121575
+
+ Reviewed by David Hyatt.
+
+ In bug #121107 (r155565), I moved logicalHeightForLine into LineWidth.h as part of LineWidth
+ refactoring. LogicalHeightForLine without passing the second parameter uses RenderBlock::lineHeight
+ anyway, except it doesn't take -line-box-contain CSS property into account. For Shapes we don't
+ have implementation for variable-height lines (https://bugs.webkit.org/show_bug.cgi?id=95361) yet, so
+ so I modified the affected functions to call lineHeight directly. I renamed logicalHeightForLine
+ to minLineHeightForReplacedRenderer, and I made the second parameter a mandatory for that function.
+
+ No new tests, no behavior change.
+
+ * rendering/LineWidth.cpp:
+ (WebCore::LineWidth::updateAvailableWidth):
+ (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded):
+ * rendering/LineWidth.h:
+ * rendering/RenderBlock.cpp: Move the definition here.
+ (WebCore::RenderBlock::minLineHeightForReplacedRenderer):
+ * rendering/RenderBlock.h: Move the function here and rename it.
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlock::layoutShapeInsideInfo):
+ (WebCore::updateLogicalInlinePositions):
+ (WebCore::updateSegmentsForShapes):
+
2013-09-20 Alexey Proskuryakov <ap@apple.com>
-[WebHTMLConveter _getFloat:forNode:property:] leaks
void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight)
{
LayoutUnit height = m_block.logicalHeight();
- LayoutUnit logicalHeight = logicalHeightForLine(&m_block, m_isFirstLine, replacedHeight);
+ LayoutUnit logicalHeight = m_block.minLineHeightForReplacedRenderer(m_isFirstLine, replacedHeight);
m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logicalHeight);
m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logicalHeight);
const FloatingObjectSet& floatingObjectSet = m_block.m_floatingObjects->set();
FloatingObjectSetIterator it = floatingObjectSet.end();
FloatingObjectSetIterator begin = floatingObjectSet.begin();
+ LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
for (--it; it != begin; --it) {
FloatingObject* previousFloat = *it;
if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) {
previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideInfo();
if (previousShapeOutsideInfo)
- previousShapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, previousFloat, m_block.logicalHeight(), logicalHeightForLine(&m_block, m_isFirstLine));
+ previousShapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, previousFloat, m_block.logicalHeight(), lineHeight);
break;
}
}
ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo();
if (shapeOutsideInfo)
- shapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, newFloat, m_block.logicalHeight(), logicalHeightForLine(&m_block, m_isFirstLine));
+ shapeOutsideInfo->updateDeltasForContainingBlockLine(&m_block, newFloat, m_block.logicalHeight(), lineHeight);
#endif
if (newFloat->type() == FloatingObject::FloatLeft) {
enum IndentTextOrNot { DoNotIndentText, IndentText };
-inline LayoutUnit logicalHeightForLine(const RenderBlock* block, bool isFirstLine, LayoutUnit replacedHeight = 0)
-{
- if (!block->document().inNoQuirksMode() && replacedHeight)
- return replacedHeight;
-
- if (!(block->style(isFirstLine)->lineBoxContain() & LineBoxContainBlock))
- return 0;
-
- return std::max<LayoutUnit>(replacedHeight, block->lineHeight(isFirstLine, block->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
-}
-
class LineWidth {
public:
LineWidth(RenderBlock&, bool isFirstLine, IndentTextOrNot shouldIndentText);
return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
}
+LayoutUnit RenderBlock::minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const
+{
+ if (!document().inNoQuirksMode() && replacedHeight)
+ return replacedHeight;
+
+ if (!(style(isFirstLine)->lineBoxContain() & LineBoxContainBlock))
+ return 0;
+
+ return std::max<LayoutUnit>(replacedHeight, lineHeight(isFirstLine, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
+}
+
int RenderBlock::firstLineBoxBaseline() const
{
if (isWritingModeRoot() && !isRubyRun())
virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE FINAL;
virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const OVERRIDE;
+ LayoutUnit minLineHeightForReplacedRenderer(bool isFirstLine, LayoutUnit replacedHeight) const;
+
RenderLineBoxList& lineBoxes() { return m_lineBoxes; }
const RenderLineBoxList& lineBoxes() const { return m_lineBoxes; }
ShapeInsideInfo* shapeInsideInfo = view().layoutState()->shapeInsideInfo();
if (!shapeInsideInfo && flowThreadContainingBlock() && allowsShapeInsideInfoSharing()) {
+ LayoutUnit lineHeight = this->lineHeight(false, isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
// regionAtBlockOffset returns regions like an array first={0,N-1}, second={N,M-1}, ...
- LayoutUnit offset = logicalHeight() + logicalHeightForLine(this, false) - LayoutUnit(1);
+ LayoutUnit offset = logicalHeight() + lineHeight - LayoutUnit(1);
RenderRegion* region = regionAtBlockOffset(offset);
if (region)
shapeInsideInfo = region->shapeInsideInfo();
static void updateLogicalInlinePositions(RenderBlock* block, float& lineLogicalLeft, float& lineLogicalRight, float& availableLogicalWidth, bool firstLine, IndentTextOrNot shouldIndentText, LayoutUnit boxLogicalHeight)
{
- LayoutUnit lineLogicalHeight = logicalHeightForLine(block, firstLine, boxLogicalHeight);
+ LayoutUnit lineLogicalHeight = block->minLineHeightForReplacedRenderer(firstLine, boxLogicalHeight);
lineLogicalLeft = block->pixelSnappedLogicalLeftOffsetForLine(block->logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
lineLogicalRight = block->pixelSnappedLogicalRightOffsetForLine(block->logicalHeight(), shouldIndentText == IndentText, lineLogicalHeight);
availableLogicalWidth = lineLogicalRight - lineLogicalLeft;
ASSERT(lastFloatFromPreviousLine);
ShapeInsideInfo* shapeInsideInfo = block->layoutShapeInsideInfo();
- LayoutUnit lineLogicalHeight = logicalHeightForLine(block, isFirstLine);
+ LayoutUnit lineLogicalHeight = block->lineHeight(isFirstLine, block->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
LayoutUnit lineLogicalBottom = block->logicalHeight() + lineLogicalHeight;
bool lineOverlapsWithFloat = (lastFloatFromPreviousLine->y() < lineLogicalBottom) && (block->logicalHeight() < lastFloatFromPreviousLine->maxY());