[CSS Regions] Elements in a region should be assignable to a named flow
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2013 17:15:09 +0000 (17:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Apr 2013 17:15:09 +0000 (17:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74144

Patch by Mihai Maerean <mmaerean@adobe.com> on 2013-04-05
Reviewed by David Hyatt.

Source/WebCore:

DOM children of a region must not be rendered as children of the region, but can be collected in flow threads.

NodeRenderingContext::parentRenderer now creates the parent render flow thread if it doesn't exist.

Element::moveToFlowThreadIsNeeded is a virtual method that is overriden in PseudoElement to return false and
in SVGElement so only svg root elements can directly be collected by a render flow thread.

RenderObject::canDOMChildrenHaveRenderParent exists to optimize the code so nodes inside regions (and maybe
other types of renderers in the future) can still have renderers if they need to be in a flow thread while the
rest of renderers that can't have children skip the new instructions.

Tests: fast/regions/flow-body-in-html.html . To test the duplicate bug #103685.
       fast/regions/region-content-flown-into-region.html
       fast/regions/universal-selector-children-to-the-same-region.html . To test the duplicate bug #103685.

* dom/Element.cpp:
(WebCore::Element::moveToFlowThreadIsNeeded):
* dom/Element.h:
* dom/NodeRenderingContext.cpp:
(WebCore::NodeRenderingContext::parentRenderer): the renderer that will be the parent for this node's renderer.
In the case of RenderFlowThreads, it may need to create it.
(WebCore::NodeRenderingContext::shouldCreateRenderer): In a region, only the children that need to be in a flow
thread should have a renderer.
(WebCore::NodeRenderingContext::moveToFlowThreadIfNeeded):
(WebCore::NodeRenderingContext::moveToFlowThread):
* dom/NodeRenderingContext.h:
(NodeRenderingContext):
* dom/PseudoElement.h: pseudo-elements cannot be directly collected into a named flow.
* dom/Text.cpp:
(WebCore::Text::textRendererIsNeeded):
(WebCore::Text::updateTextRenderer): Because calling textRendererIsNeeded(NodeRenderingContext(...)) on a
non-const l-value NodeRenderingContext cannot be done on a temporary object on the stack.
* dom/Text.h:
* rendering/FlowThreadController.cpp:
(WebCore::FlowThreadController::isContentNodeRegisteredWithAnyNamedFlow):
* rendering/FlowThreadController.h:
* rendering/RenderObject.h:
(WebCore::RenderObject::canDOMChildrenHaveRenderParent): Even if this render object can't have render children,
the children in the DOM tree may have a render parent (that is different from this render object).
* rendering/RenderRegion.h:
* svg/SVGElement.cpp:
(WebCore::SVGElement::moveToFlowThreadIsNeeded): Allow only svg root elements to be directly collected by a
render flow thread.
* svg/SVGElement.h:
(SVGElement):

LayoutTests:

* fast/regions/flow-body-in-html-expected.txt: Added.
* fast/regions/flow-body-in-html.html: Added. To test the duplicate bug #103685.
* fast/regions/region-content-flown-into-region-expected.html: Added.
* fast/regions/region-content-flown-into-region.html: Added.
* fast/regions/universal-selector-children-to-the-same-region-expected.txt: Added.
* fast/regions/universal-selector-children-to-the-same-region.html: Added. To test the duplicate bug #103685.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147756 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/regions/flow-body-in-html-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/flow-body-in-html.html [new file with mode: 0644]
LayoutTests/fast/regions/region-content-flown-into-region-expected.html [new file with mode: 0644]
LayoutTests/fast/regions/region-content-flown-into-region.html [new file with mode: 0644]
LayoutTests/fast/regions/universal-selector-children-to-the-same-region-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/universal-selector-children-to-the-same-region.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/NodeRenderingContext.cpp
Source/WebCore/dom/NodeRenderingContext.h
Source/WebCore/dom/PseudoElement.h
Source/WebCore/dom/Text.cpp
Source/WebCore/dom/Text.h
Source/WebCore/rendering/FlowThreadController.cpp
Source/WebCore/rendering/FlowThreadController.h
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderRegion.h
Source/WebCore/svg/SVGElement.cpp
Source/WebCore/svg/SVGElement.h

index a654505..f45f9d6 100644 (file)
@@ -1,3 +1,17 @@
+2013-04-05  Mihai Maerean  <mmaerean@adobe.com>
+
+        [CSS Regions] Elements in a region should be assignable to a named flow
+        https://bugs.webkit.org/show_bug.cgi?id=74144
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/flow-body-in-html-expected.txt: Added.
+        * fast/regions/flow-body-in-html.html: Added. To test the duplicate bug #103685.
+        * fast/regions/region-content-flown-into-region-expected.html: Added.
+        * fast/regions/region-content-flown-into-region.html: Added.
+        * fast/regions/universal-selector-children-to-the-same-region-expected.txt: Added.
+        * fast/regions/universal-selector-children-to-the-same-region.html: Added. To test the duplicate bug #103685.
+
 2013-04-05  Aivo Paas  <aivopaas@gmail.com>
 
         Updating mouse cursor on style changes without emitting fake mousemove event
diff --git a/LayoutTests/fast/regions/flow-body-in-html-expected.txt b/LayoutTests/fast/regions/flow-body-in-html-expected.txt
new file mode 100644 (file)
index 0000000..ae50fbd
--- /dev/null
@@ -0,0 +1,2 @@
+PASS: the body tag has flow-into while the html has flow-from.
+Bug 74144 - [CSS Regions] Elements in a region should be assignable to a named flow
diff --git a/LayoutTests/fast/regions/flow-body-in-html.html b/LayoutTests/fast/regions/flow-body-in-html.html
new file mode 100644 (file)
index 0000000..47584d9
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+  <head>
+    <title>103685 - [CSS Regions] Universal child selector on region breaks the rendering of its content</title>
+    <style type="text/css">
+      body {
+      -webkit-flow-into: foo;
+      }
+      html {
+       -webkit-flow-from: foo;
+      }
+    </style>
+    <script type="text/javascript">
+        if (window.testRunner)
+            testRunner.dumpAsText()
+    </script>
+  </head>
+  <body>
+      PASS: the body tag has flow-into while the html has flow-from.
+
+      <p><a href="https://bugs.webkit.org/show_bug.cgi?id=74144">Bug 74144</a> - [CSS Regions] Elements in a region should be assignable to a named flow</p>
+  </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/regions/region-content-flown-into-region-expected.html b/LayoutTests/fast/regions/region-content-flown-into-region-expected.html
new file mode 100644 (file)
index 0000000..3ca6aa6
--- /dev/null
@@ -0,0 +1,23 @@
+<html>
+    <head>
+        <style type="text/css">
+            div {
+                padding: 1px;
+            }
+            .region {
+                border:solid 1px #bbb;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="region"><template>PASS r0: content that goes in the region.</template></div>
+        <div class="region">
+            <div>PASS r1: content in the region that has flow-into. 1.</div>
+            <div>PASS r1: (enclosed in a div) content in the region that has flow-into. 2. <b>PASS r1: (enclosed in a div) content in the region that has flow-into. 3.</b>.</div>
+            <div>PASS r1: (enclosed in a div) content in the region that has flow-into. 4 .</div>
+            <div>PASS r1: content in the region that has flow-into. 5.</div>
+        </div>
+        <div class="region"><span>PASS r2: content that is already in a flow goes to another flow .</span></div>
+        <p><a href="https://bugs.webkit.org/show_bug.cgi?id=74144">Bug 74144</a> - [CSS Regions] Elements in a region should be assignable to a named flow</p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/regions/region-content-flown-into-region.html b/LayoutTests/fast/regions/region-content-flown-into-region.html
new file mode 100644 (file)
index 0000000..4a37d8d
--- /dev/null
@@ -0,0 +1,92 @@
+<html>
+    <head>
+        <title>74144 - [CSS Regions] Elements in a region should be assignable to a named flow</title>
+        <style type="text/css">
+            div {
+                padding: 1px;
+            }
+            .content {
+                -webkit-flow-into: flow;
+            }
+            .region {
+                -webkit-flow-from: flow;
+                border:solid 1px #bbb;
+            }
+
+            .redirectContent {
+                -webkit-flow-into: redirectFlow;
+            }
+            .redirectRegion {
+                -webkit-flow-from: redirectFlow;
+                border:solid 1px #bbb;
+            }
+
+            .redirectContent2 {
+                -webkit-flow-into: redirectFlow2;
+            }
+            .redirectRegion2 {
+                -webkit-flow-from: redirectFlow2;
+                border:solid 1px #bbb;
+            }
+
+            .redirectContentToNowhere {
+                -webkit-flow-into: redirectToNowhere;
+            }
+        </style>
+        <template class="content">PASS r0: content that goes in the region.</template>
+    </head>
+
+    <body>
+        <div class="region">
+            FAIL: this should not be visible 1.
+
+            <span class="redirectContentToNowhere">FAIL: this should not be visible (redirected to nowhere) 1.</span>
+
+            <div class="redirectContent">PASS r1: content in the region that has flow-into. 1.</div>
+
+            FAIL: this should not be visible 2.
+
+            <div>
+                FAIL: this should not be visible 3.
+
+                <div class="redirectContent">PASS r1: (enclosed in a div) content in the region that has flow-into. 2.
+                    <div class="redirectContentToNowhere">FAIL: this should not be visible (redirected to nowhere) 2.</div>
+                    <b>PASS r1: (enclosed in a div) content in the region that has flow-into. 3.</b>.
+                </div>
+
+                FAIL: this should not be visible 4.
+            </div>
+
+            <div>
+                FAIL: this should not be visible 5.
+
+                <div class="redirectContent">PASS r1: (enclosed in a div) content in the region that has flow-into. 4
+                    <span class="redirectContent2">PASS r2: content that is already in a flow goes to another flow
+                        <span class="redirectContentToNowhere">FAIL: this should not be visible (redirected to nowhere) 3.</span>.
+                    </span>
+                    .
+                </div>
+
+                FAIL: this should not be visible 7.
+            </div>
+
+            FAIL: this should not be visible 8.
+
+            <span class="redirectContentToNowhere">FAIL: this should not be visible (redirected to nowhere) 4.</span>
+
+            <div class="redirectContent">PASS r1: content in the region that has flow-into. 5.</div>
+
+            FAIL: this should not be visible 9.
+        </div>
+
+        <div class="redirectRegion">
+            FAIL: this should not be visible 10.
+        </div>
+
+        <div class="redirectRegion2">
+            FAIL: this should not be visible 11.
+        </div>
+
+        <p><a href="https://bugs.webkit.org/show_bug.cgi?id=74144">Bug 74144</a> - [CSS Regions] Elements in a region should be assignable to a named flow</p>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/regions/universal-selector-children-to-the-same-region-expected.txt b/LayoutTests/fast/regions/universal-selector-children-to-the-same-region-expected.txt
new file mode 100644 (file)
index 0000000..3281249
--- /dev/null
@@ -0,0 +1,5 @@
+PASS: this is inline
+PASS: and block content inside a region that is flowed into the same region
+
+PASS: button
+Bug 74144 - [CSS Regions] Elements in a region should be assignable to a named flow
diff --git a/LayoutTests/fast/regions/universal-selector-children-to-the-same-region.html b/LayoutTests/fast/regions/universal-selector-children-to-the-same-region.html
new file mode 100644 (file)
index 0000000..f8c161f
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+  <head>
+    <title>103685 - [CSS Regions] Universal child selector on region breaks the rendering of its content</title>
+    <style type="text/css">
+      .region > * {
+      -webkit-flow-into: foo;
+      }
+      .region {
+       -webkit-flow-from: foo;
+      }
+    </style>
+    <script type="text/javascript">
+        if (window.testRunner)
+            testRunner.dumpAsText()
+    </script>
+  </head>
+  <body>
+      <div class="region"><span>PASS: this is inline</span><div><p>PASS: and block content inside a region that is flowed into the same region</p></div><button>PASS: button</button></div>
+      <p><a href="https://bugs.webkit.org/show_bug.cgi?id=74144">Bug 74144</a> - [CSS Regions] Elements in a region should be assignable to a named flow</p>
+  </body>
+</html>
\ No newline at end of file
index 422af76..c12e4b1 100644 (file)
@@ -1,3 +1,56 @@
+2013-04-05  Mihai Maerean  <mmaerean@adobe.com>
+
+        [CSS Regions] Elements in a region should be assignable to a named flow
+        https://bugs.webkit.org/show_bug.cgi?id=74144
+
+        Reviewed by David Hyatt.
+
+        DOM children of a region must not be rendered as children of the region, but can be collected in flow threads.
+
+        NodeRenderingContext::parentRenderer now creates the parent render flow thread if it doesn't exist.
+
+        Element::moveToFlowThreadIsNeeded is a virtual method that is overriden in PseudoElement to return false and
+        in SVGElement so only svg root elements can directly be collected by a render flow thread.
+
+        RenderObject::canDOMChildrenHaveRenderParent exists to optimize the code so nodes inside regions (and maybe
+        other types of renderers in the future) can still have renderers if they need to be in a flow thread while the
+        rest of renderers that can't have children skip the new instructions.
+
+        Tests: fast/regions/flow-body-in-html.html . To test the duplicate bug #103685.
+               fast/regions/region-content-flown-into-region.html
+               fast/regions/universal-selector-children-to-the-same-region.html . To test the duplicate bug #103685.
+
+        * dom/Element.cpp:
+        (WebCore::Element::moveToFlowThreadIsNeeded):
+        * dom/Element.h:
+        * dom/NodeRenderingContext.cpp:
+        (WebCore::NodeRenderingContext::parentRenderer): the renderer that will be the parent for this node's renderer.
+        In the case of RenderFlowThreads, it may need to create it.
+        (WebCore::NodeRenderingContext::shouldCreateRenderer): In a region, only the children that need to be in a flow
+        thread should have a renderer.
+        (WebCore::NodeRenderingContext::moveToFlowThreadIfNeeded):
+        (WebCore::NodeRenderingContext::moveToFlowThread):
+        * dom/NodeRenderingContext.h:
+        (NodeRenderingContext):
+        * dom/PseudoElement.h: pseudo-elements cannot be directly collected into a named flow.
+        * dom/Text.cpp:
+        (WebCore::Text::textRendererIsNeeded):
+        (WebCore::Text::updateTextRenderer): Because calling textRendererIsNeeded(NodeRenderingContext(...)) on a
+        non-const l-value NodeRenderingContext cannot be done on a temporary object on the stack.
+        * dom/Text.h:
+        * rendering/FlowThreadController.cpp:
+        (WebCore::FlowThreadController::isContentNodeRegisteredWithAnyNamedFlow):
+        * rendering/FlowThreadController.h:
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::canDOMChildrenHaveRenderParent): Even if this render object can't have render children,
+        the children in the DOM tree may have a render parent (that is different from this render object).
+        * rendering/RenderRegion.h:
+        * svg/SVGElement.cpp:
+        (WebCore::SVGElement::moveToFlowThreadIsNeeded): Allow only svg root elements to be directly collected by a
+        render flow thread.
+        * svg/SVGElement.h:
+        (SVGElement):
+
 2013-04-05  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Fix GCC with C++11 build
index b895402..818ef29 100644 (file)
@@ -2558,6 +2558,32 @@ RenderRegion* Element::renderRegion() const
     return 0;
 }
 
+bool Element::moveToFlowThreadIsNeeded(RefPtr<RenderStyle>& cachedStyle)
+{
+    Document* doc = document();
+    
+    if (!doc->cssRegionsEnabled())
+        return false;
+
+#if ENABLE(FULLSCREEN_API)
+    if (doc->webkitIsFullScreen() && doc->webkitCurrentFullScreenElement() == this)
+        return false;
+#endif
+
+    if (isInShadowTree())
+        return false;
+
+    if (!cachedStyle)
+        cachedStyle = styleForRenderer();
+    if (!cachedStyle)
+        return false;
+
+    if (cachedStyle->flowThread().isEmpty())
+        return false;
+
+    return !document()->renderView()->flowThreadController()->isContentNodeRegisteredWithAnyNamedFlow(this);
+}
+
 #if ENABLE(CSS_REGIONS)
 
 const AtomicString& Element::webkitRegionOverset() const
index 514f580..d0c8fec 100644 (file)
@@ -609,6 +609,7 @@ public:
     PassRefPtr<RenderStyle> styleForRenderer();
 
     RenderRegion* renderRegion() const;
+    virtual bool moveToFlowThreadIsNeeded(RefPtr<RenderStyle>& cachedStyle);
 #if ENABLE(CSS_REGIONS)
     const AtomicString& webkitRegionOverset() const;
     Vector<RefPtr<Range> > webkitGetRegionFlowRanges() const;
index e84c5e4..fd61b4e 100644 (file)
@@ -148,7 +148,7 @@ RenderObject* NodeRenderingContext::previousRenderer() const
     return 0;
 }
 
