Title: [182279] trunk
Revision
182279
Author
hy...@apple.com
Date
2015-04-02 11:34:57 -0700 (Thu, 02 Apr 2015)

Log Message

[New Block-Inside-Inline Model] Implement the correct paint order for blocks inside inlines.
https://bugs.webkit.org/show_bug.cgi?id=143320

Reviewed by Darin Adler.

Source/WebCore:

Added new tests in fast/block/inside-inlines.

* rendering/EllipsisBox.cpp:
(WebCore::EllipsisBox::nodeAtPoint):
* rendering/EllipsisBox.h:
* rendering/InlineBox.h:
* rendering/InlineElementBox.cpp:
(WebCore::InlineElementBox::paint):
(WebCore::InlineElementBox::nodeAtPoint):
* rendering/InlineElementBox.h:
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::nodeAtPoint):
(WebCore::InlineFlowBox::paint):
* rendering/InlineFlowBox.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::nodeAtPoint):
* rendering/InlineTextBox.h:
The HitTestAction has to be passed to nodeAtPoint so that hit test actions can be honored. All the nodeAtPoint
functions have been patched to include this argument. Painting and hit testing have been patched for InlineElementBox
to honor phases/actions when the element is an anonymous inline block.

The phase filter on RenderLineBoxList has been pushed in to InlineFlowBox::paint and InlineFlowBox::nodeAtPoint so that
we can respect it properly when inlines are painting by themselves (e.g., because they have a layer).

* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::createLineBoxes):
(WebCore::RenderBlockFlow::constructLine):
Go ahead and include all of the inline flow boxes between the root and the anonymous inline block if it turns out they
need to be constructed. This will end up being relevant for outlines and for self-painting layers (e.g., opacity).

* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::paint):
(WebCore::RenderLineBoxList::hitTest):
Remove the filters here, since they get pushed in to InlineFlowBox.

* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::nodeAtPoint):
* rendering/RootInlineBox.h:
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::nodeAtPoint):
* rendering/svg/SVGInlineTextBox.h:
More patching to pass the HitTestAction into nodeAtPoint.

LayoutTests:

* fast/block/inside-inlines/new-model/paint-order-expected.html: Added.
* fast/block/inside-inlines/new-model/paint-order.html: Added.
* fast/block/inside-inlines/opacity-on-inline-expected.html: Added.
* fast/block/inside-inlines/opacity-on-inline.html: Added.
* fast/block/inside-inlines/paint-order-expected.html: Added.
* fast/block/inside-inlines/paint-order.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (182278 => 182279)


--- trunk/LayoutTests/ChangeLog	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/LayoutTests/ChangeLog	2015-04-02 18:34:57 UTC (rev 182279)
@@ -1,3 +1,17 @@
+2015-04-02  David Hyatt  <hy...@apple.com>
+
+        [New Block-Inside-Inline Model] Implement the correct paint order for blocks inside inlines.
+        https://bugs.webkit.org/show_bug.cgi?id=143320
+
+        Reviewed by Darin Adler.
+
+        * fast/block/inside-inlines/new-model/paint-order-expected.html: Added.
+        * fast/block/inside-inlines/new-model/paint-order.html: Added.
+        * fast/block/inside-inlines/opacity-on-inline-expected.html: Added.
+        * fast/block/inside-inlines/opacity-on-inline.html: Added.
+        * fast/block/inside-inlines/paint-order-expected.html: Added.
+        * fast/block/inside-inlines/paint-order.html: Added.
+
 2015-04-02  Adam Bergkvist  <adam.bergkv...@ericsson.com>
 
         WebRTC: Add support for Promise-based MediaDevices.getUserMedia()

Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/paint-order-expected.html (0 => 182279)


