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

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

Issue 1841073002: [css-grid] Fix positioned children in RTL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 } 1540 }
1541 1541
1542 breadth = end - start; 1542 breadth = end - start;
1543 offset = start; 1543 offset = start;
1544 1544
1545 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",
1547 // we need to calculate the offset from the left (even if we're in RTL).
1548 if (endIsAuto) {
1549 offset = LayoutUnit();
1550 } else {
1551 LayoutUnit alignmentOffset = m_columnPositions[0] - borderAndPaddin gStart();
1552 LayoutUnit offsetFromLastLine = m_columnPositions[m_columnPositions. size() - 1] - m_columnPositions[endLine];
1553 offset = paddingLeft() + alignmentOffset + offsetFromLastLine;
1554 }
1555 }
1556
1545 if (child.parent() == this && !startIsAuto) { 1557 if (child.parent() == this && !startIsAuto) {
1546 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout(). 1558 // If column/row start is "auto" the static position has been already se t in prepareChildForPositionedLayout().
1547 PaintLayer* childLayer = child.layer(); 1559 PaintLayer* childLayer = child.layer();
1548 if (isForColumns) 1560 if (isForColumns)
1549 childLayer->setStaticInlinePosition(borderStart() + offset); 1561 childLayer->setStaticInlinePosition(borderStart() + offset);
1550 else 1562 else
1551 childLayer->setStaticBlockPosition(borderBefore() + offset); 1563 childLayer->setStaticBlockPosition(borderBefore() + offset);
1552 } 1564 }
1553 } 1565 }
1554 1566
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 2052
2041 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData )); 2053 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child, sizingData ));
2042 } 2054 }
2043 2055
2044 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2056 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2045 { 2057 {
2046 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2058 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2047 } 2059 }
2048 2060
2049 } // namespace blink 2061 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698