Title: [158812] trunk/Source/WebCore
Revision
158812
Author
[email protected]
Date
2013-11-06 19:32:48 -0800 (Wed, 06 Nov 2013)

Log Message

InlineBox: Make paint() and nodeAtPoint() pure virtuals.
<https://webkit.org/b/123937>

...and move the current implementations to InlineElementBox.
All subclasses were already overriding these functions so the move
is completely natural.

Reviewed by Anders Carlsson.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158811 => 158812)


--- trunk/Source/WebCore/ChangeLog	2013-11-07 03:30:11 UTC (rev 158811)
+++ trunk/Source/WebCore/ChangeLog	2013-11-07 03:32:48 UTC (rev 158812)
@@ -1,5 +1,16 @@
 2013-11-06  Andreas Kling  <[email protected]>
 
+        InlineBox: Make paint() and nodeAtPoint() pure virtuals.
+        <https://webkit.org/b/123937>
+
+        ...and move the current implementations to InlineElementBox.
+        All subclasses were already overriding these functions so the move
+        is completely natural.
+
+        Reviewed by Anders Carlsson.
+
+2013-11-06  Andreas Kling  <[email protected]>
+
         Nothing should return std::unique_ptr<InlineBox>.
         <https://webkit.org/b/123936>
 

Modified: trunk/Source/WebCore/WebCore.exp.in (158811 => 158812)


--- trunk/Source/WebCore/WebCore.exp.in	2013-11-07 03:30:11 UTC (rev 158811)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-11-07 03:32:48 UTC (rev 158812)
@@ -1323,12 +1323,10 @@
 __ZN7WebCore9HTMLNames9selectTagE
 __ZN7WebCore9HTMLNames9styleAttrE
 __ZN7WebCore9HTMLNames9valueAttrE
-__ZN7WebCore9InlineBox11nodeAtPointERKNS_14HitTestRequestERNS_13HitTestResultERKNS_15HitTestLocationERKNS_11LayoutPointENS_10LayoutUnitESC_
 __ZN7WebCore9InlineBox14adjustPositionEff
 __ZN7WebCore9InlineBox14dirtyLineBoxesEv
 __ZN7WebCore9InlineBox14selectionStateEv
 __ZN7WebCore9InlineBox16placeEllipsisBoxEbfffRfRb
-__ZN7WebCore9InlineBox5paintERNS_9PaintInfoERKNS_11LayoutPointENS_10LayoutUnitES6_
 __ZN7WebCore9JSElement6s_infoE
 __ZN7WebCore9PageCache11setCapacityEi
 __ZN7WebCore9PageCache33markPagesForVistedLinkStyleRecalcEv

Modified: trunk/Source/WebCore/rendering/InlineBox.cpp (158811 => 158812)


--- trunk/Source/WebCore/rendering/InlineBox.cpp	2013-11-07 03:30:11 UTC (rev 158811)
+++ trunk/Source/WebCore/rendering/InlineBox.cpp	2013-11-07 03:32:48 UTC (rev 158812)
@@ -164,47 +164,6 @@
         toRenderBox(renderer()).move(dx, dy);
 }
 
-void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
-{
-    RenderElement& renderer = toRenderElement(this->renderer());
-    if (!paintInfo.shouldPaintWithinRoot(renderer) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
-        return;
-
-    LayoutPoint childPoint = paintOffset;
-    if (parent()->renderer().style().isFlippedBlocksWritingMode() && renderer.isBox()) // Faster than calling containingBlock().
-        childPoint = m_renderer.containingBlock()->flipForWritingModeForChild(&toRenderBox(renderer), childPoint);
-    
-    // Paint 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.)
-    bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
-    PaintInfo info(paintInfo);
-    info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
-    renderer.paint(info, childPoint);
-    if (!preservePhase) {
-        info.phase = PaintPhaseChildBlockBackgrounds;
-        renderer.paint(info, childPoint);
-        info.phase = PaintPhaseFloat;
-        renderer.paint(info, childPoint);
-        info.phase = PaintPhaseForeground;
-        renderer.paint(info, childPoint);
-        info.phase = PaintPhaseOutline;
-        renderer.paint(info, childPoint);
-    }
-}
-
-bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
-{
-    // 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;
-    if (parent()->renderer().style().isFlippedBlocksWritingMode() && !renderer().isLineBreak()) // Faster than calling containingBlock().
-        childPoint = m_renderer.containingBlock()->flipForWritingModeForChild(&toRenderBox(renderer()), childPoint);
-    
-    return m_renderer.hitTest(request, result, locationInContainer, childPoint);
-}
-
 const RootInlineBox& InlineBox::root() const
 { 
     if (m_parent)

Modified: trunk/Source/WebCore/rendering/InlineBox.h (158811 => 158812)


--- trunk/Source/WebCore/rendering/InlineBox.h	2013-11-07 03:30:11 UTC (rev 158811)
+++ trunk/Source/WebCore/rendering/InlineBox.h	2013-11-07 03:32:48 UTC (rev 158812)
@@ -65,8 +65,8 @@
             adjustPosition(delta, 0);
     }
 
-    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);
+    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;
 
 public:
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/rendering/InlineElementBox.cpp (158811 => 158812)


--- trunk/Source/WebCore/rendering/InlineElementBox.cpp	2013-11-07 03:30:11 UTC (rev 158811)
+++ trunk/Source/WebCore/rendering/InlineElementBox.cpp	2013-11-07 03:32:48 UTC (rev 158812)
@@ -26,6 +26,8 @@
 #include "config.h"
 #include "InlineElementBox.h"
 
+#include "PaintInfo.h"
+#include "RenderBlock.h"
 #include "RenderBox.h"
 #include "RenderLineBreak.h"
 
@@ -60,4 +62,44 @@
         toRenderLineBreak(renderer()).setInlineBoxWrapper(this);
 }
 
+void InlineElementBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
+{
+    if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
+        return;
+
+    LayoutPoint childPoint = paintOffset;
+    if (renderer().isBox() && parent()->renderer().style().isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
+        childPoint = renderer().containingBlock()->flipForWritingModeForChild(&toRenderBox(renderer()), childPoint);
+
+    // Paint 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.)
+    bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
+    PaintInfo info(paintInfo);
+    info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
+    renderer().paint(info, childPoint);
+    if (!preservePhase) {
+        info.phase = PaintPhaseChildBlockBackgrounds;
+        renderer().paint(info, childPoint);
+        info.phase = PaintPhaseFloat;
+        renderer().paint(info, childPoint);
+        info.phase = PaintPhaseForeground;
+        renderer().paint(info, childPoint);
+        info.phase = PaintPhaseOutline;
+        renderer().paint(info, childPoint);
+    }
+}
+
+bool InlineElementBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
+{
+    // 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;
+    if (renderer().isBox() && parent()->renderer().style().isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
+        childPoint = renderer().containingBlock()->flipForWritingModeForChild(&toRenderBox(renderer()), childPoint);
+
+    return renderer().hitTest(request, result, locationInContainer, childPoint);
+}
+
 }
\ No newline at end of file

Modified: trunk/Source/WebCore/rendering/InlineElementBox.h (158811 => 158812)


--- trunk/Source/WebCore/rendering/InlineElementBox.h	2013-11-07 03:30:11 UTC (rev 158811)
+++ trunk/Source/WebCore/rendering/InlineElementBox.h	2013-11-07 03:32:48 UTC (rev 158812)
@@ -47,6 +47,9 @@
     virtual void deleteLine() OVERRIDE;
     virtual void extractLine() OVERRIDE;
     virtual void attachLine() OVERRIDE;
+
+    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;
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to