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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 years, 3 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) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } else if (verticalAlign == VerticalAlignTextBottom) { 649 } else if (verticalAlign == VerticalAlignTextBottom) {
650 verticalPosition += fontMetrics.descent(baselineType()); 650 verticalPosition += fontMetrics.descent(baselineType());
651 // lineHeight - baselinePosition is always 0 for replaced elements ( except inline blocks), so don't bother wasting time in that case. 651 // lineHeight - baselinePosition is always 0 for replaced elements ( except inline blocks), so don't bother wasting time in that case.
652 if (!boxModel.isAtomicInlineLevel() || boxModel.isInlineBlockOrInlin eTable()) 652 if (!boxModel.isAtomicInlineLevel() || boxModel.isInlineBlockOrInlin eTable())
653 verticalPosition -= (boxModel.lineHeight(firstLine, lineDirectio n) - boxModel.baselinePosition(baselineType(), firstLine, lineDirection)); 653 verticalPosition -= (boxModel.lineHeight(firstLine, lineDirectio n) - boxModel.baselinePosition(baselineType(), firstLine, lineDirection));
654 } else if (verticalAlign == VerticalAlignBaselineMiddle) { 654 } else if (verticalAlign == VerticalAlignBaselineMiddle) {
655 verticalPosition += -boxModel.lineHeight(firstLine, lineDirection) / 2 + boxModel.baselinePosition(baselineType(), firstLine, lineDirection); 655 verticalPosition += -boxModel.lineHeight(firstLine, lineDirection) / 2 + boxModel.baselinePosition(baselineType(), firstLine, lineDirection);
656 } else if (verticalAlign == VerticalAlignLength) { 656 } else if (verticalAlign == VerticalAlignLength) {
657 LayoutUnit lineHeight; 657 LayoutUnit lineHeight;
658 // Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-alig n: 'Percentages: refer to the 'line-height' of the element itself'. 658 // Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-alig n: 'Percentages: refer to the 'line-height' of the element itself'.
659 if (boxModel.style()->getVerticalAlignLength().hasPercent()) 659 if (boxModel.style()->getVerticalAlignLength().isPercentOrCalc())
660 lineHeight = LayoutUnit(boxModel.style()->computedLineHeight()); 660 lineHeight = LayoutUnit(boxModel.style()->computedLineHeight());
661 else 661 else
662 lineHeight = boxModel.lineHeight(firstLine, lineDirection); 662 lineHeight = boxModel.lineHeight(firstLine, lineDirection);
663 verticalPosition -= valueForLength(boxModel.style()->getVerticalAlig nLength(), lineHeight); 663 verticalPosition -= valueForLength(boxModel.style()->getVerticalAlig nLength(), lineHeight);
664 } 664 }
665 } 665 }
666 666
667 // Store the cached value. 667 // Store the cached value.
668 if (isLayoutInline && !firstLine) 668 if (isLayoutInline && !firstLine)
669 verticalPositionCache.set(boxModel, baselineType(), verticalPosition.toI nt()); 669 verticalPositionCache.set(boxModel, baselineType(), verticalPosition.toI nt());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 endBox = nullptr; 703 endBox = nullptr;
704 return nullptr; 704 return nullptr;
705 } 705 }
706 706
707 const char* RootInlineBox::boxName() const 707 const char* RootInlineBox::boxName() const
708 { 708 {
709 return "RootInlineBox"; 709 return "RootInlineBox";
710 } 710 }
711 711
712 } // namespace blink 712 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/TextAutosizer.cpp ('k') | third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698