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

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

Issue 2816243004: 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 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1969 std::min(logical_left_side, logical_visual_overflow.X()); 1969 std::min(logical_left_side, logical_visual_overflow.X());
1970 logical_right_side = 1970 logical_right_side =
1971 std::max(logical_right_side, logical_visual_overflow.MaxX()); 1971 std::max(logical_right_side, logical_visual_overflow.MaxX());
1972 } 1972 }
1973 1973
1974 LayoutUnit logical_top = FirstTextBox()->LogicalTopVisualOverflow(); 1974 LayoutUnit logical_top = FirstTextBox()->LogicalTopVisualOverflow();
1975 LayoutUnit logical_width = logical_right_side - logical_left_side; 1975 LayoutUnit logical_width = logical_right_side - logical_left_side;
1976 LayoutUnit logical_height = 1976 LayoutUnit logical_height =
1977 LastTextBox()->LogicalBottomVisualOverflow() - logical_top; 1977 LastTextBox()->LogicalBottomVisualOverflow() - logical_top;
1978 1978
1979 // Inflate visual overflow if we have adjusted ascent/descent causing the
1980 // painted glyphs to overflow the layout geometries based on the adjusted
1981 // ascent/descent.
1982 unsigned inflation_for_ascent = 0;
1983 unsigned inflation_for_descent = 0;
1984 const auto* font_data =
1985 StyleRef(FirstTextBox()->IsFirstLineStyle()).GetFont().PrimaryFont();
1986 if (font_data)
1987 inflation_for_ascent = font_data->VisualOverflowInflationForAscent();
1988 if (LastTextBox()->IsFirstLineStyle() != FirstTextBox()->IsFirstLineStyle()) {
1989 font_data =
1990 StyleRef(LastTextBox()->IsFirstLineStyle()).GetFont().PrimaryFont();
1991 }
1992 if (font_data)
1993 inflation_for_descent = font_data->VisualOverflowInflationForDescent();
1994 logical_top -= LayoutUnit(inflation_for_ascent);
1995 logical_height += LayoutUnit(inflation_for_ascent + inflation_for_descent);
1996
1979 LayoutRect rect(logical_left_side, logical_top, logical_width, 1997 LayoutRect rect(logical_left_side, logical_top, logical_width,
1980 logical_height); 1998 logical_height);
1981 if (!Style()->IsHorizontalWritingMode()) 1999 if (!Style()->IsHorizontalWritingMode())
1982 rect = rect.TransposedRect(); 2000 rect = rect.TransposedRect();
1983 return rect; 2001 return rect;
1984 } 2002 }
1985 2003
1986 LayoutRect LayoutText::LocalVisualRect() const { 2004 LayoutRect LayoutText::LocalVisualRect() const {
1987 if (Style()->Visibility() != EVisibility::kVisible) 2005 if (Style()->Visibility() != EVisibility::kVisible)
1988 return LayoutRect(); 2006 return LayoutRect();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2112 LayoutRect rect = LayoutRect( 2130 LayoutRect rect = LayoutRect(
2113 IntRect(FirstRunX(), FirstRunY(), lines_box.Width(), lines_box.Height())); 2131 IntRect(FirstRunX(), FirstRunY(), lines_box.Width(), lines_box.Height()));
2114 LayoutBlock* block = ContainingBlock(); 2132 LayoutBlock* block = ContainingBlock();
2115 if (block && HasTextBoxes()) 2133 if (block && HasTextBoxes())
2116 block->AdjustChildDebugRect(rect); 2134 block->AdjustChildDebugRect(rect);
2117 2135
2118 return rect; 2136 return rect;
2119 } 2137 }
2120 2138
2121 } // namespace blink 2139 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698