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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutReplaced.cpp

Issue 1653673002: Even more explicit LayoutUnit conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moarConstructors
Patch Set: address comments Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 /*-----------------------------------------------------------------------*\ 249 /*-----------------------------------------------------------------------*\
250 * 4. If at this point both 'margin-left' and 'margin-right' are still 250 * 4. If at this point both 'margin-left' and 'margin-right' are still
251 * 'auto', solve the equation under the extra constraint that the two 251 * 'auto', solve the equation under the extra constraint that the two
252 * margins must get equal values, unless this would make them negative, 252 * margins must get equal values, unless this would make them negative,
253 * in which case when the direction of the containing block is 'ltr' 253 * in which case when the direction of the containing block is 'ltr'
254 * ('rtl'), set 'margin-left' ('margin-right') to zero and solve for 254 * ('rtl'), set 'margin-left' ('margin-right') to zero and solve for
255 * 'margin-right' ('margin-left'). 255 * 'margin-right' ('margin-left').
256 \*-----------------------------------------------------------------------*/ 256 \*-----------------------------------------------------------------------*/
257 LayoutUnit logicalLeftValue = 0; 257 LayoutUnit logicalLeftValue;
258 LayoutUnit logicalRightValue = 0; 258 LayoutUnit logicalRightValue;
259 259
260 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) { 260 if (marginLogicalLeft.isAuto() && marginLogicalRight.isAuto()) {
261 // 'left' and 'right' cannot be 'auto' due to step 3 261 // 'left' and 'right' cannot be 'auto' due to step 3
262 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto())); 262 ASSERT(!(logicalLeft.isAuto() && logicalRight.isAuto()));
263 263
264 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth); 264 logicalLeftValue = valueForLength(logicalLeft, containerLogicalWidth);
265 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth); 265 logicalRightValue = valueForLength(logicalRight, containerLogicalWidth);
266 266
267 LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRigh tValue); 267 LayoutUnit difference = availableSpace - (logicalLeftValue + logicalRigh tValue);
268 if (difference > 0) { 268 if (difference > 0) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 marginBefore.setValue(Fixed, 0); 408 marginBefore.setValue(Fixed, 0);
409 if (marginAfter.isAuto()) 409 if (marginAfter.isAuto())
410 marginAfter.setValue(Fixed, 0); 410 marginAfter.setValue(Fixed, 0);
411 } 411 }
412 412
413 /*-----------------------------------------------------------------------*\ 413 /*-----------------------------------------------------------------------*\
414 * 4. If at this point both 'margin-top' and 'margin-bottom' are still 414 * 4. If at this point both 'margin-top' and 'margin-bottom' are still
415 * 'auto', solve the equation under the extra constraint that the two 415 * 'auto', solve the equation under the extra constraint that the two
416 * margins must get equal values. 416 * margins must get equal values.
417 \*-----------------------------------------------------------------------*/ 417 \*-----------------------------------------------------------------------*/
418 LayoutUnit logicalTopValue = 0; 418 LayoutUnit logicalTopValue;
419 LayoutUnit logicalBottomValue = 0; 419 LayoutUnit logicalBottomValue;
420 420
421 if (marginBefore.isAuto() && marginAfter.isAuto()) { 421 if (marginBefore.isAuto() && marginAfter.isAuto()) {
422 // 'top' and 'bottom' cannot be 'auto' due to step 2 and 3 combined. 422 // 'top' and 'bottom' cannot be 'auto' due to step 2 and 3 combined.
423 ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto())); 423 ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto()));
424 424
425 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); 425 logicalTopValue = valueForLength(logicalTop, containerLogicalHeight);
426 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeigh t); 426 logicalBottomValue = valueForLength(logicalBottom, containerLogicalHeigh t);
427 427
428 LayoutUnit difference = availableSpace - (logicalTopValue + logicalBotto mValue); 428 LayoutUnit difference = availableSpace - (logicalTopValue + logicalBotto mValue);
429 // NOTE: This may result in negative values. 429 // NOTE: This may result in negative values.
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 // We only include the space below the baseline in our layer's cached paint invalidation rect if the 745 // We only include the space below the baseline in our layer's cached paint invalidation rect if the
746 // image is selected. Since the selection state has changed update the rect. 746 // image is selected. Since the selection state has changed update the rect.
747 if (hasLayer()) 747 if (hasLayer())
748 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation())); 748 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe rForPaintInvalidation()));
749 749
750 if (canUpdateSelectionOnRootLineBoxes()) 750 if (canUpdateSelectionOnRootLineBoxes())
751 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone ); 751 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone );
752 } 752 }
753 753
754 } // namespace blink 754 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMedia.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutRubyRun.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698