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

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

Issue 2640143005: Support subpixel layout for borders. (Closed)
Patch Set: Rebaselined tests. Created 3 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) 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 return style()->isLeftToRightDirection() 631 return style()->isLeftToRightDirection()
632 ? TransformedWritingMode::TopToBottomWritingMode 632 ? TransformedWritingMode::TopToBottomWritingMode
633 : TransformedWritingMode::BottomToTopWritingMode; 633 : TransformedWritingMode::BottomToTopWritingMode;
634 } 634 }
635 NOTREACHED(); 635 NOTREACHED();
636 return TransformedWritingMode::TopToBottomWritingMode; 636 return TransformedWritingMode::TopToBottomWritingMode;
637 } 637 }
638 638
639 LayoutUnit LayoutFlexibleBox::flowAwareBorderStart() const { 639 LayoutUnit LayoutFlexibleBox::flowAwareBorderStart() const {
640 if (isHorizontalFlow()) 640 if (isHorizontalFlow())
641 return LayoutUnit(isLeftToRightFlow() ? borderLeft() : borderRight()); 641 return isLeftToRightFlow() ? borderLeft() : borderRight();
642 return LayoutUnit(isLeftToRightFlow() ? borderTop() : borderBottom()); 642 return isLeftToRightFlow() ? borderTop() : borderBottom();
643 } 643 }
644 644
645 LayoutUnit LayoutFlexibleBox::flowAwareBorderEnd() const { 645 LayoutUnit LayoutFlexibleBox::flowAwareBorderEnd() const {
646 if (isHorizontalFlow()) 646 if (isHorizontalFlow())
647 return LayoutUnit(isLeftToRightFlow() ? borderRight() : borderLeft()); 647 return isLeftToRightFlow() ? borderRight() : borderLeft();
648 return LayoutUnit(isLeftToRightFlow() ? borderBottom() : borderTop()); 648 return isLeftToRightFlow() ? borderBottom() : borderTop();
649 } 649 }
650 650
651 LayoutUnit LayoutFlexibleBox::flowAwareBorderBefore() const { 651 LayoutUnit LayoutFlexibleBox::flowAwareBorderBefore() const {
652 switch (getTransformedWritingMode()) { 652 switch (getTransformedWritingMode()) {
653 case TransformedWritingMode::TopToBottomWritingMode: 653 case TransformedWritingMode::TopToBottomWritingMode:
654 return LayoutUnit(borderTop()); 654 return borderTop();
655 case TransformedWritingMode::BottomToTopWritingMode: 655 case TransformedWritingMode::BottomToTopWritingMode:
656 return LayoutUnit(borderBottom()); 656 return borderBottom();
657 case TransformedWritingMode::LeftToRightWritingMode: 657 case TransformedWritingMode::LeftToRightWritingMode:
658 return LayoutUnit(borderLeft()); 658 return borderLeft();
659 case TransformedWritingMode::RightToLeftWritingMode: 659 case TransformedWritingMode::RightToLeftWritingMode:
660 return LayoutUnit(borderRight()); 660 return borderRight();
661 } 661 }
662 NOTREACHED(); 662 NOTREACHED();
663 return LayoutUnit(borderTop()); 663 return borderTop();
664 } 664 }
665 665
666 DISABLE_CFI_PERF 666 DISABLE_CFI_PERF
667 LayoutUnit LayoutFlexibleBox::flowAwareBorderAfter() const { 667 LayoutUnit LayoutFlexibleBox::flowAwareBorderAfter() const {
668 switch (getTransformedWritingMode()) { 668 switch (getTransformedWritingMode()) {
669 case TransformedWritingMode::TopToBottomWritingMode: 669 case TransformedWritingMode::TopToBottomWritingMode:
670 return LayoutUnit(borderBottom()); 670 return borderBottom();
671 case TransformedWritingMode::BottomToTopWritingMode: 671 case TransformedWritingMode::BottomToTopWritingMode:
672 return LayoutUnit(borderTop()); 672 return borderTop();
673 case TransformedWritingMode::LeftToRightWritingMode: 673 case TransformedWritingMode::LeftToRightWritingMode:
674 return LayoutUnit(borderRight()); 674 return borderRight();
675 case TransformedWritingMode::RightToLeftWritingMode: 675 case TransformedWritingMode::RightToLeftWritingMode:
676 return LayoutUnit(borderLeft()); 676 return borderLeft();
677 } 677 }
678 NOTREACHED(); 678 NOTREACHED();
679 return LayoutUnit(borderTop()); 679 return borderTop();
680 } 680 }
681 681
682 LayoutUnit LayoutFlexibleBox::flowAwarePaddingStart() const { 682 LayoutUnit LayoutFlexibleBox::flowAwarePaddingStart() const {
683 if (isHorizontalFlow()) 683 if (isHorizontalFlow())
684 return isLeftToRightFlow() ? paddingLeft() : paddingRight(); 684 return isLeftToRightFlow() ? paddingLeft() : paddingRight();
685 return isLeftToRightFlow() ? paddingTop() : paddingBottom(); 685 return isLeftToRightFlow() ? paddingTop() : paddingBottom();
686 } 686 }
687 687
688 LayoutUnit LayoutFlexibleBox::flowAwarePaddingEnd() const { 688 LayoutUnit LayoutFlexibleBox::flowAwarePaddingEnd() const {
689 if (isHorizontalFlow()) 689 if (isHorizontalFlow())
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 LayoutUnit originalOffset = 2183 LayoutUnit originalOffset =
2184 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 2184 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
2185 LayoutUnit newOffset = 2185 LayoutUnit newOffset =
2186 contentExtent - originalOffset - lineCrossAxisExtent; 2186 contentExtent - originalOffset - lineCrossAxisExtent;
2187 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); 2187 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset);
2188 } 2188 }
2189 } 2189 }
2190 } 2190 }
2191 2191
2192 } // namespace blink 2192 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698