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

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

Issue 2803483002: Adjust visual overflow rect for rounded/shifted ascent/descent (Closed)
Patch Set: - Created 3 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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1950 LayoutRect logicalVisualOverflow = curr->logicalOverflowRect(); 1950 LayoutRect logicalVisualOverflow = curr->logicalOverflowRect();
1951 logicalLeftSide = std::min(logicalLeftSide, logicalVisualOverflow.x()); 1951 logicalLeftSide = std::min(logicalLeftSide, logicalVisualOverflow.x());
1952 logicalRightSide = std::max(logicalRightSide, logicalVisualOverflow.maxX()); 1952 logicalRightSide = std::max(logicalRightSide, logicalVisualOverflow.maxX());
1953 } 1953 }
1954 1954
1955 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); 1955 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow();
1956 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; 1956 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
1957 LayoutUnit logicalHeight = 1957 LayoutUnit logicalHeight =
1958 lastTextBox()->logicalBottomVisualOverflow() - logicalTop; 1958 lastTextBox()->logicalBottomVisualOverflow() - logicalTop;
1959 1959
1960 // Inflate visual overflow if we have adjusted ascent/descent causing the
eae 2017/04/07 17:41:57 This is better, thank you. I'm still not convinced
Xianzhu 2017/04/07 18:02:52 What do you think about my previous comment: https
1961 // painted glyphs to overflow the layout geometries based on the adjusted
1962 // ascent/descent.
1963 auto inflationForAscent = styleRef(firstTextBox()->isFirstLineStyle())
1964 .font()
1965 .primaryFont()
eae 2017/04/07 17:41:57 primaryFont may be null.
Xianzhu 2017/04/07 18:02:53 Done. Should we have DCHECK(primaryFont) here? I
1966 ->getFontMetrics()
1967 .visualOverflowInflationForAscent();
1968 auto inflationForDescent = styleRef(lastTextBox()->isFirstLineStyle())
1969 .font()
1970 .primaryFont()
1971 ->getFontMetrics()
1972 .visualOverflowInflationForDescent();
1973 logicalTop -= inflationForAscent;
1974 logicalHeight += inflationForAscent + inflationForDescent;
1975
1960 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); 1976 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
1961 if (!style()->isHorizontalWritingMode()) 1977 if (!style()->isHorizontalWritingMode())
1962 rect = rect.transposedRect(); 1978 rect = rect.transposedRect();
1963 return rect; 1979 return rect;
1964 } 1980 }
1965 1981
1966 LayoutRect LayoutText::localVisualRect() const { 1982 LayoutRect LayoutText::localVisualRect() const {
1967 if (style()->visibility() != EVisibility::kVisible) 1983 if (style()->visibility() != EVisibility::kVisible)
1968 return LayoutRect(); 1984 return LayoutRect();
1969 1985
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2092 LayoutRect rect = LayoutRect( 2108 LayoutRect rect = LayoutRect(
2093 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); 2109 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height()));
2094 LayoutBlock* block = containingBlock(); 2110 LayoutBlock* block = containingBlock();
2095 if (block && hasTextBoxes()) 2111 if (block && hasTextBoxes())
2096 block->adjustChildDebugRect(rect); 2112 block->adjustChildDebugRect(rect);
2097 2113
2098 return rect; 2114 return rect;
2099 } 2115 }
2100 2116
2101 } // namespace blink 2117 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698