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

Side by Side Diff: Source/core/rendering/RootInlineBox.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "config.h" 20 #include "config.h"
21 #include "core/rendering/RootInlineBox.h" 21 #include "core/rendering/RootInlineBox.h"
22 22
23 #include "core/dom/Document.h" 23 #include "core/dom/Document.h"
24 #include "core/rendering/EllipsisBox.h" 24 #include "core/rendering/EllipsisBox.h"
25 #include "core/rendering/HitTestResult.h" 25 #include "core/rendering/HitTestResult.h"
26 #include "core/rendering/InlineTextBox.h" 26 #include "core/rendering/InlineTextBox.h"
27 #include "core/rendering/PaintInfo.h" 27 #include "core/rendering/PaintInfo.h"
28 #include "core/rendering/RenderBlockFlow.h" 28 #include "core/rendering/RenderBlockFlow.h"
29 #include "core/rendering/RenderFlowThread.h"
30 #include "core/rendering/RenderInline.h" 29 #include "core/rendering/RenderInline.h"
31 #include "core/rendering/RenderView.h" 30 #include "core/rendering/RenderView.h"
32 #include "core/rendering/VerticalPositionCache.h" 31 #include "core/rendering/VerticalPositionCache.h"
33 #include "platform/text/BidiResolver.h" 32 #include "platform/text/BidiResolver.h"
34 #include "wtf/unicode/Unicode.h" 33 #include "wtf/unicode/Unicode.h"
35 34
36 using namespace std; 35 using namespace std;
37 36
38 namespace WebCore { 37 namespace WebCore {
39 38
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 { 201 {
203 if (box->renderer() == m_lineBreakObj) 202 if (box->renderer() == m_lineBreakObj)
204 setLineBreakInfo(0, 0, BidiStatus()); 203 setLineBreakInfo(0, 0, BidiStatus());
205 204
206 for (RootInlineBox* prev = prevRootBox(); prev && prev->lineBreakObj() == bo x->renderer(); prev = prev->prevRootBox()) { 205 for (RootInlineBox* prev = prevRootBox(); prev && prev->lineBreakObj() == bo x->renderer(); prev = prev->prevRootBox()) {
207 prev->setLineBreakInfo(0, 0, BidiStatus()); 206 prev->setLineBreakInfo(0, 0, BidiStatus());
208 prev->markDirty(); 207 prev->markDirty();
209 } 208 }
210 } 209 }
211 210
212 RenderRegion* RootInlineBox::containingRegion() const
213 {
214 RenderRegion* region = m_fragmentationData ? m_fragmentationData->m_containi ngRegion : 0;
215
216 #ifndef NDEBUG
217 if (region) {
218 RenderFlowThread* flowThread = block()->flowThreadContainingBlock();
219 const RenderRegionList& regionList = flowThread->renderRegionList();
220 ASSERT(regionList.contains(region));
221 }
222 #endif
223
224 return region;
225 }
226
227 void RootInlineBox::setContainingRegion(RenderRegion* region)
228 {
229 ASSERT(!isDirty());
230 ASSERT(block()->flowThreadContainingBlock());
231 LineFragmentationData* fragmentationData = ensureLineFragmentationData();
232 fragmentationData->m_containingRegion = region;
233 }
234
235 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G lyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertical PositionCache) 211 LayoutUnit RootInlineBox::alignBoxesInBlockDirection(LayoutUnit heightOfBlock, G lyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache& vertical PositionCache)
236 { 212 {
237 // SVG will handle vertical alignment on its own. 213 // SVG will handle vertical alignment on its own.
238 if (isSVGRootInlineBox()) 214 if (isSVGRootInlineBox())
239 return 0; 215 return 0;
240 216
241 LayoutUnit maxPositionTop = 0; 217 LayoutUnit maxPositionTop = 0;
242 LayoutUnit maxPositionBottom = 0; 218 LayoutUnit maxPositionBottom = 0;
243 int maxAscent = 0; 219 int maxAscent = 0;
244 int maxDescent = 0; 220 int maxDescent = 0;
(...skipping 20 matching lines...) Expand all
265 bool hasAnnotationsBefore = false; 241 bool hasAnnotationsBefore = false;
266 bool hasAnnotationsAfter = false; 242 bool hasAnnotationsAfter = false;
267 placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode , lineTop, lineBottom, setLineTop, 243 placeBoxesInBlockDirection(heightOfBlock, maxHeight, maxAscent, noQuirksMode , lineTop, lineBottom, setLineTop,
268 lineTopIncludingMargins, lineBottomIncludingMargi ns, hasAnnotationsBefore, hasAnnotationsAfter, baselineType()); 244 lineTopIncludingMargins, lineBottomIncludingMargi ns, hasAnnotationsBefore, hasAnnotationsAfter, baselineType());
269 m_hasAnnotationsBefore = hasAnnotationsBefore; 245 m_hasAnnotationsBefore = hasAnnotationsBefore;
270 m_hasAnnotationsAfter = hasAnnotationsAfter; 246 m_hasAnnotationsAfter = hasAnnotationsAfter;
271 247
272 maxHeight = max<LayoutUnit>(0, maxHeight); // FIXME: Is this really necessar y? 248 maxHeight = max<LayoutUnit>(0, maxHeight); // FIXME: Is this really necessar y?
273 249
274 setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight); 250 setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight);
275 setPaginatedLineWidth(block()->availableLogicalWidthForContent(heightOfBlock )); 251 setPaginatedLineWidth(block()->availableLogicalWidthForContent());
276 252
277 LayoutUnit annotationsAdjustment = beforeAnnotationsAdjustment(); 253 LayoutUnit annotationsAdjustment = beforeAnnotationsAdjustment();
278 if (annotationsAdjustment) { 254 if (annotationsAdjustment) {
279 // FIXME: Need to handle pagination here. We might have to move to the n ext page/column as a result of the 255 // FIXME: Need to handle pagination here. We might have to move to the n ext page/column as a result of the
280 // ruby expansion. 256 // ruby expansion.
281 adjustBlockDirectionPosition(annotationsAdjustment); 257 adjustBlockDirectionPosition(annotationsAdjustment);
282 heightOfBlock += annotationsAdjustment; 258 heightOfBlock += annotationsAdjustment;
283 } 259 }
284 260
285 LayoutUnit gridSnapAdjustment = lineSnapAdjustment(); 261 LayoutUnit gridSnapAdjustment = lineSnapAdjustment();
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 } 965 }
990 966
991 #ifndef NDEBUG 967 #ifndef NDEBUG
992 const char* RootInlineBox::boxName() const 968 const char* RootInlineBox::boxName() const
993 { 969 {
994 return "RootInlineBox"; 970 return "RootInlineBox";
995 } 971 }
996 #endif 972 #endif
997 973
998 } // namespace WebCore 974 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RootInlineBox.h ('k') | Source/core/rendering/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698