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

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 178473024: Convert some Shape code to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased patch Created 6 years, 9 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
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | Source/core/rendering/RenderBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1010 }
1011 1011
1012 static inline void pushShapeContentOverflowBelowTheContentBox(RenderBlockFlow* b lock, ShapeInsideInfo* shapeInsideInfo, LayoutUnit lineTop, LayoutUnit lineHeigh t) 1012 static inline void pushShapeContentOverflowBelowTheContentBox(RenderBlockFlow* b lock, ShapeInsideInfo* shapeInsideInfo, LayoutUnit lineTop, LayoutUnit lineHeigh t)
1013 { 1013 {
1014 ASSERT(shapeInsideInfo); 1014 ASSERT(shapeInsideInfo);
1015 1015
1016 LayoutUnit logicalLineBottom = lineTop + lineHeight; 1016 LayoutUnit logicalLineBottom = lineTop + lineHeight;
1017 LayoutUnit shapeLogicalBottom = shapeInsideInfo->shapeLogicalBottom(); 1017 LayoutUnit shapeLogicalBottom = shapeInsideInfo->shapeLogicalBottom();
1018 LayoutUnit shapeContainingBlockHeight = shapeInsideInfo->shapeContainingBloc kHeight(); 1018 LayoutUnit shapeContainingBlockHeight = shapeInsideInfo->shapeContainingBloc kHeight();
1019 1019
1020 bool isOverflowPositionedAlready = (shapeContainingBlockHeight - shapeInside Info->owner()->borderAndPaddingAfter() + lineHeight) <= lineTop; 1020 bool isOverflowPositionedAlready = (shapeContainingBlockHeight - shapeInside Info->owner().borderAndPaddingAfter() + lineHeight) <= lineTop;
1021 1021
1022 // If the last line overlaps with the shape, we don't need the segments anym ore 1022 // If the last line overlaps with the shape, we don't need the segments anym ore
1023 if (lineTop < shapeLogicalBottom && shapeLogicalBottom < logicalLineBottom) 1023 if (lineTop < shapeLogicalBottom && shapeLogicalBottom < logicalLineBottom)
1024 shapeInsideInfo->clearSegments(); 1024 shapeInsideInfo->clearSegments();
1025 if (logicalLineBottom <= shapeLogicalBottom || !shapeContainingBlockHeight | | isOverflowPositionedAlready) 1025 if (logicalLineBottom <= shapeLogicalBottom || !shapeContainingBlockHeight | | isOverflowPositionedAlready)
1026 return; 1026 return;
1027 1027
1028 LayoutUnit newLogicalHeight = block->logicalHeight() + (shapeContainingBlock Height - (lineTop + shapeInsideInfo->owner()->borderAndPaddingAfter())); 1028 LayoutUnit newLogicalHeight = block->logicalHeight() + (shapeContainingBlock Height - (lineTop + shapeInsideInfo->owner().borderAndPaddingAfter()));
1029 block->setLogicalHeight(newLogicalHeight); 1029 block->setLogicalHeight(newLogicalHeight);
1030 } 1030 }
1031 1031
1032 void RenderBlockFlow::updateShapeAndSegmentsForCurrentLine(ShapeInsideInfo*& sha peInsideInfo, const LayoutSize& logicalOffsetFromShapeContainer, LineLayoutState & layoutState) 1032 void RenderBlockFlow::updateShapeAndSegmentsForCurrentLine(ShapeInsideInfo*& sha peInsideInfo, const LayoutSize& logicalOffsetFromShapeContainer, LineLayoutState & layoutState)
1033 { 1033 {
1034 if (layoutState.flowThread()) 1034 if (layoutState.flowThread())
1035 return updateShapeAndSegmentsForCurrentLineInFlowThread(shapeInsideInfo, layoutState); 1035 return updateShapeAndSegmentsForCurrentLineInFlowThread(shapeInsideInfo, layoutState);
1036 1036
1037 if (!shapeInsideInfo) 1037 if (!shapeInsideInfo)
1038 return; 1038 return;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 InlineIterator endOfLine = resolver.position(); 1163 InlineIterator endOfLine = resolver.position();
1164 bool checkForEndLineMatch = layoutState.endLine(); 1164 bool checkForEndLineMatch = layoutState.endLine();
1165 RenderTextInfo renderTextInfo; 1165 RenderTextInfo renderTextInfo;
1166 VerticalPositionCache verticalPositionCache; 1166 VerticalPositionCache verticalPositionCache;
1167 1167
1168 LineBreaker lineBreaker(this); 1168 LineBreaker lineBreaker(this);
1169 1169
1170 LayoutSize logicalOffsetFromShapeContainer; 1170 LayoutSize logicalOffsetFromShapeContainer;
1171 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo(); 1171 ShapeInsideInfo* shapeInsideInfo = layoutShapeInsideInfo();
1172 if (shapeInsideInfo) { 1172 if (shapeInsideInfo) {
1173 ASSERT(shapeInsideInfo->owner() == this || allowsShapeInsideInfoSharing( shapeInsideInfo->owner())); 1173 ASSERT(&shapeInsideInfo->owner() == this || allowsShapeInsideInfoSharing (&shapeInsideInfo->owner()));
1174 if (shapeInsideInfo != this->shapeInsideInfo()) { 1174 if (shapeInsideInfo != this->shapeInsideInfo()) {
1175 // FIXME Bug 100284: If subsequent LayoutStates are pushed, we will have to add 1175 // FIXME Bug 100284: If subsequent LayoutStates are pushed, we will have to add
1176 // their offsets from the original shape-inside container. 1176 // their offsets from the original shape-inside container.
1177 logicalOffsetFromShapeContainer = logicalOffsetFromShapeAncestorCont ainer(shapeInsideInfo->owner()); 1177 logicalOffsetFromShapeContainer = logicalOffsetFromShapeAncestorCont ainer(&shapeInsideInfo->owner());
1178 } 1178 }
1179 // Begin layout at the logical top of our shape inside. 1179 // Begin layout at the logical top of our shape inside.
1180 if (logicalHeight() + logicalOffsetFromShapeContainer.height() < shapeIn sideInfo->shapeLogicalTop()) { 1180 if (logicalHeight() + logicalOffsetFromShapeContainer.height() < shapeIn sideInfo->shapeLogicalTop()) {
1181 LayoutUnit logicalHeight = shapeInsideInfo->shapeLogicalTop() - logi calOffsetFromShapeContainer.height(); 1181 LayoutUnit logicalHeight = shapeInsideInfo->shapeLogicalTop() - logi calOffsetFromShapeContainer.height();
1182 if (layoutState.flowThread()) 1182 if (layoutState.flowThread())
1183 logicalHeight -= shapeInsideInfo->owner()->borderAndPaddingBefor e(); 1183 logicalHeight -= shapeInsideInfo->owner().borderAndPaddingBefore ();
1184 setLogicalHeight(logicalHeight); 1184 setLogicalHeight(logicalHeight);
1185 } 1185 }
1186 } 1186 }
1187 1187
1188 while (!endOfLine.atEnd()) { 1188 while (!endOfLine.atEnd()) {
1189 // FIXME: Is this check necessary before the first iteration or can it b e moved to the end? 1189 // FIXME: Is this check necessary before the first iteration or can it b e moved to the end?
1190 if (checkForEndLineMatch) { 1190 if (checkForEndLineMatch) {
1191 layoutState.setEndLineMatched(matchedEndLine(layoutState, resolver, cleanLineStart, cleanLineBidiStatus)); 1191 layoutState.setEndLineMatched(matchedEndLine(layoutState, resolver, cleanLineStart, cleanLineBidiStatus));
1192 if (layoutState.endLineMatched()) { 1192 if (layoutState.endLineMatched()) {
1193 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0); 1193 resolver.setPosition(InlineIterator(resolver.position().root(), 0, 0), 0);
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2434 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2434 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
2435 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2435 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2436 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2436 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2437 2437
2438 if (!style()->isLeftToRightDirection()) 2438 if (!style()->isLeftToRightDirection())
2439 return logicalWidth() - logicalLeft; 2439 return logicalWidth() - logicalLeft;
2440 return logicalLeft; 2440 return logicalLeft;
2441 } 2441 }
2442 2442
2443 } 2443 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | Source/core/rendering/RenderBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698