--- trunk/LayoutTests/fast/block/inside-inlines/new-model/paint-order-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/paint-order-expected.html	2015-04-02 18:34:57 UTC (rev 182279)
@@ -0,0 +1,16 @@
+<!doctype html>
+<head>
+<style>
+.box { padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; border:2px solid black }
+.float { width:100px; height:100px; background-color:yellow }
+.shift { margin-top:-48px; height:40px; background-color:orange; margin-right:8px }
+</style>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><div>This line of text should avoid the float and paint on top of the orange background.  The black border should paint behind the float.</div></div>
+<div class="shift"></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/block/inside-inlines/new-model/paint-order.html (0 => 182279)


--- trunk/LayoutTests/fast/block/inside-inlines/new-model/paint-order.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/new-model/paint-order.html	2015-04-02 18:34:57 UTC (rev 182279)
@@ -0,0 +1,20 @@
+<!doctype html>
+<head>
+<style>
+.box { padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; border:2px solid black; background-color:red }
+.float { width:100px; height:100px; background-color:yellow }
+.shift { margin-top:-48px; height:40px; background-color:orange; margin-right:8px }
+</style>
+<script>
+if (window.internals)
+    window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
+</script>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><a><div>This line of text should avoid the float and paint on top of the orange background. The black border should paint behind the float.</div></a></div>
+<div class="shift"></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/block/inside-inlines/opacity-on-inline-expected.html (0 => 182279)


--- trunk/LayoutTests/fast/block/inside-inlines/opacity-on-inline-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/opacity-on-inline-expected.html	2015-04-02 18:34:57 UTC (rev 182279)
@@ -0,0 +1,9 @@
+<!doctype html>
+<head>
+<style>
+.box { padding:3px; margin:3px }
+.box div { height:40px; border:2px solid black; background-color:orange }
+</style>
+<body>
+
+<div class="box"><div style="opacity:0.5">This block should be partially transparent.</div></a></div>

Added: trunk/LayoutTests/fast/block/inside-inlines/opacity-on-inline.html (0 => 182279)


--- trunk/LayoutTests/fast/block/inside-inlines/opacity-on-inline.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/opacity-on-inline.html	2015-04-02 18:34:57 UTC (rev 182279)
@@ -0,0 +1,14 @@
+<!doctype html>
+<head>
+<style>
+.box { padding:3px; margin:3px }
+.box div { height:40px; border:2px solid black; background-color:orange }
+a { opacity:0.5 }
+</style>
+<script>
+if (window.internals)
+    window.internals.settings.setNewBlockInsideInlineModelEnabled(true)
+</script>
+<body>
+
+<div class="box"><a><div>This block should be partially transparent.</div></a></div>

Added: trunk/LayoutTests/fast/block/inside-inlines/paint-order-expected.html (0 => 182279)


--- trunk/LayoutTests/fast/block/inside-inlines/paint-order-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/paint-order-expected.html	2015-04-02 18:34:57 UTC (rev 182279)
@@ -0,0 +1,16 @@
+<!doctype html>
+<head>
+<style>
+.box { padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; border:2px solid black; }
+.float { width:100px; height:100px; background-color:yellow }
+.shift { margin-top:-48px; height:40px; background-color:orange; margin-right:8px }
+</style>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><div>This line of text should avoid the float and paint on top of the orange background.  The black border should paint behind the float.</div></div>
+<div class="shift"></div>
\ No newline at end of file

Added: trunk/LayoutTests/fast/block/inside-inlines/paint-order.html (0 => 182279)


--- trunk/LayoutTests/fast/block/inside-inlines/paint-order.html	                        (rev 0)
+++ trunk/LayoutTests/fast/block/inside-inlines/paint-order.html	2015-04-02 18:34:57 UTC (rev 182279)
@@ -0,0 +1,16 @@
+<!doctype html>
+<head>
+<style>
+.box { padding:3px; margin:3px }
+.nowrap { white-space: nowrap; }
+.float { float: left; }
+.box div { height:40px; border:2px solid black; background-color:red }
+.float { width:100px; height:100px; background-color:yellow }
+.shift { margin-top:-48px; height:40px; background-color:orange; margin-right:8px }
+</style>
+<body>
+
+<div class="float"></div>
+
+<div class="box"><a><div>This line of text should avoid the float and paint on top of the orange background. The black border should paint behind the float.</div></a></div>
+<div class="shift"></div>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (182278 => 182279)


