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

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

Issue 2065383005: [css-flexbox] Fix handling of borders/padding for abspos items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 | « third_party/WebKit/LayoutTests/css3/flexbox/border-and-padding-abspos.html ('k') | no next file » | 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 } 1387 }
1388 1388
1389 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La youtBox& child) 1389 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La youtBox& child)
1390 { 1390 {
1391 LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi ld(child); 1391 LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi ld(child);
1392 return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit( ), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse); 1392 return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit( ), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse);
1393 } 1393 }
1394 1394
1395 LayoutUnit LayoutFlexibleBox::staticInlinePositionForPositionedChild(const Layou tBox& child) 1395 LayoutUnit LayoutFlexibleBox::staticInlinePositionForPositionedChild(const Layou tBox& child)
1396 { 1396 {
1397 LayoutUnit staticInlineOffset = flowAwareBorderStart() + flowAwarePaddingSta rt(); 1397 return startOffsetForContent() + (isColumnFlow() ?
1398 return staticInlineOffset + (isColumnFlow() ?
1399 staticCrossAxisPositionForPositionedChild(child) : 1398 staticCrossAxisPositionForPositionedChild(child) :
1400 staticMainAxisPositionForPositionedChild(child)); 1399 staticMainAxisPositionForPositionedChild(child));
1401 } 1400 }
1402 1401
1403 LayoutUnit LayoutFlexibleBox::staticBlockPositionForPositionedChild(const Layout Box& child) 1402 LayoutUnit LayoutFlexibleBox::staticBlockPositionForPositionedChild(const Layout Box& child)
1404 { 1403 {
1405 LayoutUnit staticBlockOffset = flowAwareBorderBefore() + flowAwarePaddingBef ore(); 1404 return borderAndPaddingBefore() + (isColumnFlow() ?
1406 return staticBlockOffset + (isColumnFlow() ?
1407 staticMainAxisPositionForPositionedChild(child) : 1405 staticMainAxisPositionForPositionedChild(child) :
1408 staticCrossAxisPositionForPositionedChild(child)); 1406 staticCrossAxisPositionForPositionedChild(child));
1409 } 1407 }
1410 1408
1411 bool LayoutFlexibleBox::setStaticPositionForPositionedLayout(LayoutBox& child) 1409 bool LayoutFlexibleBox::setStaticPositionForPositionedLayout(LayoutBox& child)
1412 { 1410 {
1413 bool positionChanged = false; 1411 bool positionChanged = false;
1414 PaintLayer* childLayer = child.layer(); 1412 PaintLayer* childLayer = child.layer();
1415 if (child.styleRef().hasStaticInlinePosition(styleRef().isHorizontalWritingM ode())) { 1413 if (child.styleRef().hasStaticInlinePosition(styleRef().isHorizontalWritingM ode())) {
1416 LayoutUnit inlinePosition = staticInlinePositionForPositionedChild(child ); 1414 LayoutUnit inlinePosition = staticInlinePositionForPositionedChild(child );
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 ASSERT(child); 1860 ASSERT(child);
1863 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1861 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1864 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1862 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1865 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1863 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1866 adjustAlignmentForChild(*child, newOffset - originalOffset); 1864 adjustAlignmentForChild(*child, newOffset - originalOffset);
1867 } 1865 }
1868 } 1866 }
1869 } 1867 }
1870 1868
1871 } // namespace blink 1869 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/flexbox/border-and-padding-abspos.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698