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

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

Issue 2052243003: [css-flexbox] Fix handling of borders/padding for abspos items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 } 1388 }
1389 1389
1390 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La youtBox& child) 1390 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La youtBox& child)
1391 { 1391 {
1392 LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi ld(child); 1392 LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi ld(child);
1393 return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit( ), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse); 1393 return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit( ), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse);
1394 } 1394 }
1395 1395
1396 LayoutUnit LayoutFlexibleBox::staticInlinePositionForPositionedChild(const Layou tBox& child) 1396 LayoutUnit LayoutFlexibleBox::staticInlinePositionForPositionedChild(const Layou tBox& child)
1397 { 1397 {
1398 LayoutUnit staticInlineOffset = flowAwareBorderStart() + flowAwarePaddingSta rt(); 1398 return startOffsetForContent() + (isColumnFlow() ?
1399 return staticInlineOffset + (isColumnFlow() ?
1400 staticCrossAxisPositionForPositionedChild(child) : 1399 staticCrossAxisPositionForPositionedChild(child) :
1401 staticMainAxisPositionForPositionedChild(child)); 1400 staticMainAxisPositionForPositionedChild(child));
1402 } 1401 }
1403 1402
1404 LayoutUnit LayoutFlexibleBox::staticBlockPositionForPositionedChild(const Layout Box& child) 1403 LayoutUnit LayoutFlexibleBox::staticBlockPositionForPositionedChild(const Layout Box& child)
1405 { 1404 {
1406 LayoutUnit staticBlockOffset = flowAwareBorderBefore() + flowAwarePaddingBef ore(); 1405 return borderAndPaddingBefore() + (isColumnFlow() ?
1407 return staticBlockOffset + (isColumnFlow() ?
1408 staticMainAxisPositionForPositionedChild(child) : 1406 staticMainAxisPositionForPositionedChild(child) :
1409 staticCrossAxisPositionForPositionedChild(child)); 1407 staticCrossAxisPositionForPositionedChild(child));
1410 } 1408 }
1411 1409
1412 bool LayoutFlexibleBox::setStaticPositionForPositionedLayout(LayoutBox& child) 1410 bool LayoutFlexibleBox::setStaticPositionForPositionedLayout(LayoutBox& child)
1413 { 1411 {
1414 bool positionChanged = false; 1412 bool positionChanged = false;
1415 PaintLayer* childLayer = child.layer(); 1413 PaintLayer* childLayer = child.layer();
1416 if (child.styleRef().hasStaticInlinePosition(styleRef().isHorizontalWritingM ode())) { 1414 if (child.styleRef().hasStaticInlinePosition(styleRef().isHorizontalWritingM ode())) {
1417 LayoutUnit inlinePosition = staticInlinePositionForPositionedChild(child ); 1415 LayoutUnit inlinePosition = staticInlinePositionForPositionedChild(child );
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 ASSERT(child); 1861 ASSERT(child);
1864 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1862 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1865 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1863 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1866 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1864 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1867 adjustAlignmentForChild(*child, newOffset - originalOffset); 1865 adjustAlignmentForChild(*child, newOffset - originalOffset);
1868 } 1866 }
1869 } 1867 }
1870 } 1868 }
1871 1869
1872 } // namespace blink 1870 } // 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