Title: [143757] trunk/Source/WebCore
Revision
143757
Author
[email protected]
Date
2013-02-22 11:09:51 -0800 (Fri, 22 Feb 2013)

Log Message

[New Multicolumn] Correctly track whether or not a layer is paginated.
https://bugs.webkit.org/show_bug.cgi?id=110625.

Taking the first step towards implementing the correct spec-compliant painting
model for the new multi-column layout. Add code to make sure the paginated
bits in RenderLayer get propagated correctly for the new layout.
        
The main difference in bit propagation between the old multicolumn layout and
the new multicolumn layout is that the old layout only tracked pagination "roots",
since it has a broken layer painting model. It incorrectly treats a pagination
"root" inside a multi-column block as establishing a stacking context in each
column. This is incorrect.
        
The new multicolumn code is going to paint each paginated layer individually,
and this means the bits can't just be about roots. Instead they have to be set
on every layer that may be split across columns, without regard for whether parent
layers are also split or not. This is actually a simpler bit propagation model
than the old code.

Reviewed by Beth Dakin.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositions):
Add code to set the m_isPaginated bit for in-flow RenderFlowThreads. This includes
only RenderMultiColumnFlowThread for now, but eventually it will also include
RenderPageFlowThread.

(WebCore::RenderLayer::useRegionBasedColumns):
Add a helper method to check if region-based columns are turned on, since we're
not attempting to alter the old column pagination model.

(WebCore::RenderLayer::updatePagination):
Added the code to propagate bits under the new model. Whether or not you're paginated
just depends on whether or not your enclosing layer along the containing block chain
is paginated.

(WebCore::RenderLayer::paintList):
(WebCore::RenderLayer::hitTestList):
Add code that avoids the old multi-column pagination model when the new column model
is enabled. For now there is no code in the new model that does anything with the bits,
but we're avoiding calling the old code, since it is broken for the new columns.

* rendering/RenderLayer.h:
(RenderLayer):
Added the useRegionBasedColumns method to check the Setting.

* rendering/RenderMultiColumnFlowThread.h:
* rendering/RenderObject.h:
(WebCore::RenderObject::isInFlowRenderFlowThread):
(RenderObject):
Implement isInFlowRenderFlowThread, a virtual function for asking if a renderer is
an in-flow RenderFlowThread, which means that it is going to need paginated layers
because the flow thread has to split across "pages" that do not establish stacking
contexts.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143756 => 143757)


--- trunk/Source/WebCore/ChangeLog	2013-02-22 19:01:12 UTC (rev 143756)
+++ trunk/Source/WebCore/ChangeLog	2013-02-22 19:09:51 UTC (rev 143757)
@@ -1,3 +1,60 @@
+2013-02-22  David Hyatt  <[email protected]>
+
+        [New Multicolumn] Correctly track whether or not a layer is paginated.
+        https://bugs.webkit.org/show_bug.cgi?id=110625.
+
+        Taking the first step towards implementing the correct spec-compliant painting
+        model for the new multi-column layout. Add code to make sure the paginated
+        bits in RenderLayer get propagated correctly for the new layout.
+        
+        The main difference in bit propagation between the old multicolumn layout and
+        the new multicolumn layout is that the old layout only tracked pagination "roots",
+        since it has a broken layer painting model. It incorrectly treats a pagination
+        "root" inside a multi-column block as establishing a stacking context in each
+        column. This is incorrect.
+        
+        The new multicolumn code is going to paint each paginated layer individually,
+        and this means the bits can't just be about roots. Instead they have to be set
+        on every layer that may be split across columns, without regard for whether parent
+        layers are also split or not. This is actually a simpler bit propagation model
+        than the old code.
+
+        Reviewed by Beth Dakin.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositions):
+        Add code to set the m_isPaginated bit for in-flow RenderFlowThreads. This includes
+        only RenderMultiColumnFlowThread for now, but eventually it will also include
+        RenderPageFlowThread.
+
+        (WebCore::RenderLayer::useRegionBasedColumns):
+        Add a helper method to check if region-based columns are turned on, since we're
+        not attempting to alter the old column pagination model.
+
+        (WebCore::RenderLayer::updatePagination):
+        Added the code to propagate bits under the new model. Whether or not you're paginated
+        just depends on whether or not your enclosing layer along the containing block chain
+        is paginated.
+
+        (WebCore::RenderLayer::paintList):
+        (WebCore::RenderLayer::hitTestList):
+        Add code that avoids the old multi-column pagination model when the new column model
+        is enabled. For now there is no code in the new model that does anything with the bits,
+        but we're avoiding calling the old code, since it is broken for the new columns.
+
+        * rendering/RenderLayer.h:
+        (RenderLayer):
+        Added the useRegionBasedColumns method to check the Setting.
+
+        * rendering/RenderMultiColumnFlowThread.h:
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isInFlowRenderFlowThread):
+        (RenderObject):
+        Implement isInFlowRenderFlowThread, a virtual function for asking if a renderer is
+        an in-flow RenderFlowThread, which means that it is going to need paginated layers
+        because the flow thread has to split across "pages" that do not establish stacking
+        contexts.
+
 2013-02-22  Bem Jones-Bey  <[email protected]>
 
         text-overflow:ellipsis is not applied when the block contains nested blocks

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (143756 => 143757)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-02-22 19:01:12 UTC (rev 143756)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2013-02-22 19:09:51 UTC (rev 143757)
@@ -448,6 +448,11 @@
         flags &= ~IsCompositingUpdateRoot;
 #endif
 