--- trunk/Source/WebCore/ChangeLog	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/ChangeLog	2015-04-02 18:34:57 UTC (rev 182279)
@@ -1,3 +1,53 @@
+2015-04-02  David Hyatt  <hy...@apple.com>
+
+        [New Block-Inside-Inline Model] Implement the correct paint order for blocks inside inlines.
+        https://bugs.webkit.org/show_bug.cgi?id=143320
+
+        Reviewed by Darin Adler.
+
+        Added new tests in fast/block/inside-inlines.
+
+        * rendering/EllipsisBox.cpp:
+        (WebCore::EllipsisBox::nodeAtPoint):
+        * rendering/EllipsisBox.h:
+        * rendering/InlineBox.h:
+        * rendering/InlineElementBox.cpp:
+        (WebCore::InlineElementBox::paint):
+        (WebCore::InlineElementBox::nodeAtPoint):
+        * rendering/InlineElementBox.h:
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::nodeAtPoint):
+        (WebCore::InlineFlowBox::paint):
+        * rendering/InlineFlowBox.h:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::nodeAtPoint):
+        * rendering/InlineTextBox.h:
+        The HitTestAction has to be passed to nodeAtPoint so that hit test actions can be honored. All the nodeAtPoint
+        functions have been patched to include this argument. Painting and hit testing have been patched for InlineElementBox
+        to honor phases/actions when the element is an anonymous inline block.
+
+        The phase filter on RenderLineBoxList has been pushed in to InlineFlowBox::paint and InlineFlowBox::nodeAtPoint so that
+        we can respect it properly when inlines are painting by themselves (e.g., because they have a layer).
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::createLineBoxes):
+        (WebCore::RenderBlockFlow::constructLine):
+        Go ahead and include all of the inline flow boxes between the root and the anonymous inline block if it turns out they
+        need to be constructed. This will end up being relevant for outlines and for self-painting layers (e.g., opacity).
+
+        * rendering/RenderLineBoxList.cpp:
+        (WebCore::RenderLineBoxList::paint):
+        (WebCore::RenderLineBoxList::hitTest):
+        Remove the filters here, since they get pushed in to InlineFlowBox.
+
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::nodeAtPoint):
+        * rendering/RootInlineBox.h:
+        * rendering/svg/SVGInlineTextBox.cpp:
+        (WebCore::SVGInlineTextBox::nodeAtPoint):
+        * rendering/svg/SVGInlineTextBox.h:
+        More patching to pass the HitTestAction into nodeAtPoint.
+
 2015-04-02  Adam Bergkvist  <adam.bergkv...@ericsson.com>
 
         WebRTC: Add support for Promise-based MediaDevices.getUserMedia()

Modified: trunk/Source/WebCore/rendering/EllipsisBox.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/EllipsisBox.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/EllipsisBox.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -140,7 +140,7 @@
     context->fillRect(snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()), c, style.colorSpace());
 }
 
-bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
+bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction hitTestAction)
 {
     LayoutPoint adjustedLocation = accumulatedOffset + LayoutPoint(topLeft());
 
@@ -149,7 +149,7 @@
         const RenderStyle& lineStyle = this->lineStyle();
         LayoutUnit mtx = adjustedLocation.x() + m_logicalWidth - markupBox->x();
         LayoutUnit mty = adjustedLocation.y() + lineStyle.fontMetrics().ascent() - (markupBox->y() + markupBox->lineStyle().fontMetrics().ascent());
-        if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom)) {
+        if (markupBox->nodeAtPoint(request, result, locationInContainer, LayoutPoint(mtx, mty), lineTop, lineBottom, hitTestAction)) {
             blockFlow().updateHitTestResult(result, locationInContainer.point() - LayoutSize(mtx, mty));
             return true;
         }

Modified: trunk/Source/WebCore/rendering/EllipsisBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/EllipsisBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/EllipsisBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -32,7 +32,7 @@
 public:
     EllipsisBox(RenderBlockFlow&, const AtomicString& ellipsisStr, InlineFlowBox* parent, int width, int height, int y, bool firstLine, bool isVertical, InlineBox* markupBox);
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override final;
     void setSelectionState(RenderObject::SelectionState s) { m_selectionState = s; }
     IntRect selectionRect();
 

Modified: trunk/Source/WebCore/rendering/InlineBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -71,7 +71,7 @@
     }
 
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) = 0;
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) = 0;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) = 0;
 
 #if ENABLE(TREE_DEBUGGING)
     void showNodeTreeForThis() const;

