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

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

Issue 1766723004: style: Remame values in EOverflow and EVerticalAlign to CamelCase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum-clash-EOverflowEVerticalAlign: rebase Created 4 years, 9 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 // Check the cache. 623 // Check the cache.
624 bool isLayoutInline = boxModel.isLayoutInline(); 624 bool isLayoutInline = boxModel.isLayoutInline();
625 if (isLayoutInline && !firstLine) { 625 if (isLayoutInline && !firstLine) {
626 LayoutUnit verticalPosition = LayoutUnit(verticalPositionCache.get(boxMo del, baselineType())); 626 LayoutUnit verticalPosition = LayoutUnit(verticalPositionCache.get(boxMo del, baselineType()));
627 if (verticalPosition != PositionUndefined) 627 if (verticalPosition != PositionUndefined)
628 return verticalPosition; 628 return verticalPosition;
629 } 629 }
630 630
631 LayoutUnit verticalPosition; 631 LayoutUnit verticalPosition;
632 EVerticalAlign verticalAlign = boxModel.style()->verticalAlign(); 632 EVerticalAlign verticalAlign = boxModel.style()->verticalAlign();
633 if (verticalAlign == TOP || verticalAlign == BOTTOM) 633 if (verticalAlign == VerticalAlignTop || verticalAlign == VerticalAlignBotto m)
634 return LayoutUnit(); 634 return LayoutUnit();
635 635
636 LineLayoutItem parent = boxModel.parent(); 636 LineLayoutItem parent = boxModel.parent();
637 if (parent.isLayoutInline() && parent.style()->verticalAlign() != TOP && par ent.style()->verticalAlign() != BOTTOM) 637 if (parent.isLayoutInline() && parent.style()->verticalAlign() != VerticalAl ignTop && parent.style()->verticalAlign() != VerticalAlignBottom)
638 verticalPosition = box->parent()->logicalTop(); 638 verticalPosition = box->parent()->logicalTop();
639 639
640 if (verticalAlign != BASELINE) { 640 if (verticalAlign != VerticalAlignBaseline) {
641 const Font& font = parent.style(firstLine)->font(); 641 const Font& font = parent.style(firstLine)->font();
642 const FontMetrics& fontMetrics = font.fontMetrics(); 642 const FontMetrics& fontMetrics = font.fontMetrics();
643 int fontSize = font.fontDescription().computedPixelSize(); 643 int fontSize = font.fontDescription().computedPixelSize();
644 644
645 LineDirectionMode lineDirection = parent.isHorizontalWritingMode() ? Hor izontalLine : VerticalLine; 645 LineDirectionMode lineDirection = parent.isHorizontalWritingMode() ? Hor izontalLine : VerticalLine;
646 646
647 if (verticalAlign == SUB) { 647 if (verticalAlign == VerticalAlignSub) {
648 verticalPosition += fontSize / 5 + 1; 648 verticalPosition += fontSize / 5 + 1;
649 } else if (verticalAlign == SUPER) { 649 } else if (verticalAlign == VerticalAlignSuper) {
650 verticalPosition -= fontSize / 3 + 1; 650 verticalPosition -= fontSize / 3 + 1;
651 } else if (verticalAlign == TEXT_TOP) { 651 } else if (verticalAlign == VerticalAlignTextTop) {
652 verticalPosition += boxModel.baselinePosition(baselineType(), firstL ine, lineDirection) - fontMetrics.ascent(baselineType()); 652 verticalPosition += boxModel.baselinePosition(baselineType(), firstL ine, lineDirection) - fontMetrics.ascent(baselineType());
653 } else if (verticalAlign == MIDDLE) { 653 } else if (verticalAlign == VerticalAlignMiddle) {
654 verticalPosition = LayoutUnit((verticalPosition - LayoutUnit(fontMet rics.xHeight() / 2) 654 verticalPosition = LayoutUnit((verticalPosition - LayoutUnit(fontMet rics.xHeight() / 2)
655 - boxModel.lineHeight(firstLine, lineDirection) / 2 655 - boxModel.lineHeight(firstLine, lineDirection) / 2
656 + boxModel.baselinePosition(baselineType(), firstLine, lineDirec tion)).round()); 656 + boxModel.baselinePosition(baselineType(), firstLine, lineDirec tion)).round());
657 } else if (verticalAlign == TEXT_BOTTOM) { 657 } else if (verticalAlign == VerticalAlignTextBottom) {
658 verticalPosition += fontMetrics.descent(baselineType()); 658 verticalPosition += fontMetrics.descent(baselineType());
659 // lineHeight - baselinePosition is always 0 for replaced elements ( except inline blocks), so don't bother wasting time in that case. 659 // lineHeight - baselinePosition is always 0 for replaced elements ( except inline blocks), so don't bother wasting time in that case.
660 if (!boxModel.isAtomicInlineLevel() || boxModel.isInlineBlockOrInlin eTable()) 660 if (!boxModel.isAtomicInlineLevel() || boxModel.isInlineBlockOrInlin eTable())
661 verticalPosition -= (boxModel.lineHeight(firstLine, lineDirectio n) - boxModel.baselinePosition(baselineType(), firstLine, lineDirection)); 661 verticalPosition -= (boxModel.lineHeight(firstLine, lineDirectio n) - boxModel.baselinePosition(baselineType(), firstLine, lineDirection));
662 } else if (verticalAlign == BASELINE_MIDDLE) { 662 } else if (verticalAlign == VerticalAlignBaselineMiddle) {
663 verticalPosition += -boxModel.lineHeight(firstLine, lineDirection) / 2 + boxModel.baselinePosition(baselineType(), firstLine, lineDirection); 663 verticalPosition += -boxModel.lineHeight(firstLine, lineDirection) / 2 + boxModel.baselinePosition(baselineType(), firstLine, lineDirection);
664 } else if (verticalAlign == LENGTH) { 664 } else if (verticalAlign == VerticalAlignLength) {
665 LayoutUnit lineHeight; 665 LayoutUnit lineHeight;
666 // Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-alig n: 'Percentages: refer to the 'line-height' of the element itself'. 666 // Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-alig n: 'Percentages: refer to the 'line-height' of the element itself'.
667 if (boxModel.style()->verticalAlignLength().hasPercent()) 667 if (boxModel.style()->getVerticalAlignLength().hasPercent())
668 lineHeight = LayoutUnit(boxModel.style()->computedLineHeight()); 668 lineHeight = LayoutUnit(boxModel.style()->computedLineHeight());
669 else 669 else
670 lineHeight = boxModel.lineHeight(firstLine, lineDirection); 670 lineHeight = boxModel.lineHeight(firstLine, lineDirection);
671 verticalPosition -= valueForLength(boxModel.style()->verticalAlignLe ngth(), lineHeight); 671 verticalPosition -= valueForLength(boxModel.style()->getVerticalAlig nLength(), lineHeight);
672 } 672 }
673 } 673 }
674 674
675 // Store the cached value. 675 // Store the cached value.
676 if (isLayoutInline && !firstLine) 676 if (isLayoutInline && !firstLine)
677 verticalPositionCache.set(boxModel, baselineType(), verticalPosition); 677 verticalPositionCache.set(boxModel, baselineType(), verticalPosition);
678 678
679 return verticalPosition; 679 return verticalPosition;
680 } 680 }
681 681
(...skipping 29 matching lines...) Expand all
711 endBox = nullptr; 711 endBox = nullptr;
712 return nullptr; 712 return nullptr;
713 } 713 }
714 714
715 const char* RootInlineBox::boxName() const 715 const char* RootInlineBox::boxName() const
716 { 716 {
717 return "RootInlineBox"; 717 return "RootInlineBox";
718 } 718 }
719 719
720 } // namespace blink 720 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698