| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 5 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 7 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 8 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 8 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 9 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
| 10 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 10 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 const SimpleFontData* fontData = font.primaryFont(); | 753 const SimpleFontData* fontData = font.primaryFont(); |
| 754 DCHECK(fontData); | 754 DCHECK(fontData); |
| 755 if (!fontData) | 755 if (!fontData) |
| 756 return metrics; | 756 return metrics; |
| 757 | 757 |
| 758 TextDirection direction; | 758 TextDirection direction; |
| 759 if (state().getDirection() == CanvasRenderingContext2DState::DirectionInherit) | 759 if (state().getDirection() == CanvasRenderingContext2DState::DirectionInherit) |
| 760 direction = determineDirectionality(text); | 760 direction = determineDirectionality(text); |
| 761 else | 761 else |
| 762 direction = toTextDirection(state().getDirection(), canvas()); | 762 direction = toTextDirection(state().getDirection(), canvas()); |
| 763 TextRun textRun(text, 0, 0, TextRun::AllowTrailingExpansion | | 763 TextRun textRun( |
| 764 TextRun::ForbidLeadingExpansion, | 764 text, 0, 0, |
| 765 direction, false); | 765 TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, |
| 766 direction, false); |
| 766 textRun.setNormalizeSpace(true); | 767 textRun.setNormalizeSpace(true); |
| 767 FloatRect textBounds = font.selectionRectForText( | 768 FloatRect textBounds = font.selectionRectForText( |
| 768 textRun, FloatPoint(), font.getFontDescription().computedSize(), 0, -1, | 769 textRun, FloatPoint(), font.getFontDescription().computedSize(), 0, -1, |
| 769 true); | 770 true); |
| 770 | 771 |
| 771 // x direction | 772 // x direction |
| 772 metrics->setWidth(font.width(textRun)); | 773 metrics->setWidth(font.width(textRun)); |
| 773 metrics->setActualBoundingBoxLeft(-textBounds.x()); | 774 metrics->setActualBoundingBoxLeft(-textBounds.x()); |
| 774 metrics->setActualBoundingBoxRight(textBounds.maxX()); | 775 metrics->setActualBoundingBoxRight(textBounds.maxX()); |
| 775 | 776 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 } | 1158 } |
| 1158 return true; | 1159 return true; |
| 1159 } | 1160 } |
| 1160 | 1161 |
| 1161 void CanvasRenderingContext2D::resetUsageTracking() { | 1162 void CanvasRenderingContext2D::resetUsageTracking() { |
| 1162 UsageCounters newCounters; | 1163 UsageCounters newCounters; |
| 1163 m_usageCounters = newCounters; | 1164 m_usageCounters = newCounters; |
| 1164 } | 1165 } |
| 1165 | 1166 |
| 1166 } // namespace blink | 1167 } // namespace blink |
| OLD | NEW |