Diff
Modified: trunk/Source/WebCore/ChangeLog (155369 => 155370)
--- trunk/Source/WebCore/ChangeLog 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/ChangeLog 2013-09-09 19:21:53 UTC (rev 155370)
@@ -1,3 +1,65 @@
+2013-09-09 Antti Koivisto <[email protected]>
+
+ Make RenderView anonymous
+ https://bugs.webkit.org/show_bug.cgi?id=121013
+
+ Reviewed by Darin Adler and Dave Hyatt.
+
+ RenderView is currently the only renderer that has an associated Node that is not either Element or Text.
+ By making it anonymous (not have associated node, RenderView::node() returns null) we will be able to
+ significantly tighten typing in both render and DOM trees.
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::node):
+
+ We need to grab document() instead of node() in a few places for RenderViews to keep existing code
+ behaving like it did.
+
+ * inspector/InspectorLayerTreeAgent.cpp:
+ (WebCore::InspectorLayerTreeAgent::buildObjectForLayer):
+
+ Don't tell inspector that the root layer is anonymous for now to avoid changing behavior.
+
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::nodeForHitTest):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::canBeProgramaticallyScrolled):
+
+ The old non-virtual RenderView test renderer->node == &renderer->document() does not work anymore.
+ Switch to isRenderView() which is now non-virtual in a number of places.
+
+ (WebCore::RenderBox::canAutoscroll):
+ (WebCore::RenderBox::findAutoscrollable):
+ (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isRenderReplaced):
+ (WebCore::RenderObject::isAnonymousBlock):
+
+ RenderView is anonymous but not a CSS anonymous block.
+
+ (WebCore::RenderObject::isText):
+ (WebCore::RenderObject::isRenderView):
+
+ Make isRenderView non-virtual since it is now hot. Reuse existing bits.
+
+ (WebCore::RenderObject::setIsText):
+ (WebCore::RenderObject::setIsRenderView):
+ (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::writeSelection):
+ * rendering/RenderView.cpp:
+
+ Make anonymous.
+
+ (WebCore::RenderView::RenderView):
+ * rendering/RenderView.h:
+ * rendering/svg/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
+
2013-09-09 Bem Jones-Bey <[email protected]>
Move logical(Left|Right)FloatOffsetForLine methods into FloatingObjects
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (155369 => 155370)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -671,10 +671,14 @@
}
Node* AccessibilityRenderObject::node() const
-{
- return m_renderer ? m_renderer->node() : 0;
+{
+ if (!m_renderer)
+ return 0;
+ if (m_renderer->isRenderView())
+ return &m_renderer->document();
+ return m_renderer->node();
}
-
+
String AccessibilityRenderObject::stringValue() const
{
if (!m_renderer)
Modified: trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp (155369 => 155370)
--- trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/inspector/InspectorLayerTreeAgent.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -167,7 +167,9 @@
bool isGenerated = (isReflection ? renderer->parent() : renderer)->isBeforeOrAfterContent();
bool isAnonymous = renderer->isAnonymous();
- if (isReflection && isGenerated)
+ if (renderer->isRenderView())
+ node = &renderer->document();
+ else if (isReflection && isGenerated)
node = renderer->parent()->generatingNode();
else if (isGenerated)
node = renderer->generatingNode();
@@ -200,7 +202,8 @@
layerObject->setPseudoElement("after");
}
- if (isAnonymous) {
+ // FIXME: RenderView is now really anonymous but don't tell about it to the frontend before making sure it can handle it.
+ if (isAnonymous && !renderer->isRenderView()) {
layerObject->setIsAnonymous(true);
if (RenderStyle* style = renderer->style()) {
if (style->styleType() == FIRST_LETTER)
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -5165,6 +5165,8 @@
// If we are in the margins of block elements that are part of a
// continuation we're actually still inside the enclosing element
// that was split. Use the appropriate inner node.
+ if (isRenderView())
+ return &document();
return isAnonymousBlockContinuation() ? continuation()->node() : node();
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -801,8 +801,7 @@
bool RenderBox::canBeProgramaticallyScrolled() const
{
- Node* node = this->node();
- if (node && node->isDocumentNode())
+ if (isRenderView())
return true;
if (!hasOverflowClip())
@@ -812,6 +811,7 @@
if (scrollsOverflow() && hasScrollableOverflow)
return true;
+ Node* node = this->node();
return node && node->rendererIsEditable();
}
@@ -829,7 +829,7 @@
// There are two kinds of renderer that can autoscroll.
bool RenderBox::canAutoscroll() const
{
- if (node() && node()->isDocumentNode())
+ if (isRenderView())
return view().frameView().isScrollable();
// Check for a box that can be scrolled in its own right.
@@ -862,7 +862,7 @@
RenderBox* RenderBox::findAutoscrollable(RenderObject* renderer)
{
while (renderer && !(renderer->isBox() && toRenderBox(renderer)->canAutoscroll())) {
- if (!renderer->parent() && renderer->node() == &renderer->document() && renderer->document().ownerElement())
+ if (renderer->isRenderView() && renderer->document().ownerElement())
renderer = renderer->document().ownerElement()->renderer();
else
renderer = renderer->parent();
@@ -2843,7 +2843,7 @@
case Calculated:
{
RenderObject* cb = isOutOfFlowPositioned() ? container() : containingBlock();
- while (cb->isAnonymous()) {
+ while (cb->isAnonymous() && !cb->isRenderView()) {
cb = cb->containingBlock();
toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderBox*>(this));
}
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -228,7 +228,7 @@
// Anonymous block boxes are ignored when resolving percentage values that would refer to it:
// the closest non-anonymous ancestor box is used instead.
RenderBlock* cb = containingBlock();
- while (cb->isAnonymous())
+ while (cb->isAnonymous() && !cb->isRenderView())
cb = cb->containingBlock();
// Matching RenderBox::percentageLogicalHeightIsResolvableFromBlock() by
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -1568,7 +1568,7 @@
if (renderer().isRenderRegion())
return false;
- if (renderer().node() && renderer().node()->isDocumentNode()) {
+ if (renderer().isRenderView()) {
// Look to see if the root object has a non-simple background
RenderObject* rootObject = renderer().document().documentElement() ? renderer().document().documentElement()->renderer() : 0;
if (!rootObject)
Modified: trunk/Source/WebCore/rendering/RenderObject.h (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderObject.h 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2013-09-09 19:21:53 UTC (rev 155370)
@@ -358,7 +358,6 @@
virtual bool isRenderPart() const { return false; }
virtual bool isRenderRegion() const { return false; }
virtual bool isRenderReplaced() const { return false; }
- virtual bool isRenderView() const { return false; }
virtual bool isReplica() const { return false; }
virtual bool isRuby() const { return false; }
@@ -521,7 +520,7 @@
// RenderBlock::createAnonymousBlock(). This includes creating an anonymous
// RenderBlock having a BLOCK or BOX display. Other classes such as RenderTextFragment
// are not RenderBlocks and will return false. See https://bugs.webkit.org/show_bug.cgi?id=56709.
- return isAnonymous() && (style()->display() == BLOCK || style()->display() == BOX) && style()->styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread()
+ return isAnonymous() && (style()->display() == BLOCK || style()->display() == BOX) && style()->styleType() == NOPSEUDO && isRenderBlock() && !isListMarker() && !isRenderFlowThread() && !isRenderView()
#if ENABLE(FULLSCREEN_API)
&& !isRenderFullScreen()
&& !isRenderFullScreenPlaceholder()
@@ -546,8 +545,9 @@
bool isStickyPositioned() const { return m_bitfields.isStickyPositioned(); }
bool isPositioned() const { return m_bitfields.isPositioned(); }
- bool isText() const { return m_bitfields.isText(); }
+ bool isText() const { return !m_bitfields.isBox() && m_bitfields.isTextOrRenderView(); }
bool isBox() const { return m_bitfields.isBox(); }
+ bool isRenderView() const { return m_bitfields.isBox() && m_bitfields.isTextOrRenderView(); }
bool isInline() const { return m_bitfields.isInline(); } // inline object
bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object
bool isDragging() const { return m_bitfields.isDragging(); }
@@ -680,8 +680,9 @@
void invalidateBackgroundObscurationStatus();
virtual bool computeBackgroundIsKnownToBeObscured() { return false; }
- void setIsText() { m_bitfields.setIsText(true); }
+ void setIsText() { ASSERT(!isBox()); m_bitfields.setIsTextOrRenderView(true); }
void setIsBox() { m_bitfields.setIsBox(true); }
+ void setIsRenderView() { ASSERT(isBox()); m_bitfields.setIsTextOrRenderView(true); }
void setReplaced(bool b = true) { m_bitfields.setIsReplaced(b); }
void setHorizontalWritingMode(bool b = true) { m_bitfields.setHorizontalWritingMode(b); }
void setHasOverflowClip(bool b = true) { m_bitfields.setHasOverflowClip(b); }
@@ -1075,7 +1076,7 @@
, m_preferredLogicalWidthsDirty(false)
, m_floating(false)
, m_isAnonymous(!node)
- , m_isText(false)
+ , m_isTextOrRenderView(false)
, m_isBox(false)
, m_isInline(true)
, m_isReplaced(false)
@@ -1106,7 +1107,7 @@
ADD_BOOLEAN_BITFIELD(floating, Floating);
ADD_BOOLEAN_BITFIELD(isAnonymous, IsAnonymous);
- ADD_BOOLEAN_BITFIELD(isText, IsText);
+ ADD_BOOLEAN_BITFIELD(isTextOrRenderView, IsTextOrRenderView);
ADD_BOOLEAN_BITFIELD(isBox, IsBox);
ADD_BOOLEAN_BITFIELD(isInline, IsInline);
ADD_BOOLEAN_BITFIELD(isReplaced, IsReplaced);
Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -835,14 +835,12 @@
return result.toString();
}
-static void writeSelection(TextStream& ts, const RenderObject* o)
+static void writeSelection(TextStream& ts, const RenderObject* renderer)
{
- Node* n = o->node();
- if (!n || !n->isDocumentNode())
+ if (!renderer->isRenderView())
return;
- Document* doc = toDocument(n);
- Frame* frame = doc->frame();
+ Frame* frame = renderer->document().frame();
if (!frame)
return;
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -57,7 +57,7 @@
namespace WebCore {
RenderView::RenderView(Document* document)
- : RenderBlockFlow(document)
+ : RenderBlockFlow(0)
, m_frameView(*document->view())
, m_selectionStart(0)
, m_selectionEnd(0)
@@ -75,6 +75,9 @@
, m_hasSoftwareFilters(false)
#endif
{
+ setIsRenderView();
+ setDocumentForAnonymous(document);
+
// FIXME: We should find a way to enforce this at compile time.
ASSERT(document->view());
Modified: trunk/Source/WebCore/rendering/RenderView.h (155369 => 155370)
--- trunk/Source/WebCore/rendering/RenderView.h 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/RenderView.h 2013-09-09 19:21:53 UTC (rev 155370)
@@ -53,8 +53,6 @@
virtual const char* renderName() const OVERRIDE { return "RenderView"; }
- virtual bool isRenderView() const OVERRIDE { return true; }
-
virtual bool requiresLayer() const OVERRIDE { return true; }
virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE;
Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (155369 => 155370)
--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2013-09-09 19:19:15 UTC (rev 155369)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp 2013-09-09 19:21:53 UTC (rev 155370)
@@ -185,7 +185,7 @@
if (height.isPercent()) {
RenderBlock* cb = containingBlock();
ASSERT(cb);
- while (cb->isAnonymous()) {
+ while (cb->isAnonymous() && !cb->isRenderView()) {
cb = cb->containingBlock();
cb->addPercentHeightDescendant(const_cast<RenderSVGRoot*>(this));
}