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

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

Issue 1841323003: [css-grid] Fix positioned items with grid gaps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-positioned-rtl-after-refactoring
Patch Set: Patch for landing Created 4 years, 8 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/fast/css-grid-layout/grid-positioned-items-gaps-rtl.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 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 else 1530 else
1531 start = m_rowPositions[startLine] - m_rowPositions[0] + paddingBefor e(); 1531 start = m_rowPositions[startLine] - m_rowPositions[0] + paddingBefor e();
1532 } 1532 }
1533 1533
1534 LayoutUnit end = isForColumns ? clientLogicalWidth() : clientLogicalHeight() ; 1534 LayoutUnit end = isForColumns ? clientLogicalWidth() : clientLogicalHeight() ;
1535 if (!endIsAuto) { 1535 if (!endIsAuto) {
1536 if (isForColumns) 1536 if (isForColumns)
1537 end = m_columnPositions[endLine] - m_columnPositions[0] + paddingSta rt(); 1537 end = m_columnPositions[endLine] - m_columnPositions[0] + paddingSta rt();
1538 else 1538 else
1539 end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore(); 1539 end = m_rowPositions[endLine] - m_rowPositions[0] + paddingBefore();
1540
1541 // These vectors store line positions including gaps, but we shouldn't c onsider them for the edges of the grid.
1542 if (endLine > firstExplicitLine && endLine < lastExplicitLine)
1543 end -= guttersSize(direction, 2);
1540 } 1544 }
1541 1545
1542 breadth = end - start; 1546 breadth = end - start;
1543 offset = start; 1547 offset = start;
1544 1548
1545 if (isForColumns && !styleRef().isLeftToRightDirection() && !child.styleRef( ).hasStaticInlinePosition(child.isHorizontalWritingMode())) { 1549 if (isForColumns && !styleRef().isLeftToRightDirection() && !child.styleRef( ).hasStaticInlinePosition(child.isHorizontalWritingMode())) {
1546 // If the child doesn't have a static inline position (i.e. "left" and/o r "right" aren't "auto", 1550 // If the child doesn't have a static inline position (i.e. "left" and/o r "right" aren't "auto",
1547 // we need to calculate the offset from the left (even if we're in RTL). 1551 // we need to calculate the offset from the left (even if we're in RTL).
1548 if (endIsAuto) { 1552 if (endIsAuto) {
1549 offset = LayoutUnit(); 1553 offset = LayoutUnit();
1550 } else { 1554 } else {
1551 LayoutUnit alignmentOffset = m_columnPositions[0] - borderAndPaddin gStart(); 1555 LayoutUnit alignmentOffset = m_columnPositions[0] - borderAndPaddin gStart();
1552 LayoutUnit offsetFromLastLine = m_columnPositions[m_columnPositions. size() - 1] - m_columnPositions[endLine]; 1556 LayoutUnit offsetFromLastLine = m_columnPositions[m_columnPositions. size() - 1] - m_columnPositions[endLine];
1553 offset = paddingLeft() + alignmentOffset + offsetFromLastLine; 1557 offset = paddingLeft() + alignmentOffset + offsetFromLastLine;
1558
1559 if (endLine > firstExplicitLine && endLine < lastExplicitLine)
1560 offset += guttersSize(direction, 2);
1554 } 1561 }
1555 } 1562 }
1556 1563
1557 if (child.parent() == this && !startIsAuto) { 1564 if (child.parent() == this && !startIsAuto) {
1558 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout(). 1565 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout().
1559 PaintLayer* childLayer = child.layer(); 1566 PaintLayer* childLayer = child.layer();
1560 if (isForColumns) 1567 if (isForColumns)
1561 childLayer->setStaticInlinePosition(borderStart() + offset); 1568 childLayer->setStaticInlinePosition(borderStart() + offset);
1562 else 1569 else
1563 childLayer->setStaticBlockPosition(borderBefore() + offset); 1570 childLayer->setStaticBlockPosition(borderBefore() + offset);
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 2059
2053 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData )); 2060 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData ));
2054 } 2061 }
2055 2062
2056 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2063 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2057 { 2064 {
2058 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2065 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2059 } 2066 }
2060 2067
2061 } // namespace blink 2068 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-positioned-items-gaps-rtl.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698