Diff
Modified: trunk/Source/WebCore/ChangeLog (95572 => 95573)
--- trunk/Source/WebCore/ChangeLog 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/ChangeLog 2011-09-20 22:23:41 UTC (rev 95573)
@@ -1,3 +1,30 @@
+2011-09-20 David Hyatt <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=68480
+
+ De-virtualize containingBlock() and make RenderView return 0 instead
+ of itself to make the construction of normal loops that terminate via
+ a null-check possible.
+
+ Fix the only two places in the tree that needed null checks.
+
+ Eliminating RenderTableCell::containingBlock() is fine since the base class
+ does the same thing anyway.
+
+ Reviewed by Simon Fraser.
+
+ * editing/VisiblePosition.cpp:
+ (WebCore::VisiblePosition::lineDirectionPointForBlockDirectionNavigation):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::containingBlock):
+ * rendering/RenderObject.h:
+ * rendering/RenderTableCell.cpp:
+ * rendering/RenderTableCell.h:
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::RenderTreeAsText::writeRenderObject):
+ * rendering/RenderView.cpp:
+ * rendering/RenderView.h:
+
2011-09-20 Anders Carlsson <[email protected]>
Remove ScrollView::platformContentsSize
Modified: trunk/Source/WebCore/editing/VisiblePosition.cpp (95572 => 95573)
--- trunk/Source/WebCore/editing/VisiblePosition.cpp 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/editing/VisiblePosition.cpp 2011-09-20 22:23:41 UTC (rev 95573)
@@ -607,7 +607,10 @@
// without consulting transforms, so that 'up' in transformed text is 'up'
// relative to the text, not absolute 'up'.
FloatPoint caretPoint = renderer->localToAbsolute(localRect.location());
- return renderer->containingBlock()->isHorizontalWritingMode() ? caretPoint.x() : caretPoint.y();
+ RenderObject* containingBlock = renderer->containingBlock();
+ if (!containingBlock)
+ containingBlock = renderer; // Just use ourselves to determine the writing mode if we have no containing block.
+ return containingBlock->isHorizontalWritingMode() ? caretPoint.x() : caretPoint.y();
}
#ifndef NDEBUG
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2011-09-20 22:23:41 UTC (rev 95573)
@@ -636,9 +636,6 @@
RenderBlock* RenderObject::containingBlock() const
{
- ASSERT(!isTableCell());
- ASSERT(!isRenderView());
-
RenderObject* o = parent();
if (!isText() && m_style->position() == FixedPosition) {
while (o && !o->isRenderView() && !(o->hasTransform() && o->isRenderBlock()))
Modified: trunk/Source/WebCore/rendering/RenderObject.h (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderObject.h 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2011-09-20 22:23:41 UTC (rev 95573)
@@ -600,7 +600,7 @@
void setStyleInternal(PassRefPtr<RenderStyle>);
// returns the containing block level element for this element.
- virtual RenderBlock* containingBlock() const;
+ RenderBlock* containingBlock() const;
// Convert the given local point to absolute coordinates
// FIXME: Temporary. If useTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware.
Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp 2011-09-20 22:23:41 UTC (rev 95573)
@@ -319,13 +319,6 @@
setHasBoxDecorations(true);
}
-RenderBlock* RenderTableCell::containingBlock() const
-{
- if (parent() && section())
- return table();
- return 0;
-}
-
// The following rules apply for resolving conflicts and figuring out which border
// to use.
// (1) Borders with the 'border-style' of 'hidden' take precedence over all other conflicting
Modified: trunk/Source/WebCore/rendering/RenderTableCell.h (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderTableCell.h 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderTableCell.h 2011-09-20 22:23:41 UTC (rev 95573)
@@ -137,8 +137,6 @@
virtual bool isTableCell() const { return true; }
- virtual RenderBlock* containingBlock() const;
-
virtual void willBeDestroyed();
virtual void computeLogicalWidth();
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2011-09-20 22:23:41 UTC (rev 95573)
@@ -246,7 +246,8 @@
}
}
- bool adjustForTableCells = o.containingBlock()->isTableCell();
+ RenderBlock* cb = o.containingBlock();
+ bool adjustForTableCells = cb ? cb->isTableCell() : false;
IntRect r;
if (o.isText()) {
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2011-09-20 22:23:41 UTC (rev 95573)
@@ -265,11 +265,6 @@
return true;
}
-RenderBlock* RenderView::containingBlock() const
-{
- return const_cast<RenderView*>(this);
-}
-
void RenderView::repaintViewRectangle(const IntRect& ur, bool immediate)
{
if (!shouldRepaint(ur))
Modified: trunk/Source/WebCore/rendering/RenderView.h (95572 => 95573)
--- trunk/Source/WebCore/rendering/RenderView.h 2011-09-20 22:16:36 UTC (rev 95572)
+++ trunk/Source/WebCore/rendering/RenderView.h 2011-09-20 22:23:41 UTC (rev 95573)
@@ -193,8 +193,6 @@
private:
bool shouldRepaint(const IntRect& r) const;
-
- virtual RenderBlock* containingBlock() const;
// These functions may only be accessed by LayoutStateMaintainer.
void pushLayoutState(RenderFlowThread*);