OLD | NEW |
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 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 LayoutRect logicalVisualOverflow = curr->logicalOverflowRect(); | 1912 LayoutRect logicalVisualOverflow = curr->logicalOverflowRect(); |
1913 logicalLeftSide = std::min(logicalLeftSide, logicalVisualOverflow.x()); | 1913 logicalLeftSide = std::min(logicalLeftSide, logicalVisualOverflow.x()); |
1914 logicalRightSide = std::max(logicalRightSide, logicalVisualOverflow.maxX()); | 1914 logicalRightSide = std::max(logicalRightSide, logicalVisualOverflow.maxX()); |
1915 } | 1915 } |
1916 | 1916 |
1917 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); | 1917 LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow(); |
1918 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 1918 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
1919 LayoutUnit logicalHeight = | 1919 LayoutUnit logicalHeight = |
1920 lastTextBox()->logicalBottomVisualOverflow() - logicalTop; | 1920 lastTextBox()->logicalBottomVisualOverflow() - logicalTop; |
1921 | 1921 |
| 1922 // Inflate visual overflow if we have adjusted ascent/descent causing the |
| 1923 // painted glyphs to overflow the layout geometries based on the adjusted |
| 1924 // ascent/descent. |
| 1925 unsigned inflation_for_ascent = 0; |
| 1926 unsigned inflation_for_descent = 0; |
| 1927 const auto* font_data = |
| 1928 styleRef(firstTextBox()->isFirstLineStyle()).font().primaryFont(); |
| 1929 if (font_data) |
| 1930 inflation_for_ascent = font_data->VisualOverflowInflationForAscent(); |
| 1931 if (lastTextBox()->isFirstLineStyle() != firstTextBox()->isFirstLineStyle()) { |
| 1932 font_data = |
| 1933 styleRef(lastTextBox()->isFirstLineStyle()).font().primaryFont(); |
| 1934 } |
| 1935 if (font_data) |
| 1936 inflation_for_descent = font_data->VisualOverflowInflationForDescent(); |
| 1937 logicalTop -= LayoutUnit(inflation_for_ascent); |
| 1938 logicalHeight += LayoutUnit(inflation_for_ascent + inflation_for_descent); |
| 1939 |
1922 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 1940 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
1923 if (!style()->isHorizontalWritingMode()) | 1941 if (!style()->isHorizontalWritingMode()) |
1924 rect = rect.transposedRect(); | 1942 rect = rect.transposedRect(); |
1925 return rect; | 1943 return rect; |
1926 } | 1944 } |
1927 | 1945 |
1928 LayoutRect LayoutText::localVisualRect() const { | 1946 LayoutRect LayoutText::localVisualRect() const { |
1929 if (style()->visibility() != EVisibility::kVisible) | 1947 if (style()->visibility() != EVisibility::kVisible) |
1930 return LayoutRect(); | 1948 return LayoutRect(); |
1931 | 1949 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2054 LayoutRect rect = LayoutRect( | 2072 LayoutRect rect = LayoutRect( |
2055 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); | 2073 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); |
2056 LayoutBlock* block = containingBlock(); | 2074 LayoutBlock* block = containingBlock(); |
2057 if (block && hasTextBoxes()) | 2075 if (block && hasTextBoxes()) |
2058 block->adjustChildDebugRect(rect); | 2076 block->adjustChildDebugRect(rect); |
2059 | 2077 |
2060 return rect; | 2078 return rect; |
2061 } | 2079 } |
2062 | 2080 |
2063 } // namespace blink | 2081 } // namespace blink |
OLD | NEW |