Diff
Copied: branches/chromium/1229/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html (from rev 125635, trunk/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html) (0 => 127627)
--- branches/chromium/1229/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html (rev 0)
+++ branches/chromium/1229/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html 2012-09-05 19:15:53 UTC (rev 127627)
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<body style="width: 51px">
+<div id=flexbox style="-webkit-box-orient: vertical; -webkit-line-clamp: 1; display: -webkit-box; background-color: salmon; overflow:hidden">
+ <span>AAA </span><a href=""
+</div>
+</body>
Copied: branches/chromium/1229/LayoutTests/fast/overflow/line-clamp-and-columns.html (from rev 125635, trunk/LayoutTests/fast/overflow/line-clamp-and-columns.html) (0 => 127627)
--- branches/chromium/1229/LayoutTests/fast/overflow/line-clamp-and-columns.html (rev 0)
+++ branches/chromium/1229/LayoutTests/fast/overflow/line-clamp-and-columns.html 2012-09-05 19:15:53 UTC (rev 127627)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<div id=flexbox style="-webkit-box-orient: vertical; -webkit-line-clamp: 1; display: -webkit-box; background-color: salmon; overflow:hidden">
+ <span>AAA </span><a href=""
+</div>
+<script>
+document.body.offsetTop;
+</script>
+<style>
+body {
+ -webkit-column-width: 50px;
+ -webkit-column-count: 12;
+}
+</style>
Modified: branches/chromium/1229/Source/WebCore/rendering/EllipsisBox.cpp (127626 => 127627)
--- branches/chromium/1229/Source/WebCore/rendering/EllipsisBox.cpp 2012-09-05 19:14:48 UTC (rev 127626)
+++ branches/chromium/1229/Source/WebCore/rendering/EllipsisBox.cpp 2012-09-05 19:15:53 UTC (rev 127627)
@@ -65,15 +65,31 @@
if (setShadow)
context->clearShadow();
- if (m_markupBox) {
- // Paint the markup box
- LayoutPoint adjustedPaintOffset = paintOffset;
- adjustedPaintOffset.move(x() + m_logicalWidth - m_markupBox->x(),
- y() + style->fontMetrics().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()));
- m_markupBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom);
- }
+ paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style);
}
+void EllipsisBox::paintMarkupBox(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle* style)
+{
+ if (!m_shouldPaintMarkupBox || !m_renderer->isRenderBlock())
+ return;
+
+ RenderBlock* block = toRenderBlock(m_renderer);
+ RootInlineBox* lastLine = block->lineAtIndex(block->lineCount() - 1);
+ if (!lastLine)
+ return;
+
+ // If the last line-box on the last line of a block is a link, -webkit-line-clamp paints that box after the ellipsis.
+ // It does not actually move the link.
+ InlineBox* anchorBox = lastLine->lastChild();
+ if (!anchorBox || !anchorBox->renderer()->style()->isLink())
+ return;
+
+ LayoutPoint adjustedPaintOffset = paintOffset;
+ adjustedPaintOffset.move(x() + m_logicalWidth - anchorBox->x(),
+ y() + style->fontMetrics().ascent() - (anchorBox->y() + anchorBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()));
+ anchorBox->paint(paintInfo, adjustedPaintOffset, lineTop, lineBottom);
+}
+
IntRect EllipsisBox::selectionRect()
{
RenderStyle* style = m_renderer->style(isFirstLineStyle());
Modified: branches/chromium/1229/Source/WebCore/rendering/EllipsisBox.h (127626 => 127627)
--- branches/chromium/1229/Source/WebCore/rendering/EllipsisBox.h 2012-09-05 19:14:48 UTC (rev 127626)
+++ branches/chromium/1229/Source/WebCore/rendering/EllipsisBox.h 2012-09-05 19:15:53 UTC (rev 127627)
@@ -32,9 +32,9 @@
EllipsisBox(RenderObject* obj, const AtomicString& ellipsisStr, InlineFlowBox* parent,
int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox)
: InlineBox(obj, FloatPoint(0, y), width, firstLine, true, false, false, isVertical, 0, 0, parent)
+ , m_shouldPaintMarkupBox(markupBox)
, m_height(height)
, m_str(ellipsisStr)
- , m_markupBox(markupBox)
, m_selectionState(RenderObject::SelectionNone)
{
}
@@ -45,13 +45,14 @@
IntRect selectionRect();
private:
+ void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, RenderStyle*);
virtual int height() const { return m_height; }
virtual RenderObject::SelectionState selectionState() { return m_selectionState; }
void paintSelection(GraphicsContext*, const LayoutPoint&, RenderStyle*, const Font&);
+ bool m_shouldPaintMarkupBox;
int m_height;
AtomicString m_str;
- InlineBox* m_markupBox;
RenderObject::SelectionState m_selectionState;
};
Modified: branches/chromium/1229/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (127626 => 127627)
--- branches/chromium/1229/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2012-09-05 19:14:48 UTC (rev 127626)
+++ branches/chromium/1229/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp 2012-09-05 19:15:53 UTC (rev 127627)
@@ -885,6 +885,7 @@
if (childDoesNotAffectWidthOrFlexing(child))
continue;
+ child->clearOverrideSize();
if (relayoutChildren || (child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent()))
|| (child->style()->height().isAuto() && child->isBlockFlow())) {
child->setChildNeedsLayout(true, MarkOnlyThis);
@@ -925,7 +926,6 @@
m_flexingChildren = true;
child->layoutIfNeeded();
m_flexingChildren = false;
- child->clearOverrideSize();
// FIXME: For now don't support RTL.
if (style()->direction() != LTR)
@@ -988,6 +988,7 @@
if (childDoesNotAffectWidthOrFlexing(child))
continue;
+ child->clearOverrideSize();
if ((child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent()))
|| (child->style()->height().isAuto() && child->isBlockFlow())) {
child->setChildNeedsLayout(true);