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

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

Issue 164553004: Convert LayoutState/LayoutStateMaintainer/LayoutStateDisabler to references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderInline.h ('k') | Source/core/rendering/RenderLayer.cpp » ('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) 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple 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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 return style()->computedLineHeight(); 1292 return style()->computedLineHeight();
1293 } 1293 }
1294 1294
1295 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 1295 int RenderInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const
1296 { 1296 {
1297 ASSERT(linePositionMode == PositionOnContainingLine); 1297 ASSERT(linePositionMode == PositionOnContainingLine);
1298 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 1298 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics();
1299 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1299 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
1300 } 1300 }
1301 1301
1302 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox* child) const 1302 LayoutSize RenderInline::offsetForInFlowPositionedInline(const RenderBox& child) const
1303 { 1303 {
1304 // FIXME: This function isn't right with mixed writing modes. 1304 // FIXME: This function isn't right with mixed writing modes.
1305 1305
1306 ASSERT(isInFlowPositioned()); 1306 ASSERT(isInFlowPositioned());
1307 if (!isInFlowPositioned()) 1307 if (!isInFlowPositioned())
1308 return LayoutSize(); 1308 return LayoutSize();
1309 1309
1310 // When we have an enclosing relpositioned inline, we need to add in the off set of the first line 1310 // When we have an enclosing relpositioned inline, we need to add in the off set of the first line
1311 // box from the rest of the content, but only in the cases where we know we' re positioned 1311 // box from the rest of the content, but only in the cases where we know we' re positioned
1312 // relative to the inline itself. 1312 // relative to the inline itself.
1313 1313
1314 LayoutSize logicalOffset; 1314 LayoutSize logicalOffset;
1315 LayoutUnit inlinePosition; 1315 LayoutUnit inlinePosition;
1316 LayoutUnit blockPosition; 1316 LayoutUnit blockPosition;
1317 if (firstLineBox()) { 1317 if (firstLineBox()) {
1318 inlinePosition = LayoutUnit::fromFloatRound(firstLineBox()->logicalLeft( )); 1318 inlinePosition = LayoutUnit::fromFloatRound(firstLineBox()->logicalLeft( ));
1319 blockPosition = firstLineBox()->logicalTop(); 1319 blockPosition = firstLineBox()->logicalTop();
1320 } else { 1320 } else {
1321 inlinePosition = layer()->staticInlinePosition(); 1321 inlinePosition = layer()->staticInlinePosition();
1322 blockPosition = layer()->staticBlockPosition(); 1322 blockPosition = layer()->staticBlockPosition();
1323 } 1323 }
1324 1324
1325 if (!child->style()->hasStaticInlinePosition(style()->isHorizontalWritingMod e())) 1325 if (!child.style()->hasStaticInlinePosition(style()->isHorizontalWritingMode ()))
1326 logicalOffset.setWidth(inlinePosition); 1326 logicalOffset.setWidth(inlinePosition);
1327 1327
1328 // This is not terribly intuitive, but we have to match other browsers. Des pite being a block display type inside 1328 // This is not terribly intuitive, but we have to match other browsers. Des pite being a block display type inside
1329 // an inline, we still keep our x locked to the left of the relative positio ned inline. Arguably the correct 1329 // an inline, we still keep our x locked to the left of the relative positio ned inline. Arguably the correct
1330 // behavior would be to go flush left to the block that contains the inline, but that isn't what other browsers 1330 // behavior would be to go flush left to the block that contains the inline, but that isn't what other browsers
1331 // do. 1331 // do.
1332 else if (!child->style()->isOriginalDisplayInlineType()) 1332 else if (!child.style()->isOriginalDisplayInlineType())
1333 // Avoid adding in the left border/padding of the containing block twice . Subtract it out. 1333 // Avoid adding in the left border/padding of the containing block twice . Subtract it out.
1334 logicalOffset.setWidth(inlinePosition - child->containingBlock()->border AndPaddingLogicalLeft()); 1334 logicalOffset.setWidth(inlinePosition - child.containingBlock()->borderA ndPaddingLogicalLeft());
1335 1335
1336 if (!child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode ())) 1336 if (!child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMode( )))
1337 logicalOffset.setHeight(blockPosition); 1337 logicalOffset.setHeight(blockPosition);
1338 1338
1339 return style()->isHorizontalWritingMode() ? logicalOffset : logicalOffset.tr ansposedSize(); 1339 return style()->isHorizontalWritingMode() ? logicalOffset : logicalOffset.tr ansposedSize();
1340 } 1340 }
1341 1341
1342 void RenderInline::imageChanged(WrappedImagePtr, const IntRect*) 1342 void RenderInline::imageChanged(WrappedImagePtr, const IntRect*)
1343 { 1343 {
1344 if (!parent()) 1344 if (!parent())
1345 return; 1345 return;
1346 1346
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1572 container = this; 1572 container = this;
1573 1573
1574 FloatPoint absPos = container->localToAbsolute(); 1574 FloatPoint absPos = container->localToAbsolute();
1575 region.bounds.setX(absPos.x() + region.bounds.x()); 1575 region.bounds.setX(absPos.x() + region.bounds.x());
1576 region.bounds.setY(absPos.y() + region.bounds.y()); 1576 region.bounds.setY(absPos.y() + region.bounds.y());
1577 1577
1578 regions.append(region); 1578 regions.append(region);
1579 } 1579 }
1580 1580
1581 } // namespace WebCore 1581 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderInline.h ('k') | Source/core/rendering/RenderLayer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698