| Index: third_party/WebKit/Source/core/layout/line/GlyphOverflow.h
|
| diff --git a/third_party/WebKit/Source/core/layout/line/GlyphOverflow.h b/third_party/WebKit/Source/core/layout/line/GlyphOverflow.h
|
| index f13382f1327e7e476c88e6c15ee4440be7134370..2d147ce9699a7e4dad28b4d8510b3ed7061e47a8 100644
|
| --- a/third_party/WebKit/Source/core/layout/line/GlyphOverflow.h
|
| +++ b/third_party/WebKit/Source/core/layout/line/GlyphOverflow.h
|
| @@ -46,12 +46,31 @@ struct GlyphOverflow {
|
| return !left && !right && !top && !bottom;
|
| }
|
|
|
| + // These helper functions are exposed to share logic with SVG which computes overflow
|
| + // in floating point (see: SVGTextLayoutEngine).
|
| + static float topOverflow(const FloatRect& bounds, float ascent)
|
| + {
|
| + return ceilf(std::max(0.0f, -bounds.y() - ascent));
|
| + }
|
| + static float bottomOverflow(const FloatRect& bounds, float descent)
|
| + {
|
| + return ceilf(std::max(0.0f, bounds.maxY() - descent));
|
| + }
|
| + static float leftOverflow(const FloatRect& bounds)
|
| + {
|
| + return ceilf(std::max(0.0f, -bounds.x()));
|
| + }
|
| + static float rightOverflow(const FloatRect& bounds, float textWidth)
|
| + {
|
| + return ceilf(std::max(0.0f, bounds.maxX() - textWidth));
|
| + }
|
| +
|
| void setFromBounds(const FloatRect& bounds, float ascent, float descent, float textWidth)
|
| {
|
| - top = ceilf(std::max(0.0f, -bounds.y() - ascent));
|
| - bottom = ceilf(std::max(0.0f, bounds.maxY() - descent));
|
| - left = ceilf(std::max(0.0f, -bounds.x()));
|
| - right = ceilf(std::max(0.0f, bounds.maxX() - textWidth));
|
| + top = topOverflow(bounds, ascent);
|
| + bottom = bottomOverflow(bounds, descent);
|
| + left = leftOverflow(bounds);
|
| + right = rightOverflow(bounds, textWidth);
|
| }
|
|
|
| // Top and bottom are the amounts of glyph overflows exceeding the font metrics' ascent and descent, respectively.
|
|
|