Modified: trunk/Source/WebCore/rendering/InlineElementBox.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineElementBox.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineElementBox.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -65,9 +65,25 @@
 
 void InlineElementBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
 {
-    if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
+    if (!paintInfo.shouldPaintWithinRoot(renderer()))
         return;
 
+    if (renderer().isAnonymousInlineBlock()) {
+        // Treat painting of a special inline-block line like the painting of a normal block and go through all phases.
+        PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPhaseOutline : paintInfo.phase;
+        newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChildBlockBackground : newPhase;
+        
+        PaintInfo info(paintInfo);
+        info.phase = newPhase;
+        info.updateSubtreePaintRootForChildren(&renderer());
+        ASSERT(!renderer().hasSelfPaintingLayer());
+        renderer().paint(info, paintOffset);
+        return;
+    }
+
+    if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
+        return;
+
     LayoutPoint childPoint = paintOffset;
     if (is<RenderBox>(renderer()) && parent()->renderer().style().isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
         childPoint = renderer().containingBlock()->flipForWritingModeForChild(&downcast<RenderBox>(renderer()), childPoint);
@@ -75,9 +91,18 @@
     renderer().paintAsInlineBlock(paintInfo, childPoint);
 }
 
-bool InlineElementBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
+bool InlineElementBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/,
+    HitTestAction hitTestAction)
 {
-    // Hit test all phases of replaced elements atomically, as though the replaced element established its
+    // If we are an anonymous inline block, honor hit test phases.
+    if (renderer().isAnonymousInlineBlock()) {
+        HitTestAction childHitTest = hitTestAction;
+        if (hitTestAction == HitTestChildBlockBackgrounds)
+            childHitTest = HitTestChildBlockBackground;
+        return renderer().nodeAtPoint(request, result, locationInContainer, accumulatedOffset, childHitTest);
+    }
+
+    // Otherwise hit test all phases of replaced elements atomically, as though the replaced element established its
     // own stacking context.  (See Appendix E.2, section 6.4 on inline block/table elements in the CSS2.1
     // specification.)
     LayoutPoint childPoint = accumulatedOffset;

Modified: trunk/Source/WebCore/rendering/InlineElementBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineElementBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineElementBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -49,7 +49,7 @@
     virtual void attachLine() override final;
 
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override;
 
 private:
     virtual bool isInlineElementBox() const override final { return true; }

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -1032,8 +1032,12 @@
     setVisualOverflow(visualOverflow, lineTop, lineBottom);
 }
 
-bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
+bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction hitTestAction)
 {
+    // As long as we don't have an anonymous inline block on our line, we restrict our hit testing only to the foreground phase.
+    if (!hasAnonymousInlineBlock() && hitTestAction != HitTestForeground)
+        return false;
+
     LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
     flipForWritingMode(overflowRect);
     overflowRect.moveBy(accumulatedOffset);
@@ -1064,7 +1068,7 @@
                 }
                 culledParent = newParent;
             }
-            if (child->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
+            if (child->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom, hitTestAction)) {
                 renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
                 return true;
             }
