Diff
Modified: trunk/Source/WebCore/ChangeLog (201051 => 201052)
--- trunk/Source/WebCore/ChangeLog 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/ChangeLog 2016-05-17 22:39:00 UTC (rev 201052)
@@ -1,3 +1,65 @@
+2016-05-17 Chris Dumez <[email protected]>
+
+ Use RenderChildIterator more for traversing a renderer's children
+ https://bugs.webkit.org/show_bug.cgi?id=157811
+
+ Reviewed by Antti Koivisto.
+
+ Use RenderChildIterator more for traversing a renderer's children.
+
+ * inspector/InspectorLayerTreeAgent.cpp:
+ (WebCore::InspectorLayerTreeAgent::layersForNode):
+ (WebCore::InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy):
+ * inspector/InspectorLayerTreeAgent.h:
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::recalcColumn):
+ * rendering/InlineIterator.h:
+ (WebCore::isEmptyInline):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::addFocusRingRects):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::positionForPoint):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::updateOutlineAutoAncestor):
+ * rendering/RenderElement.h:
+ * rendering/RenderFieldset.cpp:
+ (WebCore::RenderFieldset::findLegend):
+ * rendering/RenderFieldset.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::generateCulledLineBoxRects):
+ (WebCore::RenderInline::culledInlineFirstLineBox):
+ (WebCore::RenderInline::culledInlineVisualOverflowBoundingBox):
+ (WebCore::RenderInline::dirtyLineBoxes):
+ * rendering/RenderListItem.cpp:
+ (WebCore::getParentOfFirstLineBox):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::setFlowThreadStateIncludingDescendants):
+ (WebCore::RenderObject::addAbsoluteRectForLayer):
+ (WebCore::RenderObject::paintingRootRect):
+ (WebCore::RenderObject::removeFromRenderFlowThreadIncludingDescendants):
+ (WebCore::RenderObject::invalidateFlowThreadContainingBlockIncludingDescendants):
+ (WebCore::RenderObject::updateDragState):
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::firstColumn):
+ * rendering/RenderTableCol.cpp:
+ (WebCore::RenderTableCol::clearPreferredLogicalWidthsDirtyBits):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::layoutRows):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::write):
+ * rendering/svg/RenderSVGText.cpp:
+ (WebCore::findPreviousAndNextAttributes):
+ (WebCore::RenderSVGText::subtreeChildWasAdded):
+ (WebCore::RenderSVGText::subtreeChildWillBeRemoved):
+ * rendering/svg/SVGRenderSupport.cpp:
+ (WebCore::updateObjectBoundingBox):
+ (WebCore::SVGRenderSupport::computeContainerBoundingBoxes):
+ (WebCore::SVGRenderSupport::layoutChildren):
+ * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
+ (WebCore::SVGTextLayoutAttributesBuilder::collectTextPositioningElements):
+ * rendering/svg/SVGTextMetricsBuilder.cpp:
+ (WebCore::SVGTextMetricsBuilder::walkTree):
+
2016-05-17 Dean Jackson <[email protected]>
Remove ES6_GENERATORS flag
Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp (201051 => 201052)
--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -36,6 +36,7 @@
#include "InstrumentingAgents.h"
#include "IntRect.h"
#include "PseudoElement.h"
+#include "RenderChildIterator.h"
#include "RenderLayer.h"
#include "RenderLayerBacking.h"
#include "RenderLayerCompositor.h"
@@ -105,30 +106,31 @@
{
layers = Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>::create();
- Node* node = m_instrumentingAgents.inspectorDOMAgent()->nodeForId(nodeId);
+ auto* node = m_instrumentingAgents.inspectorDOMAgent()->nodeForId(nodeId);
if (!node) {
errorString = ASCIILiteral("Provided node id doesn't match any known node");
return;
}
- RenderObject* renderer = node->renderer();
+ auto* renderer = node->renderer();
if (!renderer) {
errorString = ASCIILiteral("Node for provided node id doesn't have a renderer");
return;
}
- gatherLayersUsingRenderObjectHierarchy(errorString, renderer, layers);
+ if (is<RenderElement>(*renderer))
+ gatherLayersUsingRenderObjectHierarchy(errorString, downcast<RenderElement>(*renderer), layers);
}
-void InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy(ErrorString& errorString, RenderObject* renderer, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>& layers)
+void InspectorLayerTreeAgent::gatherLayersUsingRenderObjectHierarchy(ErrorString& errorString, RenderElement& renderer, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>& layers)
{
- if (renderer->hasLayer()) {
- gatherLayersUsingRenderLayerHierarchy(errorString, downcast<RenderLayerModelObject>(*renderer).layer(), layers);
+ if (renderer.hasLayer()) {
+ gatherLayersUsingRenderLayerHierarchy(errorString, downcast<RenderLayerModelObject>(renderer).layer(), layers);
return;
}
- for (renderer = renderer->firstChildSlow(); renderer; renderer = renderer->nextSibling())
- gatherLayersUsingRenderObjectHierarchy(errorString, renderer, layers);
+ for (auto& child : childrenOfType<RenderElement>(renderer))
+ gatherLayersUsingRenderObjectHierarchy(errorString, child, layers);
}
void InspectorLayerTreeAgent::gatherLayersUsingRenderLayerHierarchy(ErrorString& errorString, RenderLayer* renderLayer, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>& layers)
Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h (201051 => 201052)
--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.h 2016-05-17 22:39:00 UTC (rev 201052)
@@ -66,7 +66,7 @@
String bind(const RenderLayer*);
void unbind(const RenderLayer*);
- void gatherLayersUsingRenderObjectHierarchy(ErrorString&, RenderObject*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>&);
+ void gatherLayersUsingRenderObjectHierarchy(ErrorString&, RenderElement&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>&);
void gatherLayersUsingRenderLayerHierarchy(ErrorString&, RenderLayer*, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::LayerTree::Layer>>&);
Ref<Inspector::Protocol::LayerTree::Layer> buildObjectForLayer(ErrorString&, RenderLayer*);
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -22,6 +22,7 @@
#include "config.h"
#include "AutoTableLayout.h"
+#include "RenderChildIterator.h"
#include "RenderTable.h"
#include "RenderTableCell.h"
#include "RenderTableCol.h"
@@ -48,14 +49,14 @@
RenderTableCell* fixedContributor = nullptr;
RenderTableCell* maxContributor = nullptr;
- for (RenderObject* child = m_table->firstChild(); child; child = child->nextSibling()) {
- if (is<RenderTableCol>(*child)) {
+ for (auto& child : childrenOfType<RenderObject>(*m_table)) {
+ if (is<RenderTableCol>(child)) {
// RenderTableCols don't have the concept of preferred logical width, but we need to clear their dirty bits
// so that if we call setPreferredWidthsDirty(true) on a col or one of its descendants, we'll mark it's
// ancestors as dirty.
- downcast<RenderTableCol>(*child).clearPreferredLogicalWidthsDirtyBits();
- } else if (is<RenderTableSection>(*child)) {
- RenderTableSection& section = downcast<RenderTableSection>(*child);
+ downcast<RenderTableCol>(child).clearPreferredLogicalWidthsDirtyBits();
+ } else if (is<RenderTableSection>(child)) {
+ auto& section = downcast<RenderTableSection>(child);
unsigned numRows = section.numRows();
for (unsigned i = 0; i < numRows; ++i) {
RenderTableSection::CellStruct current = section.cellAt(i, effCol);
Modified: trunk/Source/WebCore/rendering/InlineIterator.h (201051 => 201052)
--- trunk/Source/WebCore/rendering/InlineIterator.h 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/InlineIterator.h 2016-05-17 22:39:00 UTC (rev 201052)
@@ -25,6 +25,7 @@
#include "BidiRun.h"
#include "RenderBlockFlow.h"
+#include "RenderChildIterator.h"
#include "RenderInline.h"
#include "RenderText.h"
#include <wtf/StdLibExtras.h>
@@ -209,15 +210,15 @@
static bool isEmptyInline(const RenderInline& renderer)
{
- for (RenderObject* current = renderer.firstChild(); current; current = current->nextSibling()) {
- if (current->isFloatingOrOutOfFlowPositioned())
+ for (auto& current : childrenOfType<RenderObject>(renderer)) {
+ if (current.isFloatingOrOutOfFlowPositioned())
continue;
- if (is<RenderText>(*current)) {
- if (!downcast<RenderText>(*current).isAllCollapsibleWhitespace())
+ if (is<RenderText>(current)) {
+ if (!downcast<RenderText>(current).isAllCollapsibleWhitespace())
return false;
continue;
}
- if (!is<RenderInline>(*current) || !isEmptyInline(downcast<RenderInline>(*current)))
+ if (!is<RenderInline>(current) || !isEmptyInline(downcast<RenderInline>(current)))
return false;
}
return true;
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -48,6 +48,7 @@
#include "RenderBlockFlow.h"
#include "RenderBoxRegionInfo.h"
#include "RenderButton.h"
+#include "RenderChildIterator.h"
#include "RenderCombineText.h"
#include "RenderDeprecatedFlexibleBox.h"
#include "RenderFlexibleBox.h"
@@ -3465,17 +3466,17 @@
if (childrenInline())
addFocusRingRectsForInlineChildren(rects, additionalOffset, paintContainer);
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (!is<RenderText>(*child) && !is<RenderListMarker>(*child) && is<RenderBox>(*child)) {
- auto& box = downcast<RenderBox>(*child);
- FloatPoint pos;
- // FIXME: This doesn't work correctly with transforms.
- if (box.layer())
- pos = child->localToContainerPoint(FloatPoint(), paintContainer);
- else
- pos = FloatPoint(additionalOffset.x() + box.x(), additionalOffset.y() + box.y());
- box.addFocusRingRects(rects, flooredLayoutPoint(pos), paintContainer);
- }
+ for (auto& box : childrenOfType<RenderBox>(*this)) {
+ if (is<RenderListMarker>(box))
+ continue;
+
+ FloatPoint pos;
+ // FIXME: This doesn't work correctly with transforms.
+ if (box.layer())
+ pos = box.localToContainerPoint(FloatPoint(), paintContainer);
+ else
+ pos = FloatPoint(additionalOffset.x() + box.x(), additionalOffset.y() + box.y());
+ box.addFocusRingRects(rects, flooredLayoutPoint(pos), paintContainer);
}
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -48,6 +48,7 @@
#include "Page.h"
#include "PaintInfo.h"
#include "RenderBoxRegionInfo.h"
+#include "RenderChildIterator.h"
#include "RenderDeprecatedFlexibleBox.h"
#include "RenderFlexibleBox.h"
#include "RenderGeometryMap.h"
@@ -4421,18 +4422,13 @@
if (isTableRow())
adjustedPoint.moveBy(location());
- for (RenderObject* renderObject = firstChild(); renderObject; renderObject = renderObject->nextSibling()) {
- if (!is<RenderBox>(*renderObject))
- continue;
-
+ for (auto& renderer : childrenOfType<RenderBox>(*this)) {
if (is<RenderFlowThread>(*this)) {
ASSERT(region);
- if (!downcast<RenderFlowThread>(*this).objectShouldFragmentInFlowRegion(renderObject, region))
+ if (!downcast<RenderFlowThread>(*this).objectShouldFragmentInFlowRegion(&renderer, region))
continue;
}
- auto& renderer = downcast<RenderBox>(*renderObject);
-
if ((!renderer.firstChild() && !renderer.isInline() && !is<RenderBlockFlow>(renderer))
|| renderer.style().visibility() != VISIBLE)
continue;
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -41,6 +41,7 @@
#include "Logging.h"
#include "PathUtilities.h"
#include "RenderBlock.h"
+#include "RenderChildIterator.h"
#include "RenderCounter.h"
#include "RenderDeprecatedFlexibleBox.h"
#include "RenderFlexibleBox.h"
@@ -2151,18 +2152,18 @@
repaintRectangle(repaintRect);
}
-void RenderElement::updateOutlineAutoAncestor(bool hasOutlineAuto) const
+void RenderElement::updateOutlineAutoAncestor(bool hasOutlineAuto)
{
- for (auto* child = firstChild(); child; child = child->nextSibling()) {
- if (hasOutlineAuto == child->hasOutlineAutoAncestor())
+ for (auto& child : childrenOfType<RenderObject>(*this)) {
+ if (hasOutlineAuto == child.hasOutlineAutoAncestor())
continue;
- child->setHasOutlineAutoAncestor(hasOutlineAuto);
- bool childHasOutlineAuto = child->outlineStyleForRepaint().outlineStyleIsAuto();
+ child.setHasOutlineAutoAncestor(hasOutlineAuto);
+ bool childHasOutlineAuto = child.outlineStyleForRepaint().outlineStyleIsAuto();
if (childHasOutlineAuto)
continue;
if (!is<RenderElement>(child))
continue;
- downcast<RenderElement>(*child).updateOutlineAutoAncestor(hasOutlineAuto);
+ downcast<RenderElement>(child).updateOutlineAutoAncestor(hasOutlineAuto);
}
if (hasContinuation())
downcast<RenderBoxModelObject>(*this).continuation()->updateOutlineAutoAncestor(hasOutlineAuto);
Modified: trunk/Source/WebCore/rendering/RenderElement.h (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderElement.h 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2016-05-17 22:39:00 UTC (rev 201052)
@@ -278,7 +278,7 @@
void paintFocusRing(PaintInfo&, const RenderStyle&, const Vector<LayoutRect>& focusRingRects);
void paintOutline(PaintInfo&, const LayoutRect&);
- void updateOutlineAutoAncestor(bool hasOutlineAuto) const;
+ void updateOutlineAutoAncestor(bool hasOutlineAuto);
private:
RenderElement(ContainerNode&, RenderStyle&&, BaseTypeFlags);
Modified: trunk/Source/WebCore/rendering/RenderFieldset.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderFieldset.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderFieldset.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -29,6 +29,7 @@
#include "HTMLFieldSetElement.h"
#include "HTMLNames.h"
#include "PaintInfo.h"
+#include "RenderChildIterator.h"
namespace WebCore {
@@ -124,14 +125,14 @@
return &legend;
}
-RenderBox* RenderFieldset::findLegend(FindLegendOption option) const
+RenderBox* RenderFieldset::findLegend(FindLegendOption option)
{
- for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) {
- if (option == IgnoreFloatingOrOutOfFlow && legend->isFloatingOrOutOfFlowPositioned())
+ for (auto& legend : childrenOfType<RenderElement>(*this)) {
+ if (option == IgnoreFloatingOrOutOfFlow && legend.isFloatingOrOutOfFlowPositioned())
continue;
- if (is<HTMLLegendElement>(legend->node()))
- return downcast<RenderBox>(legend);
+ if (is<HTMLLegendElement>(legend.element()))
+ return &downcast<RenderBox>(legend);
}
return nullptr;
}
Modified: trunk/Source/WebCore/rendering/RenderFieldset.h (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderFieldset.h 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderFieldset.h 2016-05-17 22:39:00 UTC (rev 201052)
@@ -36,7 +36,7 @@
RenderFieldset(HTMLFieldSetElement&, RenderStyle&&);
enum FindLegendOption { IgnoreFloatingOrOutOfFlow, IncludeFloatingOrOutOfFlow };
- RenderBox* findLegend(FindLegendOption = IgnoreFloatingOrOutOfFlow) const;
+ RenderBox* findLegend(FindLegendOption = IgnoreFloatingOrOutOfFlow);
HTMLFieldSetElement& fieldSetElement() const { return downcast<HTMLFieldSetElement>(nodeForNonAnonymous()); }
Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderInline.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -32,6 +32,7 @@
#include "InlineTextBox.h"
#include "Page.h"
#include "RenderBlock.h"
+#include "RenderChildIterator.h"
#include "RenderFullScreen.h"
#include "RenderGeometryMap.h"
#include "RenderIterator.h"
@@ -670,14 +671,14 @@
bool isHorizontal = style().isHorizontalWritingMode();
- for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
- if (current->isFloatingOrOutOfFlowPositioned())
+ for (auto& current : childrenOfType<RenderObject>(*this)) {
+ if (current.isFloatingOrOutOfFlowPositioned())
continue;
-
+
// We want to get the margin box in the inline direction, and then use our font ascent/descent in the block
// direction (aligned to the root box's baseline).
- if (is<RenderBox>(*current)) {
- RenderBox& renderBox = downcast<RenderBox>(*current);
+ if (is<RenderBox>(current)) {
+ auto& renderBox = downcast<RenderBox>(current);
if (renderBox.inlineBoxWrapper()) {
const RootInlineBox& rootBox = renderBox.inlineBoxWrapper()->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
@@ -688,9 +689,9 @@
else
context.addRect(FloatRect(logicalTop, renderBox.inlineBoxWrapper()->y() - renderBox.marginTop(), logicalHeight, renderBox.height() + renderBox.verticalMarginExtent()));
}
- } else if (is<RenderInline>(*current)) {
+ } else if (is<RenderInline>(current)) {
// If the child doesn't need line boxes either, then we can recur.
- RenderInline& renderInline = downcast<RenderInline>(*current);
+ auto& renderInline = downcast<RenderInline>(current);
if (!renderInline.alwaysCreateLineBoxes())
renderInline.generateCulledLineBoxRects(context, container);
else {
@@ -712,8 +713,8 @@
}
}
}
- } else if (is<RenderText>(*current)) {
- RenderText& currText = downcast<RenderText>(*current);
+ } else if (is<RenderText>(current)) {
+ auto& currText = downcast<RenderText>(current);
for (InlineTextBox* childText = currText.firstTextBox(); childText; childText = childText->nextTextBox()) {
const RootInlineBox& rootBox = childText->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
@@ -724,8 +725,8 @@
else
context.addRect(FloatRect(logicalTop, childText->y(), logicalHeight, childText->logicalWidth()));
}
- } else if (is<RenderLineBreak>(*current)) {
- if (InlineBox* inlineBox = downcast<RenderLineBreak>(*current).inlineBoxWrapper()) {
+ } else if (is<RenderLineBreak>(current)) {
+ if (auto* inlineBox = downcast<RenderLineBreak>(current).inlineBoxWrapper()) {
// FIXME: This could use a helper to share these with text path.
const RootInlineBox& rootBox = inlineBox->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
@@ -1033,26 +1034,26 @@
InlineBox* RenderInline::culledInlineFirstLineBox() const
{
- for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
- if (current->isFloatingOrOutOfFlowPositioned())
+ for (auto& current : childrenOfType<RenderObject>(*this)) {
+ if (current.isFloatingOrOutOfFlowPositioned())
continue;
-
+
// We want to get the margin box in the inline direction, and then use our font ascent/descent in the block
// direction (aligned to the root box's baseline).
- if (is<RenderBox>(*current)) {
- const auto& renderBox = downcast<RenderBox>(*current);
+ if (is<RenderBox>(current)) {
+ auto& renderBox = downcast<RenderBox>(current);
if (renderBox.inlineBoxWrapper())
return renderBox.inlineBoxWrapper();
- } else if (is<RenderLineBreak>(*current)) {
- RenderLineBreak& renderBR = downcast<RenderLineBreak>(*current);
+ } else if (is<RenderLineBreak>(current)) {
+ auto& renderBR = downcast<RenderLineBreak>(current);
if (renderBR.inlineBoxWrapper())
return renderBR.inlineBoxWrapper();
- } else if (is<RenderInline>(*current)) {
- RenderInline& renderInline = downcast<RenderInline>(*current);
+ } else if (is<RenderInline>(current)) {
+ auto& renderInline = downcast<RenderInline>(current);
if (InlineBox* result = renderInline.firstLineBoxIncludingCulling())
return result;
- } else if (is<RenderText>(*current)) {
- RenderText& renderText = downcast<RenderText>(*current);
+ } else if (is<RenderText>(current)) {
+ auto& renderText = downcast<RenderText>(current);
if (renderText.firstTextBox())
return renderText.firstTextBox();
}
@@ -1096,13 +1097,13 @@
generateCulledLineBoxRects(context, this);
LayoutRect result(enclosingLayoutRect(floatResult));
bool isHorizontal = style().isHorizontalWritingMode();
- for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
- if (current->isFloatingOrOutOfFlowPositioned())
+ for (auto& current : childrenOfType<RenderObject>(*this)) {
+ if (current.isFloatingOrOutOfFlowPositioned())
continue;
-
+
// For overflow we just have to propagate by hand and recompute it all.
- if (is<RenderBox>(*current)) {
- RenderBox& renderBox = downcast<RenderBox>(*current);
+ if (is<RenderBox>(current)) {
+ auto& renderBox = downcast<RenderBox>(current);
if (!renderBox.hasSelfPaintingLayer() && renderBox.inlineBoxWrapper()) {
LayoutRect logicalRect = renderBox.logicalVisualOverflowRectForPropagation(&style());
if (isHorizontal) {
@@ -1113,17 +1114,17 @@
result.uniteIfNonZero(logicalRect.transposedRect());
}
}
- } else if (is<RenderInline>(*current)) {
+ } else if (is<RenderInline>(current)) {
// If the child doesn't need line boxes either, then we can recur.
- RenderInline& renderInline = downcast<RenderInline>(*current);
+ auto& renderInline = downcast<RenderInline>(current);
if (!renderInline.alwaysCreateLineBoxes())
result.uniteIfNonZero(renderInline.culledInlineVisualOverflowBoundingBox());
else if (!renderInline.hasSelfPaintingLayer())
result.uniteIfNonZero(renderInline.linesVisualOverflowBoundingBox());
- } else if (is<RenderText>(*current)) {
+ } else if (is<RenderText>(current)) {
// FIXME; Overflow from text boxes is lost. We will need to cache this information in
// InlineTextBoxes.
- RenderText& renderText = downcast<RenderText>(*current);
+ auto& renderText = downcast<RenderText>(current);
result.uniteIfNonZero(renderText.linesVisualOverflowBoundingBox());
}
}
@@ -1458,24 +1459,24 @@
if (!alwaysCreateLineBoxes()) {
// We have to grovel into our children in order to dirty the appropriate lines.
- for (RenderObject* current = firstChild(); current; current = current->nextSibling()) {
- if (current->isFloatingOrOutOfFlowPositioned())
+ for (auto& current : childrenOfType<RenderObject>(*this)) {
+ if (current.isFloatingOrOutOfFlowPositioned())
continue;
- if (is<RenderBox>(*current) && !current->needsLayout()) {
- RenderBox& renderBox = downcast<RenderBox>(*current);
+ if (is<RenderBox>(current) && !current.needsLayout()) {
+ auto& renderBox = downcast<RenderBox>(current);
if (renderBox.inlineBoxWrapper())
renderBox.inlineBoxWrapper()->root().markDirty();
- } else if (!current->selfNeedsLayout()) {
- if (is<RenderInline>(*current)) {
- RenderInline& renderInline = downcast<RenderInline>(*current);
+ } else if (!current.selfNeedsLayout()) {
+ if (is<RenderInline>(current)) {
+ auto& renderInline = downcast<RenderInline>(current);
for (InlineFlowBox* childLine = renderInline.firstLineBox(); childLine; childLine = childLine->nextLineBox())
childLine->root().markDirty();
- } else if (is<RenderText>(*current)) {
- RenderText& renderText = downcast<RenderText>(*current);
+ } else if (is<RenderText>(current)) {
+ auto& renderText = downcast<RenderText>(current);
for (InlineTextBox* childText = renderText.firstTextBox(); childText; childText = childText->nextTextBox())
childText->root().markDirty();
- } else if (is<RenderLineBreak>(*current)) {
- RenderLineBreak& renderBR = downcast<RenderLineBreak>(*current);
+ } else if (is<RenderLineBreak>(current)) {
+ auto& renderBR = downcast<RenderLineBreak>(current);
if (renderBR.inlineBoxWrapper())
renderBR.inlineBoxWrapper()->root().markDirty();
}
Modified: trunk/Source/WebCore/rendering/RenderListItem.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderListItem.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderListItem.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -30,6 +30,7 @@
#include "HTMLUListElement.h"
#include "InlineElementBox.h"
#include "PseudoElement.h"
+#include "RenderChildIterator.h"
#include "RenderInline.h"
#include "RenderListMarker.h"
#include "RenderMultiColumnFlowThread.h"
@@ -227,23 +228,23 @@
static RenderBlock* getParentOfFirstLineBox(RenderBlock& current, RenderObject& marker)
{
bool inQuirksMode = current.document().inQuirksMode();
- for (RenderObject* child = current.firstChild(); child; child = child->nextSibling()) {
- if (child == &marker)
+ for (auto& child : childrenOfType<RenderObject>(current)) {
+ if (&child == &marker)
continue;
- if (child->isInline() && (!is<RenderInline>(*child) || current.generatesLineBoxesForInlineChild(child)))
+ if (child.isInline() && (!is<RenderInline>(child) || current.generatesLineBoxesForInlineChild(&child)))
return ¤t;
- if (child->isFloating() || child->isOutOfFlowPositioned())
+ if (child.isFloating() || child.isOutOfFlowPositioned())
continue;
- if (is<RenderTable>(*child) || !is<RenderBlock>(*child) || (is<RenderBox>(*child) && downcast<RenderBox>(*child).isWritingModeRoot()))
+ if (is<RenderTable>(child) || !is<RenderBlock>(child) || (is<RenderBox>(child) && downcast<RenderBox>(child).isWritingModeRoot()))
break;
- if (is<RenderListItem>(current) && inQuirksMode && child->node() && isHTMLListElement(*child->node()))
+ if (is<RenderListItem>(current) && inQuirksMode && child.node() && isHTMLListElement(*child.node()))
break;
- if (RenderBlock* lineBox = getParentOfFirstLineBox(downcast<RenderBlock>(*child), marker))
+ if (RenderBlock* lineBox = getParentOfFirstLineBox(downcast<RenderBlock>(child), marker))
return lineBox;
}
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -47,6 +47,7 @@
#include "MainFrame.h"
#include "Page.h"
#include "PseudoElement.h"
+#include "RenderChildIterator.h"
#include "RenderCounter.h"
#include "RenderFlowThread.h"
#include "RenderGeometryMap.h"
@@ -168,12 +169,15 @@
{
setFlowThreadState(state);
- for (RenderObject* child = firstChildSlow(); child; child = child->nextSibling()) {
+ if (!is<RenderElement>(*this))
+ return;
+
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this))) {
// If the child is a fragmentation context it already updated the descendants flag accordingly.
- if (child->isRenderFlowThread())
+ if (child.isRenderFlowThread())
continue;
- ASSERT(state != child->flowThreadState());
- child->setFlowThreadStateIncludingDescendants(state);
+ ASSERT(state != child.flowThreadState());
+ child.setFlowThreadStateIncludingDescendants(state);
}
}
@@ -800,8 +804,12 @@
{
if (hasLayer())
result.unite(absoluteBoundingBoxRectIgnoringTransforms());
- for (RenderObject* current = firstChildSlow(); current; current = current->nextSibling())
- current->addAbsoluteRectForLayer(result);
+
+ if (!is<RenderElement>(*this))
+ return;
+
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this)))
+ child.addAbsoluteRectForLayer(result);
}
// FIXME: change this to use the subtreePaint terminology
@@ -809,8 +817,10 @@
{
LayoutRect result = absoluteBoundingBoxRectIgnoringTransforms();
topLevelRect = result;
- for (RenderObject* current = firstChildSlow(); current; current = current->nextSibling())
- current->addAbsoluteRectForLayer(result);
+ if (is<RenderElement>(*this)) {
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this)))
+ child.addAbsoluteRectForLayer(result);
+ }
return result;
}
@@ -1588,8 +1598,10 @@
if (isRenderFlowThread())
shouldUpdateState = false;
- for (RenderObject* child = firstChildSlow(); child; child = child->nextSibling())
- child->removeFromRenderFlowThreadIncludingDescendants(shouldUpdateState);
+ if (is<RenderElement>(*this)) {
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this)))
+ child.removeFromRenderFlowThreadIncludingDescendants(shouldUpdateState);
+ }
// We have to ask for our containing flow thread as it may be above the removed sub-tree.
RenderFlowThread* flowThreadContainingBlock = this->flowThreadContainingBlock();
@@ -1627,8 +1639,11 @@
if (flowThread)
flowThread->removeFlowChildInfo(this);
- for (RenderObject* child = firstChildSlow(); child; child = child->nextSibling())
- child->invalidateFlowThreadContainingBlockIncludingDescendants(flowThread);
+ if (!is<RenderElement>(*this))
+ return;
+
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this)))
+ child.invalidateFlowThreadContainingBlockIncludingDescendants(flowThread);
}
static void collapseAnonymousTableRowsIfNeeded(const RenderObject& rendererToBeDestroyed)
@@ -1723,8 +1738,12 @@
setIsDragging(dragOn);
if (valueChanged && node() && (style().affectedByDrag() || (is<Element>(*node()) && downcast<Element>(*node()).childrenAffectedByDrag())))
node()->setNeedsStyleRecalc();
- for (RenderObject* curr = firstChildSlow(); curr; curr = curr->nextSibling())
- curr->updateDragState(dragOn);
+
+ if (!is<RenderElement>(*this))
+ return;
+
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(*this)))
+ child.updateDragState(dragOn);
}
bool RenderObject::isComposited() const
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -35,6 +35,7 @@
#include "HTMLNames.h"
#include "HTMLTableElement.h"
#include "LayoutRepainter.h"
+#include "RenderChildIterator.h"
#include "RenderIterator.h"
#include "RenderLayer.h"
#include "RenderNamedFlowFragment.h"
@@ -879,12 +880,12 @@
RenderTableCol* RenderTable::firstColumn() const
{
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- if (is<RenderTableCol>(*child))
- return downcast<RenderTableCol>(child);
+ for (auto& child : childrenOfType<RenderObject>(*this)) {
+ if (is<RenderTableCol>(child))
+ return &const_cast<RenderTableCol&>(downcast<RenderTableCol>(child));
// We allow only table-captions before columns or column-groups.
- if (!is<RenderTableCaption>(*child))
+ if (!is<RenderTableCaption>(child))
return nullptr;
}
Modified: trunk/Source/WebCore/rendering/RenderTableCol.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderTableCol.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderTableCol.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -28,6 +28,7 @@
#include "HTMLNames.h"
#include "HTMLTableColElement.h"
+#include "RenderChildIterator.h"
#include "RenderIterator.h"
#include "RenderTable.h"
#include "RenderTableCaption.h"
@@ -131,8 +132,8 @@
{
setPreferredLogicalWidthsDirty(false);
- for (RenderObject* child = firstChild(); child; child = child->nextSibling())
- child->setPreferredLogicalWidthsDirty(false);
+ for (auto& child : childrenOfType<RenderObject>(*this))
+ child.setPreferredLogicalWidthsDirty(false);
}
RenderTable* RenderTableCol::table() const
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -29,6 +29,7 @@
#include "HitTestResult.h"
#include "HTMLNames.h"
#include "PaintInfo.h"
+#include "RenderChildIterator.h"
#include "RenderNamedFlowFragment.h"
#include "RenderTableCell.h"
#include "RenderTableCol.h"
@@ -570,11 +571,11 @@
bool flexAllChildren = cell->style().logicalHeight().isFixed()
|| (!table()->style().logicalHeight().isAuto() && rHeight != cell->logicalHeight());
- for (RenderObject* renderer = cell->firstChild(); renderer; renderer = renderer->nextSibling()) {
- if (!is<RenderText>(*renderer) && renderer->style().logicalHeight().isPercentOrCalculated() && (flexAllChildren || ((renderer->isReplaced() || (is<RenderBox>(*renderer) && downcast<RenderBox>(*renderer).scrollsOverflow())) && !is<RenderTextControl>(*renderer)))) {
+ for (auto& renderer : childrenOfType<RenderObject>(*cell)) {
+ if (!is<RenderText>(renderer) && renderer.style().logicalHeight().isPercentOrCalculated() && (flexAllChildren || ((renderer.isReplaced() || (is<RenderBox>(renderer) && downcast<RenderBox>(renderer).scrollsOverflow())) && !is<RenderTextControl>(renderer)))) {
// Tables with no sections do not flex.
- if (!is<RenderTable>(*renderer) || downcast<RenderTable>(*renderer).hasSections()) {
- renderer->setNeedsLayout(MarkOnlyThis);
+ if (!is<RenderTable>(renderer) || downcast<RenderTable>(renderer).hasSections()) {
+ renderer.setNeedsLayout(MarkOnlyThis);
cellChildrenFlex = true;
}
}
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -566,10 +566,10 @@
}
} else {
- for (RenderObject* child = downcast<RenderElement>(o).firstChild(); child; child = child->nextSibling()) {
- if (child->hasLayer())
+ for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(o))) {
+ if (child.hasLayer())
continue;
- write(ts, *child, indent + 1, behavior);
+ write(ts, child, indent + 1, behavior);
}
}
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -118,14 +118,14 @@
}
}
-static inline bool findPreviousAndNextAttributes(RenderElement* start, RenderSVGInlineText* locateElement, bool& stopAfterNext, SVGTextLayoutAttributes*& previous, SVGTextLayoutAttributes*& next)
+static inline bool findPreviousAndNextAttributes(RenderElement& start, RenderSVGInlineText* locateElement, bool& stopAfterNext, SVGTextLayoutAttributes*& previous, SVGTextLayoutAttributes*& next)
{
ASSERT(start);
ASSERT(locateElement);
// FIXME: Make this iterative.
- for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) {
- if (is<RenderSVGInlineText>(*child)) {
- RenderSVGInlineText& text = downcast<RenderSVGInlineText>(*child);
+ for (auto& child : childrenOfType<RenderObject>(start)) {
+ if (is<RenderSVGInlineText>(child)) {
+ auto& text = downcast<RenderSVGInlineText>(child);
if (locateElement != &text) {
if (stopAfterNext) {
next = text.layoutAttributes();
@@ -140,7 +140,7 @@
continue;
}
- if (!is<RenderSVGInline>(*child))
+ if (!is<RenderSVGInline>(child))
continue;
if (findPreviousAndNextAttributes(downcast<RenderElement>(child), locateElement, stopAfterNext, previous, next))
@@ -192,7 +192,7 @@
SVGTextLayoutAttributes* previous = 0;
SVGTextLayoutAttributes* next = 0;
ASSERT_UNUSED(child, &attributes->context() == child);
- findPreviousAndNextAttributes(this, &attributes->context(), stopAfterNext, previous, next);
+ findPreviousAndNextAttributes(*this, &attributes->context(), stopAfterNext, previous, next);
if (previous)
m_layoutAttributesBuilder.buildLayoutAttributesForTextRenderer(previous->context());
@@ -252,7 +252,7 @@
SVGTextLayoutAttributes* previous = nullptr;
SVGTextLayoutAttributes* next = nullptr;
if (!documentBeingDestroyed())
- findPreviousAndNextAttributes(this, &text, stopAfterNext, previous, next);
+ findPreviousAndNextAttributes(*this, &text, stopAfterNext, previous, next);
if (previous)
affectedAttributes.append(previous);
Modified: trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -26,6 +26,7 @@
#include "SVGRenderSupport.h"
#include "NodeRenderStyle.h"
+#include "RenderChildIterator.h"
#include "RenderElement.h"
#include "RenderGeometryMap.h"
#include "RenderIterator.h"
@@ -131,7 +132,7 @@
}
// Update a bounding box taking into account the validity of the other bounding box.
-static inline void updateObjectBoundingBox(FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBox)
+static inline void updateObjectBoundingBox(FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, const RenderObject* other, FloatRect otherBoundingBox)
{
bool otherValid = is<RenderSVGContainer>(*other) ? downcast<RenderSVGContainer>(*other).isObjectBoundingBoxValid() : true;
if (!otherValid)
@@ -155,21 +156,21 @@
// When computing the strokeBoundingBox, we use the repaintRects of the container's children so that the container's stroke includes
// the resources applied to the children (such as clips and filters). This allows filters applied to containers to correctly bound
// the children, and also improves inlining of SVG content, as the stroke bound is used in that situation also.
- for (RenderObject* current = container.firstChild(); current; current = current->nextSibling()) {
- if (current->isSVGHiddenContainer())
+ for (auto& current : childrenOfType<RenderObject>(container)) {
+ if (current.isSVGHiddenContainer())
continue;
// Don't include elements in the union that do not render.
- if (is<RenderSVGShape>(*current) && downcast<RenderSVGShape>(*current).isRenderingDisabled())
+ if (is<RenderSVGShape>(current) && downcast<RenderSVGShape>(current).isRenderingDisabled())
continue;
- const AffineTransform& transform = current->localToParentTransform();
+ const AffineTransform& transform = current.localToParentTransform();
if (transform.isIdentity()) {
- updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, current, current->objectBoundingBox());
- strokeBoundingBox.unite(current->repaintRectInLocalCoordinates());
+ updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, ¤t, current.objectBoundingBox());
+ strokeBoundingBox.unite(current.repaintRectInLocalCoordinates());
} else {
- updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, current, transform.mapRect(current->objectBoundingBox()));
- strokeBoundingBox.unite(transform.mapRect(current->repaintRectInLocalCoordinates()));
+ updateObjectBoundingBox(objectBoundingBox, objectBoundingBoxValid, ¤t, transform.mapRect(current.objectBoundingBox()));
+ strokeBoundingBox.unite(transform.mapRect(current.repaintRectInLocalCoordinates()));
}
}
@@ -247,58 +248,57 @@
bool needsBoundariesUpdate = start.needsBoundariesUpdate();
HashSet<RenderElement*> elementsThatDidNotReceiveLayout;
- for (RenderObject* child = start.firstChild(); child; child = child->nextSibling()) {
+ for (auto& child : childrenOfType<RenderObject>(start)) {
bool needsLayout = selfNeedsLayout;
- bool childEverHadLayout = child->everHadLayout();
+ bool childEverHadLayout = child.everHadLayout();
if (needsBoundariesUpdate && hasSVGShadow) {
// If we have a shadow, our shadow is baked into our children's cached boundaries,
// so they need to update.
- child->setNeedsBoundariesUpdate();
+ child.setNeedsBoundariesUpdate();
needsLayout = true;
}
if (transformChanged) {
// If the transform changed we need to update the text metrics (note: this also happens for layoutSizeChanged=true).
- if (is<RenderSVGText>(*child))
- downcast<RenderSVGText>(*child).setNeedsTextMetricsUpdate();
+ if (is<RenderSVGText>(child))
+ downcast<RenderSVGText>(child).setNeedsTextMetricsUpdate();
needsLayout = true;
}
- if (layoutSizeChanged) {
+ if (layoutSizeChanged && is<SVGElement>(child.node())) {
// When selfNeedsLayout is false and the layout size changed, we have to check whether this child uses relative lengths
- if (SVGElement* element = is<SVGElement>(*child->node()) ? downcast<SVGElement>(child->node()) : nullptr) {
- if (element->hasRelativeLengths()) {
- // When the layout size changed and when using relative values tell the RenderSVGShape to update its shape object
- if (is<RenderSVGShape>(*child))
- downcast<RenderSVGShape>(*child).setNeedsShapeUpdate();
- else if (is<RenderSVGText>(*child)) {
- RenderSVGText& svgText = downcast<RenderSVGText>(*child);
- svgText.setNeedsTextMetricsUpdate();
- svgText.setNeedsPositioningValuesUpdate();
- }
+ auto& element = downcast<SVGElement>(*child.node());
+ if (element.hasRelativeLengths()) {
+ // When the layout size changed and when using relative values tell the RenderSVGShape to update its shape object
+ if (is<RenderSVGShape>(child))
+ downcast<RenderSVGShape>(child).setNeedsShapeUpdate();
+ else if (is<RenderSVGText>(child)) {
+ auto& svgText = downcast<RenderSVGText>(child);
+ svgText.setNeedsTextMetricsUpdate();
+ svgText.setNeedsPositioningValuesUpdate();
+ }
- needsLayout = true;
- }
+ needsLayout = true;
}
}
if (needsLayout)
- child->setNeedsLayout(MarkOnlyThis);
+ child.setNeedsLayout(MarkOnlyThis);
- if (child->needsLayout()) {
- layoutDifferentRootIfNeeded(downcast<RenderElement>(*child));
- downcast<RenderElement>(*child).layout();
+ if (child.needsLayout()) {
+ layoutDifferentRootIfNeeded(downcast<RenderElement>(child));
+ downcast<RenderElement>(child).layout();
// Renderers are responsible for repainting themselves when changing, except
// for the initial paint to avoid potential double-painting caused by non-sensical "old" bounds.
// We could handle this in the individual objects, but for now it's easier to have
// parent containers call repaint(). (RenderBlock::layout* has similar logic.)
if (!childEverHadLayout)
- child->repaint();
- } else if (layoutSizeChanged && is<RenderElement>(*child))
- elementsThatDidNotReceiveLayout.add(downcast<RenderElement>(child));
+ child.repaint();
+ } else if (layoutSizeChanged && is<RenderElement>(child))
+ elementsThatDidNotReceiveLayout.add(&downcast<RenderElement>(child));
- ASSERT(!child->needsLayout());
+ ASSERT(!child.needsLayout());
}
if (!layoutSizeChanged) {
Modified: trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -20,6 +20,7 @@
#include "config.h"
#include "SVGTextLayoutAttributesBuilder.h"
+#include "RenderChildIterator.h"
#include "RenderSVGInline.h"
#include "RenderSVGInlineText.h"
#include "RenderSVGText.h"
@@ -98,16 +99,16 @@
{
ASSERT(!is<RenderSVGText>(start) || m_textPositions.isEmpty());
- for (RenderObject* child = start.firstChild(); child; child = child->nextSibling()) {
- if (is<RenderSVGInlineText>(*child)) {
- processRenderSVGInlineText(downcast<RenderSVGInlineText>(*child), m_textLength, lastCharacterWasSpace);
+ for (auto& child : childrenOfType<RenderObject>(start)) {
+ if (is<RenderSVGInlineText>(child)) {
+ processRenderSVGInlineText(downcast<RenderSVGInlineText>(child), m_textLength, lastCharacterWasSpace);
continue;
}
- if (!is<RenderSVGInline>(*child))
+ if (!is<RenderSVGInline>(child))
continue;
- RenderSVGInline& inlineChild = downcast<RenderSVGInline>(*child);
+ auto& inlineChild = downcast<RenderSVGInline>(child);
SVGTextPositioningElement* element = SVGTextPositioningElement::elementFromRenderer(inlineChild);
unsigned atPosition = m_textPositions.size();
Modified: trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp (201051 => 201052)
--- trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp 2016-05-17 22:34:45 UTC (rev 201051)
+++ trunk/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp 2016-05-17 22:39:00 UTC (rev 201052)
@@ -20,6 +20,7 @@
#include "config.h"
#include "SVGTextMetricsBuilder.h"
+#include "RenderChildIterator.h"
#include "RenderSVGInline.h"
#include "RenderSVGInlineText.h"
#include "RenderSVGText.h"
@@ -171,9 +172,9 @@
void SVGTextMetricsBuilder::walkTree(RenderElement& start, RenderSVGInlineText* stopAtLeaf, MeasureTextData* data)
{
- for (auto* child = start.firstChild(); child; child = child->nextSibling()) {
- if (is<RenderSVGInlineText>(*child)) {
- RenderSVGInlineText& text = downcast<RenderSVGInlineText>(*child);
+ for (auto& child : childrenOfType<RenderObject>(start)) {
+ if (is<RenderSVGInlineText>(child)) {
+ auto& text = downcast<RenderSVGInlineText>(child);
if (stopAtLeaf && stopAtLeaf != &text) {
data->processRenderer = false;
measureTextRenderer(text, data);
@@ -188,10 +189,10 @@
continue;
}
- if (!is<RenderSVGInline>(*child))
+ if (!is<RenderSVGInline>(child))
continue;
- walkTree(downcast<RenderSVGInline>(*child), stopAtLeaf, data);
+ walkTree(downcast<RenderSVGInline>(child), stopAtLeaf, data);
}
}