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

Side by Side Diff: Source/core/layout/line/GlyphOverflow.h

Issue 1328803003: Remove GlyphOverflow.computeBounds as it's no longer used for -webkit-line-box-contain. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « Source/core/layout/LayoutText.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2007, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Holger Hans Peter Freyther 6 * Copyright (C) 2008 Holger Hans Peter Freyther
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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 * 22 *
23 */ 23 */
24 24
25 #ifndef GlyphOverflow_h 25 #ifndef GlyphOverflow_h
26 #define GlyphOverflow_h 26 #define GlyphOverflow_h
27 27
28 #include "platform/geometry/FloatRect.h" 28 #include "platform/geometry/FloatRect.h"
29 #include "wtf/Allocator.h" 29 #include "wtf/Allocator.h"
30 #include <math.h> 30 #include <algorithm>
31 31
32 namespace blink { 32 namespace blink {
33 33
34 struct GlyphOverflow { 34 struct GlyphOverflow {
35 STACK_ALLOCATED(); 35 STACK_ALLOCATED();
36 GlyphOverflow() 36 GlyphOverflow()
37 : left(0) 37 : left(0)
38 , right(0) 38 , right(0)
39 , top(0) 39 , top(0)
40 , bottom(0) 40 , bottom(0)
41 , computeBounds(false)
42 { 41 {
43 } 42 }
44 43
45 bool isZero() const 44 bool isZero() const
46 { 45 {
47 return !left && !right && !top && !bottom; 46 return !left && !right && !top && !bottom;
48 } 47 }
49 48
50 void setFromBounds(const FloatRect& bounds, float ascent, float descent, flo at textWidth) 49 void setFromBounds(const FloatRect& bounds, float ascent, float descent, flo at textWidth)
51 { 50 {
52 top = ceilf(computeBounds ? -bounds.y() : std::max(0.0f, -bounds.y() - a scent)); 51 top = ceilf(std::max(0.0f, -bounds.y() - ascent));
53 bottom = ceilf(computeBounds ? bounds.maxY() : std::max(0.0f, bounds.max Y() - descent)); 52 bottom = ceilf(std::max(0.0f, bounds.maxY() - descent));
54 left = ceilf(std::max(0.0f, -bounds.x())); 53 left = ceilf(std::max(0.0f, -bounds.x()));
55 right = ceilf(std::max(0.0f, bounds.maxX() - textWidth)); 54 right = ceilf(std::max(0.0f, bounds.maxX() - textWidth));
56 } 55 }
57 56
58 // If computeBounds, top and bottom are the maximum heights of the glyphs ab ove and below the baseline, respectively. 57 // Top and bottom are the amounts of glyph overflows exceeding the font metr ics' ascent and descent, respectively.
59 // Otherwise they are the amounts of glyph overflows exceeding the font metr ics' ascent and descent, respectively.
60 // Left and right are the amounts of glyph overflows exceeding the left and right edge of normal layout boundary, respectively. 58 // Left and right are the amounts of glyph overflows exceeding the left and right edge of normal layout boundary, respectively.
61 // All fields are in absolute number of pixels rounded up to the nearest int eger. 59 // All fields are in absolute number of pixels rounded up to the nearest int eger.
62 int left; 60 int left;
63 int right; 61 int right;
64 int top; 62 int top;
65 int bottom; 63 int bottom;
66 bool computeBounds;
67 }; 64 };
68 65
69 } // namespace blink 66 } // namespace blink
70 67
71 #endif // GlyphOverflow_h 68 #endif // GlyphOverflow_h
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutText.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698