@@ -1125,6 +1129,10 @@
 
 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
 {
+    // As long as we don't have an anonymous inline block on our line, we restrict our painting only to a few phases.
+    if (!hasAnonymousInlineBlock() && (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseOutline && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines && paintInfo.phase != PaintPhaseTextClip && paintInfo.phase != PaintPhaseMask))
+        return;
+
     LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
     overflowRect.inflate(renderer().maximalOutlineSize(paintInfo.phase));
     flipForWritingMode(overflowRect);
@@ -1168,11 +1176,13 @@
                     paintInfo.outlineObjects->add(&inlineFlow);
             }
         } else if (paintInfo.phase == PaintPhaseMask) {
-            paintMask(paintInfo, paintOffset);
+            if (!hasAnonymousInlineBlock())
+                paintMask(paintInfo, paintOffset);
             return;
         } else {
             // Paint our background, border and box-shadow.
-            paintBoxDecorations(paintInfo, paintOffset);
+            if (!hasAnonymousInlineBlock())
+                paintBoxDecorations(paintInfo, paintOffset);
         }
     }
 

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -120,7 +120,7 @@
     void paintFillLayer(const PaintInfo&, const Color&, const FillLayer*, const LayoutRect&, CompositeOperator = CompositeSourceOver);
     void paintBoxShadow(const PaintInfo&, const RenderStyle&, ShadowStyle, const LayoutRect&);
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override;
 
     bool boxShadowCanBeAppliedToBackground(const FillLayer&) const;
 

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -389,7 +389,8 @@
     return renderer().style().preserveNewline() && len() == 1 && (*renderer().text())[start()] == '\n';
 }
 
-bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
+bool InlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/,
+    HitTestAction /*hitTestAction*/)
 {
     if (!visibleToHitTesting())
         return false;

Modified: trunk/Source/WebCore/rendering/InlineTextBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/InlineTextBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/InlineTextBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -122,7 +122,7 @@
 
 protected:
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom);
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override;
 
 private:
     virtual void deleteLine() override final;

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -193,6 +193,7 @@
     InlineFlowBox* parentBox = nullptr;
     InlineFlowBox* result = nullptr;
     bool hasDefaultLineBoxContain = style().lineBoxContain() == RenderStyle::initialLineBoxContain();
