Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Unified Diff: Source/core/dom/RenderTreeBuilder.cpp

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/RenderTreeBuilder.h ('k') | Source/core/dom/WebKitNamedFlow.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/RenderTreeBuilder.cpp
diff --git a/Source/core/dom/RenderTreeBuilder.cpp b/Source/core/dom/RenderTreeBuilder.cpp
index c0b15ee8ff3ddecdbda4f73d9041c64f8124a511..ba8f1bbaeaac0b9460eb1006fdf18444a8600b70 100644
--- a/Source/core/dom/RenderTreeBuilder.cpp
+++ b/Source/core/dom/RenderTreeBuilder.cpp
@@ -33,9 +33,7 @@
#include "core/dom/FullscreenElementStack.h"
#include "core/dom/Node.h"
#include "core/dom/Text.h"
-#include "core/rendering/FlowThreadController.h"
#include "core/rendering/RenderFullScreen.h"
-#include "core/rendering/RenderNamedFlowThread.h"
#include "core/rendering/RenderObject.h"
#include "core/rendering/RenderText.h"
#include "core/rendering/RenderView.h"
@@ -57,9 +55,6 @@ RenderObject* RenderTreeBuilder::nextRenderer() const
return 0;
}
- if (m_parentFlowRenderer)
- return m_parentFlowRenderer->nextRendererForNode(m_node);
-
// Avoid an O(N^2) walk over the children when reattaching all children of a node.
if (m_renderingParent->needsAttach())
return 0;
@@ -88,13 +83,6 @@ RenderObject* RenderTreeBuilder::parentRenderer() const
return m_node->document().renderView();
}
- // Even if the normal parent has no renderer we still can be flowed into a named flow.
- // FIXME: This is bad, it breaks the assumption that if you have a renderer then
- // NodeRenderingTraversal::parent(this) also has one which likely means lots of bugs
- // with regions.
- if (m_parentFlowRenderer)
- return m_parentFlowRenderer;
-
return m_renderingParent->renderer();
}
@@ -115,72 +103,6 @@ bool RenderTreeBuilder::shouldCreateRenderer() const
return true;
}
-// Check the specific case of elements that are children of regions but are flowed into a flow thread themselves.
-bool RenderTreeBuilder::elementInsideRegionNeedsRenderer()
-{
- if (!RuntimeEnabledFeatures::cssRegionsEnabled())
- return false;
- Element& element = toElement(*m_node);
- RenderObject* parentRenderer = this->parentRenderer();
- if ((parentRenderer && !parentRenderer->canHaveChildren() && parentRenderer->isRenderNamedFlowFragmentContainer())
- || (!parentRenderer && element.parentElement() && element.parentElement()->isInsideRegion())) {
-
- // Children of this element will only be allowed to be flowed into other flow-threads if display is NOT none.
- if (element.rendererIsNeeded(style()))
- element.setIsInsideRegion(true);
-
- return shouldMoveToFlowThread();
- }
-
- return false;
-}
-
-bool RenderTreeBuilder::shouldMoveToFlowThread() const
-{
- Element& element = toElement(*m_node);
- RenderStyle& style = this->style();
-
- if (style.flowThread().isEmpty())
- return false;
-
- if (FullscreenElementStack::isActiveFullScreenElement(&element))
- return false;
-
- if (element.isInShadowTree())
- return false;
-
- // As per http://dev.w3.org/csswg/css3-regions/#flow-into, pseudo-elements such as
- // ::first-line, ::first-letter, ::before or ::after cannot be directly collected
- // into a named flow.
- if (element.isPseudoElement())
- return false;
-
- // Allow only svg root elements to be directly collected by a render flow thread.
- if (element.isSVGElement()) {
- if (!element.hasTagName(SVGNames::svgTag))
- return false;
- if (!element.parentNode())
- return false;
- if (element.parentNode()->isSVGElement())
- return false;
- }
-
- return !element.isRegisteredWithNamedFlow();
-}
-
-void RenderTreeBuilder::moveToFlowThreadIfNeeded()
-{
- if (!RuntimeEnabledFeatures::cssRegionsEnabled())
- return;
-
- if (!shouldMoveToFlowThread())
- return;
-
- FlowThreadController* flowThreadController = m_node->document().renderView()->flowThreadController();
- m_parentFlowRenderer = flowThreadController->ensureRenderFlowThreadWithName(style().flowThread());
- flowThreadController->registerNamedFlowContentNode(m_node, m_parentFlowRenderer);
-}
-
RenderStyle& RenderTreeBuilder::style() const
{
if (!m_style)
@@ -198,11 +120,9 @@ void RenderTreeBuilder::createRendererForElementIfNeeded()
Element* element = toElement(m_node);
- if (!shouldCreateRenderer() && !elementInsideRegionNeedsRenderer())
+ if (!shouldCreateRenderer())
return;
- moveToFlowThreadIfNeeded();
-
RenderStyle& style = this->style();
if (!element->rendererIsNeeded(style))
@@ -219,10 +139,6 @@ void RenderTreeBuilder::createRendererForElementIfNeeded()
return;
}
- // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
- // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
- newRenderer->setFlowThreadState(parentRenderer->flowThreadState());
-
RenderObject* nextRenderer = this->nextRenderer();
element->setRenderer(newRenderer);
newRenderer->setAnimatableStyle(&style); // setAnimatableStyle() can depend on renderer() already being set.
@@ -265,10 +181,6 @@ void RenderTreeBuilder::createRendererForTextIfNeeded()
return;
}
- // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
- // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
- newRenderer->setFlowThreadState(parentRenderer->flowThreadState());
-
RenderObject* nextRenderer = this->nextRenderer();
textNode->setRenderer(newRenderer);
// Parent takes care of the animations, no need to call setAnimatableStyle.
« no previous file with comments | « Source/core/dom/RenderTreeBuilder.h ('k') | Source/core/dom/WebKitNamedFlow.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698