-RenderObject* NodeRenderingContext::parentRenderer() const
+RenderObject* NodeRenderingContext::parentRenderer()
 {
     if (RenderObject* renderer = m_node->renderer())
         return renderer->parent();
@@ -170,10 +170,15 @@ RenderObject* NodeRenderingContext::parentRenderer() const
     if (m_parentFlowRenderer)
         return m_parentFlowRenderer;
 
+    if (m_node->isElementNode() && toElement(m_node)->moveToFlowThreadIsNeeded(m_style)) {
+        moveToFlowThread();
+        return m_parentFlowRenderer;
+    }
+
     return m_renderingParent ? m_renderingParent->renderer() : 0;
 }
 
-bool NodeRenderingContext::shouldCreateRenderer() const
+bool NodeRenderingContext::shouldCreateRenderer()
 {
     if (!m_node->document()->shouldCreateRenderers())
         return false;
@@ -182,8 +187,16 @@ bool NodeRenderingContext::shouldCreateRenderer() const
     RenderObject* parentRenderer = this->parentRenderer();
     if (!parentRenderer)
         return false;
-    if (!parentRenderer->canHaveChildren())
-        return false;
+    if (!parentRenderer->canHaveChildren()) {
+        if (parentRenderer->canDOMChildrenHaveRenderParent()) {
+            // In a region, only the children that need to be in a flow thread should have a renderer.
+            bool shouldBeInNamedFlow = m_node->isElementNode() && toElement(m_node)->moveToFlowThreadIsNeeded(m_style);
+            if (!shouldBeInNamedFlow)
+                return false;
+        } else
+            return false;
+    }
+
     if (!m_renderingParent->childShouldCreateRenderer(*this))
         return false;
     return true;
@@ -192,35 +205,21 @@ bool NodeRenderingContext::shouldCreateRenderer() const
 void NodeRenderingContext::moveToFlowThreadIfNeeded()
 {
     ASSERT(m_node->isElementNode());
-    ASSERT(m_style);
-    if (!m_node->document()->cssRegionsEnabled())
-        return;
-
-    if (m_style->flowThread().isEmpty())
-        return;
-
-    // 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 (m_node->isPseudoElement())
-        return;
 
-    // FIXME: Do not collect elements if they are in shadow tree.
-    if (m_node->isInShadowTree())
+    if (!toElement(m_node)->moveToFlowThreadIsNeeded(m_style))
         return;
 
-#if ENABLE(FULLSCREEN_API)
-    Document* document = m_node->document();
-    if (document->webkitIsFullScreen() && document->webkitCurrentFullScreenElement() == m_node)
-        return;
-#endif
+    moveToFlowThread();
+}
 
-#if ENABLE(SVG)
-    // Allow only svg root elements to be directly collected by a render flow thread.
-    if (m_node->isSVGElement()
-        && (!(m_node->hasTagName(SVGNames::svgTag) && m_node->parentNode() && !m_node->parentNode()->isSVGElement())))
-        return;
-#endif
+void NodeRenderingContext::moveToFlowThread()
+{
+    ASSERT(m_node->isElementNode());
+    ASSERT(toElement(m_node)->moveToFlowThreadIsNeeded(m_style));
 
+    if (!m_style)
+        m_style = toElement(m_node)->styleForRenderer();
+    ASSERT(m_style);
     m_flowThread = m_style->flowThread();
     ASSERT(m_node->document()->renderView());
     FlowThreadController* flowThreadController = m_node->document()->renderView()->flowThreadController();
index c079776..c146b11 100644 (file)
@@ -55,7 +55,7 @@ public:
     Node* node() const;
     ContainerNode* parentNodeForRenderingAndStyle() const;
     bool resetStyleInheritance() const;
-    RenderObject* parentRenderer() const;
+    RenderObject* parentRenderer(); // the renderer that will be the parent for this node's renderer. In the case of RenderFlowThreads, it may need to create it.
     RenderObject* nextRenderer() const;
     RenderObject* previousRenderer() const;
     InsertionPoint* insertionPoint() const;
@@ -66,7 +66,8 @@ public:
     bool isOnEncapsulationBoundary() const;
 
 private:
-    bool shouldCreateRenderer() const;
+    bool shouldCreateRenderer();
+    void moveToFlowThread();
     void moveToFlowThreadIfNeeded();
 
     Node* m_node;
index 12a2a20..f07251b 100644 (file)
@@ -46,6 +46,14 @@ public:
     virtual void attach() OVERRIDE;
     virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE;
 
+    // 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.
+    virtual bool moveToFlowThreadIsNeeded(RefPtr<RenderStyle>& cachedStyle) OVERRIDE
+    {
+        UNUSED_PARAM(cachedStyle);
+        return false;
+    }
+
     virtual bool canStartSelection() const OVERRIDE { return false; }
     virtual bool canContainRangeEndPoint() const OVERRIDE { return false; }
 
index dbf35a4..283b8d5 100644 (file)
@@ -197,7 +197,7 @@ PassRefPtr<Node> Text::cloneNode(bool /*deep*/)
     return create(document(), data());
 }
 
-bool Text::textRendererIsNeeded(const NodeRenderingContext& context)
+bool Text::textRendererIsNeeded(NodeRenderingContext& context)
 {
     if (isEditingText())
         return true;
@@ -302,7 +302,12 @@ void Text::updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfRe
     if (!attached())
         return;
     RenderText* textRenderer = toRenderText(renderer());
-    if (!textRenderer || !textRendererIsNeeded(NodeRenderingContext(this, textRenderer->style()))) {
+    if (!textRenderer) {
+        reattach();
+        return;
+    }
+    NodeRenderingContext renderingContext(this, textRenderer->style());
+    if (!textRendererIsNeeded(renderingContext)) {
         reattach();
         return;
     }
index 67ab168..97153d3 100644 (file)
@@ -46,7 +46,7 @@ public:
     
     void recalcTextStyle(StyleChange);
     void createTextRendererIfNeeded();
-    bool textRendererIsNeeded(const NodeRenderingContext&);
+    bool textRendererIsNeeded(NodeRenderingContext&);
     RenderText* createTextRenderer(RenderArena*, RenderStyle*);
     void updateTextRenderer(unsigned offsetOfReplacedData, unsigned lengthOfReplacedData);
 
index 62bb35e..df14c33 100644 (file)
@@ -227,6 +227,11 @@ void FlowThreadController::updateFlowThreadsIntoConstrainedPhase()
     }
 }
 
+bool FlowThreadController::isContentNodeRegisteredWithAnyNamedFlow(Node* contentNode) const
+{
+    return m_mapNamedFlowContentNodes.contains(contentNode);
+}
+
 #ifndef NDEBUG
 bool FlowThreadController::isAutoLogicalHeightRegionsCountConsistent() const
 {
index cf55104..45534d5 100644 (file)
@@ -66,6 +66,7 @@ public:
 
     void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*);
     void unregisterNamedFlowContentNode(Node*);
+    bool isContentNodeRegisteredWithAnyNamedFlow(Node*) const;
 
     bool hasFlowThreadsWithAutoLogicalHeightRegions() const { return m_flowThreadsWithAutoLogicalHeightRegions; }
     void incrementFlowThreadsWithAutoLogicalHeightRegions() { ++m_flowThreadsWithAutoLogicalHeightRegions; }
index b5a7da4..96a38b5 100644 (file)
@@ -257,6 +257,7 @@ public:
     // RenderObject tree manipulation
     //////////////////////////////////////////
     virtual bool canHaveChildren() const { return virtualChildren(); }
+    virtual bool canDOMChildrenHaveRenderParent() const { return false; } // Even if this render object can't have render children, the children in the DOM tree may have a render parent (that is different from this object).
     virtual bool canHaveGeneratedChildren() const;
     virtual bool isChildAllowed(RenderObject*, RenderStyle*) const { return true; }
     virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
index e03d220..1d6f652 100644 (file)
@@ -145,6 +145,7 @@ private:
     virtual const char* renderName() const { return "RenderRegion"; }
 
     virtual bool canHaveChildren() const OVERRIDE { return false; }
+    virtual bool canDOMChildrenHaveRenderParent() const OVERRIDE { return true; }
 
     virtual void insertedIntoTree() OVERRIDE;
     virtual void willBeRemovedFromTree() OVERRIDE;
index eaf8bc9..50811bb 100644 (file)
@@ -452,6 +452,12 @@ static bool hasLoadListener(Element* element)
     return false;
 }
 
+bool SVGElement::moveToFlowThreadIsNeeded(RefPtr<RenderStyle>& cachedStyle)
+{
+    // Allow only svg root elements to be directly collected by a render flow thread.
+    return parentNode() && !parentNode()->isSVGElement() && hasTagName(SVGNames::svgTag) && Element::moveToFlowThreadIsNeeded(cachedStyle);
+}
+
 void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents)
 {
     RefPtr<SVGElement> currentTarget = this;
index db74c29..bce46ea 100644 (file)
@@ -120,6 +120,8 @@ public:
     virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) OVERRIDE;
     virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture) OVERRIDE;
 
+    virtual bool moveToFlowThreadIsNeeded(RefPtr<RenderStyle>& cachedStyle) OVERRIDE;
+
 protected:
     SVGElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement);