Title: [134088] branches/safari-536.28-branch

Diff

Modified: branches/safari-536.28-branch/LayoutTests/ChangeLog (134087 => 134088)


--- branches/safari-536.28-branch/LayoutTests/ChangeLog	2012-11-09 18:56:02 UTC (rev 134087)
+++ branches/safari-536.28-branch/LayoutTests/ChangeLog	2012-11-09 19:07:22 UTC (rev 134088)
@@ -1,3 +1,17 @@
+2012-11-09  Lucas Forschler  <[email protected]>
+
+        Merge r125635
+
+    2012-08-14  Ojan Vafai  <[email protected]>
+
+            Fix access to m_markupBox in WebCore::EllipsisBox::paint
+            https://bugs.webkit.org/show_bug.cgi?id=91138
+
+            Reviewed by Abhishek Arya.
+
+            * fast/overflow/line-clamp-and-columns-expected.html: Added.
+            * fast/overflow/line-clamp-and-columns.html: Added.
+
 2012-11-08  Lucas Forschler  <[email protected]>
 
         Merge r125695
@@ -11276,3 +11290,4 @@
 .
 .
 .
+.

Copied: branches/safari-536.28-branch/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html (from rev 125635, trunk/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html) (0 => 134088)


--- branches/safari-536.28-branch/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html	                        (rev 0)
+++ branches/safari-536.28-branch/LayoutTests/fast/overflow/line-clamp-and-columns-expected.html	2012-11-09 19:07:22 UTC (rev 134088)
@@ -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/safari-536.28-branch/LayoutTests/fast/overflow/line-clamp-and-columns.html (from rev 125635, trunk/LayoutTests/fast/overflow/line-clamp-and-columns.html) (0 => 134088)


--- branches/safari-536.28-branch/LayoutTests/fast/overflow/line-clamp-and-columns.html	                        (rev 0)
+++ branches/safari-536.28-branch/LayoutTests/fast/overflow/line-clamp-and-columns.html	2012-11-09 19:07:22 UTC (rev 134088)
@@ -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/safari-536.28-branch/Source/WebCore/ChangeLog (134087 => 134088)


--- branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-09 18:56:02 UTC (rev 134087)
+++ branches/safari-536.28-branch/Source/WebCore/ChangeLog	2012-11-09 19:07:22 UTC (rev 134088)
@@ -1,3 +1,38 @@
+2012-11-09  Lucas Forschler  <[email protected]>
+
+        Merge r125635
+
+    2012-08-14  Ojan Vafai  <[email protected]>
+
+            Fix access to m_markupBox in WebCore::EllipsisBox::paint
+            https://bugs.webkit.org/show_bug.cgi?id=91138
+
+            Reviewed by Abhishek Arya.
+
+            EllipsisBox would hold on to m_markupBox, which would then get destroyed during
+            the followup layoutIfNeeded in layoutVerticalBox. Instead, have EllipsisBox
+            dynamically grab to pointer to the markup box during paint since there's no
+            straightforward way to notify the EllipsisBox that the markupBox has been destroyed
+            and/or point it at the new markupBox.
+
+            Test: fast/overflow/line-clamp-and-columns.html
+
+            * rendering/EllipsisBox.cpp:
+            (WebCore::EllipsisBox::paint):
+            (WebCore):
+            (WebCore::EllipsisBox::paintMarkupBox):
+            * rendering/EllipsisBox.h:
+            (WebCore::EllipsisBox::EllipsisBox):
+            Just store a boolean that we have a markup box that needs painting.
+            * rendering/RenderDeprecatedFlexibleBox.cpp:
+            (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp):
+            Clearing the override size right after setting it was incorrect because
+            there are cases where we'll do a followup layout in layoutVerticalBox, at which
+            point we'll still need the override size.
+            (WebCore::RenderDeprecatedFlexibleBox::clearLineClamp):
+            Clear the override size here to handle cases where line clamp is removed since
+            we don't call applyLineClamp in those cases.
+
 2012-11-08  Lucas Forschler  <[email protected]>
 
         Merge r125597
@@ -206998,3 +207033,4 @@
 .
 .
 .
+.

Modified: branches/safari-536.28-branch/Source/WebCore/rendering/EllipsisBox.cpp (134087 => 134088)


--- branches/safari-536.28-branch/Source/WebCore/rendering/EllipsisBox.cpp	2012-11-09 18:56:02 UTC (rev 134087)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/EllipsisBox.cpp	2012-11-09 19:07:22 UTC (rev 134088)
@@ -64,15 +64,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());
@@ -104,14 +120,28 @@
 
 bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
 {
+    if (!m_shouldPaintMarkupBox || !m_renderer->isRenderBlock()) 
+         return false; 
+     
+     RenderBlock* block = toRenderBlock(m_renderer); 
+     RootInlineBox* lastLine = block->lineAtIndex(block->lineCount() - 1); 
+     if (!lastLine) 
+         return false; 
+     
+     // 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 false;
+    
     LayoutPoint adjustedLocation = accumulatedOffset + roundedLayoutPoint(topLeft());
 
     // Hit test the markup box.
-    if (m_markupBox) {
+    if (anchorBox) {
         RenderStyle* style = m_renderer->style(isFirstLineStyle());
-        LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - m_markupBox->x();
-        LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (m_markupBox->y() + m_markupBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent());
-        if (m_markupBox->nodeAtPoint(request, result, pointInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
+        LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - anchorBox->x(); 
+         LayoutUnit mty = adjustedLocation.y() + style->fontMetrics().ascent() - (anchorBox->y() + anchorBox->renderer()->style(isFirstLineStyle())->fontMetrics().ascent()); 
+         if (anchorBox->nodeAtPoint(request, result, pointInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
             renderer()->updateHitTestResult(result, pointInContainer - LayoutSize(mtx, mty));
             return true;
         }

Modified: branches/safari-536.28-branch/Source/WebCore/rendering/EllipsisBox.h (134087 => 134088)


--- branches/safari-536.28-branch/Source/WebCore/rendering/EllipsisBox.h	2012-11-09 18:56:02 UTC (rev 134087)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/EllipsisBox.h	2012-11-09 19:07:22 UTC (rev 134088)
@@ -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/safari-536.28-branch/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (134087 => 134088)


--- branches/safari-536.28-branch/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2012-11-09 18:56:02 UTC (rev 134087)
+++ branches/safari-536.28-branch/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp	2012-11-09 19:07:22 UTC (rev 134088)
@@ -889,6 +889,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);
@@ -929,7 +930,6 @@
         m_flexingChildren = true;
         child->layoutIfNeeded();
         m_flexingChildren = false;
-        child->clearOverrideSize();
 
         // FIXME: For now don't support RTL.
         if (style()->direction() != LTR)
@@ -991,6 +991,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);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to