+    if (useRegionBasedColumns() && renderer()->isInFlowRenderFlowThread()) {
+        m_isPaginated = true;
+        flags |= UpdatePagination;
+    }
+    
     if (renderer()->hasColumns())
         flags |= UpdatePagination;
 
@@ -908,6 +913,12 @@
     return true;
 }
 
+bool RenderLayer::useRegionBasedColumns() const
+{
+    const Settings* settings = renderer()->document()->settings();
+    return settings && settings->regionBasedColumnsEnabled();
+}
+
 void RenderLayer::updatePagination()
 {
     m_isPaginated = false;
@@ -915,11 +926,42 @@
         return; // FIXME: We will have to deal with paginated compositing layers someday.
                 // FIXME: For now the RenderView can't be paginated.  Eventually printing will move to a model where it is though.
     
+    // The main difference between the paginated booleans for the old column code and the new column code
+    // is that each paginated layer has to paint on its own with the new code. There is no
+    // recurring into child layers. This means that the m_isPaginated bits for the new column code can't just be set on
+    // "roots" that get split and paint all their descendants. Instead each layer has to be checked individually and
+    // genuinely know if it is going to have to split itself up when painting only its contents (and not any other descendant
+    // layers).
+    bool newColumnsUsed = useRegionBasedColumns();
+    if (newColumnsUsed && renderer()->isInFlowRenderFlowThread()) {
+        m_isPaginated = true;
+        return;
+    }
+
     if (isNormalFlowOnly()) {
-        m_isPaginated = parent()->renderer()->hasColumns();
+        if (newColumnsUsed)
+            m_isPaginated = parent()->isPaginated();
+        else
+            m_isPaginated = parent()->renderer()->hasColumns();
         return;
     }
 
+    // For the new columns code, we want to walk up our containing block chain looking for an enclosing layer. Once
+    // we find one, then we just check its pagination status.
+    if (newColumnsUsed) {
+        RenderView* view = renderer()->view();
+        RenderBlock* containingBlock;
+        for (containingBlock = renderer()->containingBlock();
+             containingBlock && containingBlock != view;
+             containingBlock = containingBlock->containingBlock()) {
+            if (containingBlock->hasLayer()) {
+                m_isPaginated = containingBlock->layer()->isPaginated();
+                return;
+            }
+        }
+        return;
+    }
+
     // If we're not normal flow, then we need to look for a multi-column object between us and our stacking container.
     RenderLayer* ancestorStackingContainer = stackingContainer();
     for (RenderLayer* curr = parent(); curr; curr = curr->parent()) {
@@ -3860,7 +3902,7 @@
 
     for (size_t i = 0; i < list->size(); ++i) {
         RenderLayer* childLayer = list->at(i);
-        if (!childLayer->isPaginated())
+        if (!childLayer->isPaginated() || useRegionBasedColumns())
             childLayer->paintLayer(context, paintingInfo, paintFlags);
         else
             paintPaginatedChildLayer(childLayer, context, paintingInfo, paintFlags);
@@ -4365,7 +4407,7 @@
         RenderLayer* childLayer = list->at(i);
         RenderLayer* hitLayer = 0;
         HitTestResult tempResult(result.hitTestLocation());
-        if (childLayer->isPaginated())
+        if (childLayer->isPaginated() && !useRegionBasedColumns())
             hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestLocation, transformState, zOffsetForDescendants);
         else
             hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants);

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (143756 => 143757)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2013-02-22 19:01:12 UTC (rev 143756)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2013-02-22 19:09:51 UTC (rev 143757)
@@ -1004,6 +1004,9 @@
 
     void updatePagination();
     
+    // FIXME: Temporary. Remove when new columns come online.
+    bool useRegionBasedColumns() const;
+    
 #if USE(ACCELERATED_COMPOSITING)    
     bool hasCompositingDescendant() const { return m_hasCompositingDescendant; }
     void setHasCompositingDescendant(bool b)  { m_hasCompositingDescendant = b; }

Modified: trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h (143756 => 143757)


--- trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h	2013-02-22 19:01:12 UTC (rev 143756)
+++ trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.h	2013-02-22 19:09:51 UTC (rev 143757)
@@ -37,6 +37,8 @@
     ~RenderMultiColumnFlowThread();
 
 private:
+    virtual bool isInFlowRenderFlowThread() const OVERRIDE { return true; }
+
     virtual const char* renderName() const OVERRIDE;
     virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
 };

Modified: trunk/Source/WebCore/rendering/RenderObject.h (143756 => 143757)


--- trunk/Source/WebCore/rendering/RenderObject.h	2013-02-22 19:01:12 UTC (rev 143756)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2013-02-22 19:09:51 UTC (rev 143757)
@@ -380,7 +380,8 @@
 
     virtual bool isRenderFlowThread() const { return false; }
     virtual bool isRenderNamedFlowThread() const { return false; }
-    
+    virtual bool isInFlowRenderFlowThread() const { return false; }
+
     virtual bool isRenderMultiColumnBlock() const { return false; }
     virtual bool isRenderMultiColumnSet() const { return false; }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to