+    bool isBlockInsideInline = childBox->renderer().isAnonymousInlineBlock();
     do {
         ASSERT_WITH_SECURITY_IMPLICATION(is<RenderInline>(*obj) || obj == this);
 
@@ -216,6 +217,7 @@
             parentBox = downcast<InlineFlowBox>(newBox);
             parentBox->setIsFirstLine(lineInfo.isFirstLine());
             parentBox->setIsHorizontal(isHorizontalWritingMode());
+            parentBox->setHasAnonymousInlineBlock(isBlockInsideInline);
             if (!hasDefaultLineBoxContain)
                 parentBox->clearDescendantsHaveSameLineHeightAndBaseline();
             constructedNewBox = true;
@@ -284,7 +286,6 @@
     InlineFlowBox* parentBox = 0;
     int runCount = bidiRuns.runCount() - lineInfo.runsFromLeadingWhitespace();
     
-    bool isAnonymousInlineBlock = false;
     for (BidiRun* r = bidiRuns.firstRun(); r; r = r->next()) {
         // Create a box for our object.
         bool isOnlyRun = (runCount == 1);
@@ -299,8 +300,6 @@
 
         if (!rootHasSelectedChildren && box->renderer().selectionState() != RenderObject::SelectionNone)
             rootHasSelectedChildren = true;
-    
-        isAnonymousInlineBlock = r->renderer().isAnonymousInlineBlock();
         
         // If we have no parent box yet, or if the run is not simply a sibling,
         // then we need to construct inline boxes as necessary to properly enclose the
@@ -308,9 +307,7 @@
         // they are positioned separately.
         if (!parentBox || &parentBox->renderer() != r->renderer().parent()) {
             // Create new inline boxes all the way back to the appropriate insertion point.
-            // For anonymous inline blocks, we never create intermediate line boxes for the inlines, since
-            // we want to pretend like they don't exist on the line.
-            RenderObject* parentToUse = isAnonymousInlineBlock ? this : r->renderer().parent();
+            RenderObject* parentToUse = r->renderer().parent();
             parentBox = createLineBoxes(parentToUse, lineInfo, box);
         } else {
             // Append the inline box to this line.
@@ -348,8 +345,6 @@
 
     // Now mark the line boxes as being constructed.
     lastRootBox()->setConstructed();
-    
-    lastRootBox()->setHasAnonymousInlineBlock(isAnonymousInlineBlock);
 
     // Return the last line.
     return lastRootBox();

Modified: trunk/Source/WebCore/rendering/RenderLineBoxList.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/RenderLineBoxList.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -206,12 +206,6 @@
 
 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
 {
-    // Only paint during the foreground/selection phases.
-    if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseOutline 
-        && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintPhaseChildOutlines && paintInfo.phase != PaintPhaseTextClip
-        && paintInfo.phase != PaintPhaseMask)
-        return;
-
     ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could paint like this is if it has a layer.
 
     // If we have no lines then we have no work to do.
@@ -279,9 +273,6 @@
 
 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const
 {
-    if (hitTestAction != HitTestForeground)
-        return false;
-
     ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer->hasLayer())); // The only way an inline could hit test like this is if it has a layer.
 
     // If we have no lines then we have no work to do.
@@ -302,7 +293,7 @@
     for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) {
         const RootInlineBox& rootBox = curr->root();
         if (rangeIntersectsRect(renderer, curr->logicalTopVisualOverflow(rootBox.lineTop()), curr->logicalBottomVisualOverflow(rootBox.lineBottom()), rect, accumulatedOffset)) {
-            bool inside = curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, rootBox.lineTop(), rootBox.lineBottom());
+            bool inside = curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, rootBox.lineTop(), rootBox.lineBottom(), hitTestAction);
             if (inside) {
                 renderer->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
                 return true;

Modified: trunk/Source/WebCore/rendering/RootInlineBox.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/RootInlineBox.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/RootInlineBox.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -187,15 +187,15 @@
     paintEllipsisBox(paintInfo, paintOffset, lineTop, lineBottom);
 }
 
-bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
+bool RootInlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction hitTestAction)
 {
     if (hasEllipsisBox() && visibleToHitTesting()) {
-        if (ellipsisBox()->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
+        if (ellipsisBox()->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom, hitTestAction)) {
             renderer().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
             return true;
         }
     }
-    return InlineFlowBox::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom);
+    return InlineFlowBox::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom, hitTestAction);
 }
 
 void RootInlineBox::adjustPosition(float dx, float dy)

Modified: trunk/Source/WebCore/rendering/RootInlineBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/RootInlineBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/RootInlineBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -119,7 +119,7 @@
     virtual LayoutUnit lineHeight() const override final;
 
     virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom) override;
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override final;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override final;
 
     using InlineBox::hasSelectedChildren;
     using InlineBox::setHasSelectedChildren;

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (182278 => 182279)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp	2015-04-02 18:34:57 UTC (rev 182279)
@@ -671,7 +671,7 @@
     return textRect;
 }
 
-bool SVGInlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUnit)
+bool SVGInlineTextBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit, LayoutUnit, HitTestAction)
 {
     // FIXME: integrate with InlineTextBox::nodeAtPoint better.
     ASSERT(!isLineBreak());

Modified: trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h (182278 => 182279)


--- trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h	2015-04-02 18:31:39 UTC (rev 182278)
+++ trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.h	2015-04-02 18:34:57 UTC (rev 182279)
@@ -82,7 +82,7 @@
     void paintTextWithShadows(GraphicsContext*, RenderStyle*, TextRun&, const SVGTextFragment&, int startPosition, int endPosition);
     void paintText(GraphicsContext*, RenderStyle*, RenderStyle* selectionStyle, const SVGTextFragment&, bool hasSelection, bool paintSelectedTextOnly);
 
-    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom) override;
+    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom, HitTestAction) override;
 
 private:
     float m_logicalHeight;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to