Title: [156197] trunk/Source/WebCore
Revision
156197
Author
[email protected]
Date
2013-09-20 13:53:44 -0700 (Fri, 20 Sep 2013)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (156196 => 156197)


--- trunk/Source/WebCore/ChangeLog	2013-09-20 20:40:53 UTC (rev 156196)
+++ trunk/Source/WebCore/ChangeLog	2013-09-20 20:53:44 UTC (rev 156197)
@@ -1,3 +1,31 @@
+2013-09-20  Zoltan Horvath  <[email protected]>
+
+        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  <[email protected]>
 
         -[WebHTMLConveter _getFloat:forNode:property:] leaks

Modified: trunk/Source/WebCore/rendering/LineWidth.cpp (156196 => 156197)


--- trunk/Source/WebCore/rendering/LineWidth.cpp	2013-09-20 20:40:53 UTC (rev 156196)
+++ trunk/Source/WebCore/rendering/LineWidth.cpp	2013-09-20 20:53:44 UTC (rev 156197)
@@ -72,7 +72,7 @@
 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);
 
@@ -102,19 +102,20 @@
     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) {

Modified: trunk/Source/WebCore/rendering/LineWidth.h (156196 => 156197)


--- trunk/Source/WebCore/rendering/LineWidth.h	2013-09-20 20:40:53 UTC (rev 156196)
+++ trunk/Source/WebCore/rendering/LineWidth.h	2013-09-20 20:53:44 UTC (rev 156197)
@@ -37,17 +37,6 @@
 
 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);

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (156196 => 156197)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-09-20 20:40:53 UTC (rev 156196)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-09-20 20:53:44 UTC (rev 156197)
@@ -5642,6 +5642,17 @@
     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())

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (156196 => 156197)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2013-09-20 20:40:53 UTC (rev 156196)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2013-09-20 20:53:44 UTC (rev 156197)
@@ -115,6 +115,8 @@
     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; }
 

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (156196 => 156197)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-09-20 20:40:53 UTC (rev 156196)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-09-20 20:53:44 UTC (rev 156197)
@@ -75,8 +75,9 @@
     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();
@@ -768,7 +769,7 @@
 
 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;
@@ -2593,7 +2594,7 @@
     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());
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to