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

Unified Diff: Source/core/rendering/RenderBlockFlow.h

Issue 166033009: *** FOR PROTOTYPE PURPOSES ONLY! NOT INTENDED FOR COMMIT! *** (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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
Index: Source/core/rendering/RenderBlockFlow.h
diff --git a/Source/core/rendering/RenderBlockFlow.h b/Source/core/rendering/RenderBlockFlow.h
index 7f81b0a9dca2f99c535552e34070c1c2713b36e1..d534008e8765717206496e1af7348be6c8c12443 100644
--- a/Source/core/rendering/RenderBlockFlow.h
+++ b/Source/core/rendering/RenderBlockFlow.h
@@ -41,12 +41,20 @@
#include "core/rendering/line/TrailingObjects.h"
#include "core/rendering/style/RenderStyleConstants.h"
+// This define globally controls whether we use recursion or not for layout. The
+// default is recursion and all layout tests pass with this patch and this default.
+// Right now, if you switch to non-recursion I still have ~500 failures, but the
+// vast majority of tests that exercise this code are passing.
+#define NON_RECURSIVE 0
+
namespace WebCore {
class MarginInfo;
+class LayoutStateMaintainer;
class LineBreaker;
class LineWidth;
class RenderNamedFlowFragment;
+class SubtreeLayoutScope;
class RenderBlockFlow : public RenderBlock {
public:
@@ -58,7 +66,14 @@ public:
virtual bool isRenderBlockFlow() const OVERRIDE FINAL { return true; }
+#if NON_RECURSIVE
+ virtual bool isNonRecursiveLayout() const OVERRIDE { return true; }
+#else
+ virtual bool isNonRecursiveLayout() const OVERRIDE { return false; }
+#endif
virtual void layoutBlock(bool relayoutChildren) OVERRIDE;
+ virtual void preLayoutBlock(bool relayoutChildren, bool traverseChildren) OVERRIDE;
+ virtual bool postLayoutBlock() OVERRIDE;
virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false) OVERRIDE;
virtual void deleteLineBoxTree() OVERRIDE FINAL;
@@ -255,10 +270,13 @@ protected:
virtual void insertedIntoTree() OVERRIDE;
virtual void willBeDestroyed() OVERRIDE;
private:
- bool layoutBlockFlow(bool relayoutChildren, LayoutUnit& pageLogicalHeight, SubtreeLayoutScope&);
- void layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloatLogicalBottom, SubtreeLayoutScope&, LayoutUnit beforeEdge, LayoutUnit afterEdge);
+ void preLayoutBlockFlow(bool traverseChildren);
+ bool postLayoutBlockFlow();
+ bool preLayoutBlockChild(RenderBox* child, bool& skipChildren);
+ void postLayoutBlockChild(RenderBox* child);
+
+ void layoutBlockChildren(LayoutUnit beforeEdge, LayoutUnit afterEdge, bool traverseChildren);
- void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFloatLogicalBottom, LayoutUnit& maxFloatLogicalBottom);
void adjustPositionedBlock(RenderBox* child, const MarginInfo&);
void adjustFloatingBlock(const MarginInfo&);
@@ -521,7 +539,42 @@ private:
// END METHODS DEFINED IN RenderBlockLineLayout
-
+private:
+ // Here we have the state that was previously held on the stack and now needs
+ // to be held somewhere else. I've put the state as member variables of this
+ // class, but most likely we'd need to put them in LayoutState or something
+ // very similar. Each subclass will have its own needs so perhaps we'll need
+ // LayoutState inner class that each RenderObject can subclass and override
+ // or something.
+ // FIXME: Figure out the best way to manage this state for this class and the
+ // other various subclasses that switch to non-recursive layout.
+
+ // Used by (pre/post)layoutBlockFlow and friends
+ SubtreeLayoutScope* m_layoutScope;
+ LayoutStateMaintainer* m_statePusher;
+ bool m_hasSpecifiedPageLogicalHeight;
+ bool m_checkForRepaint;
+ bool m_relayoutChildren;
+ LayoutRect m_oldBounds;
+ LayoutRect m_oldOutlineBox;
+ LayoutUnit m_pageLogicalHeight;
+ LayoutUnit m_heightBeforeLayout;
+ LayoutUnit m_previousFloatLogicalBottom;
+ LayoutUnit m_maxFloatLogicalBottom;
+ RenderBox* m_lastNormalFlowChild;
+ MarginInfo* m_marginInfo;
+
+ // Used by (pre/post) layoutBlockChild and friends
+ RenderObject* m_childToExclude;
+ SubtreeLayoutScope* m_childLayoutScope;
+ LayoutUnit m_oldPosMarginBefore;
+ LayoutUnit m_oldNegMarginBefore;
+ LayoutUnit m_estimateWithoutPagination;
+ LayoutUnit m_logicalTopEstimate;
+ LayoutRect m_oldRect;
+ LayoutSize m_oldLayoutDelta;
+ bool m_childHadLayout;
+ bool m_childNeededLayout;
esprehn 2014/02/15 00:35:43 This is huge, I don't think you can make RenderBlo
atreat 2014/02/18 16:03:57 No, of course not. That is why I said in the comm
};
DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow());

Powered by Google App Engine
This is Rietveld 408576698