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

Side by Side Diff: sky/engine/core/rendering/RenderBlockFlow.h

Issue 763043002: Remove RenderBlockLineLayout (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: review Created 6 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2003-2013 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * Copyright (C) 2013 Google Inc. All rights reserved. 7 * Copyright (C) 2013 Google Inc. All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are 10 * modification, are permitted provided that the following conditions are
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 using RenderBlock::firstRootBox; 96 using RenderBlock::firstRootBox;
97 using RenderBlock::lastRootBox; 97 using RenderBlock::lastRootBox;
98 98
99 virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, Layout Unit position) override; 99 virtual LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, Layout Unit position) override;
100 virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, Layou tUnit position) override; 100 virtual LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, Layou tUnit position) override;
101 101
102 RootInlineBox* createAndAppendRootInlineBox(); 102 RootInlineBox* createAndAppendRootInlineBox();
103 103
104 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override; 104 virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
105 105
106 bool generatesLineBoxesForInlineChild(RenderObject*);
107
108 LayoutUnit startAlignedOffsetForLine(bool shouldIndentText); 106 LayoutUnit startAlignedOffsetForLine(bool shouldIndentText);
107 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount);
109 108
110 void setStaticInlinePositionForChild(RenderBox*, LayoutUnit inlinePosition); 109 void setStaticInlinePositionForChild(RenderBox*, LayoutUnit inlinePosition);
111 void updateStaticInlinePositionForChild(RenderBox*); 110 void updateStaticInlinePositionForChild(RenderBox*);
112 111
113 static bool shouldSkipCreatingRunsForObject(RenderObject* obj) 112 static bool shouldSkipCreatingRunsForObject(RenderObject* obj)
114 { 113 {
115 return obj->isOutOfFlowPositioned() && !obj->style()->isOriginalDisplayI nlineType() && !obj->container()->isRenderInline(); 114 return obj->isOutOfFlowPositioned() && !obj->style()->isOriginalDisplayI nlineType() && !obj->container()->isRenderInline();
116 } 115 }
117 116
118 // FIXME: This should be const to avoid a const_cast, but can modify child d irty bits
119 void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, Layout Unit& maxLogicalWidth);
120
121 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 117 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& root BlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
122 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo*); 118 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& las tLogicalRight, const PaintInfo*);
123 119
124 protected: 120 protected:
125 void layoutInlineChildren(bool relayoutChildren, LayoutUnit& paintInvalidati onLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit afterEdge); 121 virtual void layoutChildren(bool relayoutChildren, SubtreeLayoutScope&, Layo utUnit& paintInvalidationLogicalTop, LayoutUnit& paintInvalidationLogicalBottom, LayoutUnit beforeEdge, LayoutUnit afterEdge);
126 122
127 virtual bool updateLogicalWidthAndColumnWidth() override; 123 virtual bool updateLogicalWidthAndColumnWidth() override;
128 124
129 void determineLogicalLeftPositionForChild(RenderBox* child); 125 void determineLogicalLeftPositionForChild(RenderBox* child);
130 126
131 private: 127 private:
132 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&); 128 void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&);
133 void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutU nit beforeEdge, LayoutUnit afterEdge);
134 129
135 void layoutBlockChild(RenderBox* child); 130 void layoutBlockChild(RenderBox* child);
136 void adjustPositionedBlock(RenderBox* child); 131 void adjustPositionedBlock(RenderBox* child);
137 132
138 virtual void invalidatePaintForOverflow() override final; 133 virtual void invalidatePaintForOverflow() override final;
139 134
140 RootInlineBox* createRootInlineBox(); 135 RootInlineBox* createRootInlineBox();
141 136
142 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount);
143
144 public: 137 public:
145 struct FloatWithRect { 138 struct FloatWithRect {
146 FloatWithRect(RenderBox* f) 139 FloatWithRect(RenderBox* f)
147 : object(f) 140 : object(f)
148 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(), f->width() + f->marginWidth(), f->height() + f->marginHeight())) 141 , rect(LayoutRect(f->x() - f->marginLeft(), f->y() - f->marginTop(), f->width() + f->marginWidth(), f->height() + f->marginHeight()))
149 , everHadLayout(f->everHadLayout()) 142 , everHadLayout(f->everHadLayout())
150 { 143 {
151 } 144 }
152 145
153 RenderBox* object; 146 RenderBox* object;
154 LayoutRect rect; 147 LayoutRect rect;
155 bool everHadLayout; 148 bool everHadLayout;
156 }; 149 };
157 150
158 protected:
159 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
160 private: 151 private:
161 LayoutUnit m_paintInvalidationLogicalTop; 152 LayoutUnit m_paintInvalidationLogicalTop;
162 LayoutUnit m_paintInvalidationLogicalBottom; 153 LayoutUnit m_paintInvalidationLogicalBottom;
163 154
164 protected: 155 protected:
165 friend class BreakingContext; // FIXME: It uses insertFloatingObject and pos itionNewFloatOnLine, if we move those out from the private scope/add a helper to LineBreaker, we can remove this friend 156 friend class BreakingContext; // FIXME: It uses insertFloatingObject and pos itionNewFloatOnLine, if we move those out from the private scope/add a helper to LineBreaker, we can remove this friend
166 friend class LineBreaker; 157 friend class LineBreaker;
167
168 // FIXME-BLOCKFLOW: These methods have implementations in
169 // RenderBlockLineLayout. They should be moved to the proper header once the
170 // line layout code is separated from RenderBlock and RenderBlockFlow.
171 // START METHODS DEFINED IN RenderBlockLineLayout
172 private:
173 InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* ch ildBox);
174 RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
175 void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAnd FallbackFontsMap&, VerticalPositionCache&, WordMeasurements&);
176 BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const Lin eInfo&, ETextAlign, float& logicalLeft,
177 float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceR un, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache&, Wo rdMeasurements&);
178 void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOv erflowAndFallbackFontsMap&, VerticalPositionCache&);
179 BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>&, BidiContext*);
180 // Helper function for layoutInlineChildren()
181 RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<B idiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
182 void layoutRunsAndFloats(LineLayoutState&);
183 const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogica lHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine , InlineBidiResolver&, const InlineIterator&);
184 void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&,
185 const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiSta tus);
186 void linkToEndLineIfNeeded(LineLayoutState&);
187 static void markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>& float s);
188 void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat);
189 RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&) ;
190 void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineI terator& cleanLineStart, BidiStatus& cleanLineBidiStatus);
191 bool checkPaginationAndFloatsAtEndLine(LineLayoutState&);
192 bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const Inlin eIterator& endLineStart, const BidiStatus& endLineStatus);
193 void deleteEllipsisLineBoxes();
194 void checkLinesForTextOverflow();
195
196
197 // END METHODS DEFINED IN RenderBlockLineLayout
198
199 }; 158 };
200 159
201 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow()); 160 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow());
202 161
203 } // namespace blink 162 } // namespace blink
204 163
205 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBLOCKFLOW_H_ 164 #endif // SKY_ENGINE_CORE_RENDERING_RENDERBLOCKFLOW_H_
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RenderBlockFlow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698