| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> | 2 * Copyright (C) 2006 Oliver Hunt <ojh16@student.canterbury.ac.nz> |
| 3 * Copyright (C) 2006 Apple Computer Inc. | 3 * Copyright (C) 2006 Apple Computer Inc. |
| 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 5 * Copyright (C) 2008 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2008 Rob Buis <buis@kde.org> |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 return !SVGTextLayoutAttributes::isEmptyValue(it->value.x) || !SVGTextLayout
Attributes::isEmptyValue(it->value.y); | 151 return !SVGTextLayoutAttributes::isEmptyValue(it->value.x) || !SVGTextLayout
Attributes::isEmptyValue(it->value.y); |
| 152 } | 152 } |
| 153 | 153 |
| 154 PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& po
int) | 154 PositionWithAffinity LayoutSVGInlineText::positionForPoint(const LayoutPoint& po
int) |
| 155 { | 155 { |
| 156 if (!hasTextBoxes() || !textLength()) | 156 if (!hasTextBoxes() || !textLength()) |
| 157 return createPositionWithAffinity(0); | 157 return createPositionWithAffinity(0); |
| 158 | 158 |
| 159 ASSERT(m_scalingFactor); | 159 ASSERT(m_scalingFactor); |
| 160 float baseline = m_scaledFont.fontMetrics().floatAscent() / m_scalingFactor; | 160 float baseline = m_scaledFont.getFontMetrics().floatAscent() / m_scalingFact
or; |
| 161 | 161 |
| 162 LayoutBlock* containingBlock = this->containingBlock(); | 162 LayoutBlock* containingBlock = this->containingBlock(); |
| 163 ASSERT(containingBlock); | 163 ASSERT(containingBlock); |
| 164 | 164 |
| 165 // Map local point to absolute point, as the character origins stored in the
text fragments use absolute coordinates. | 165 // Map local point to absolute point, as the character origins stored in the
text fragments use absolute coordinates. |
| 166 FloatPoint absolutePoint(point); | 166 FloatPoint absolutePoint(point); |
| 167 absolutePoint.moveBy(containingBlock->location()); | 167 absolutePoint.moveBy(containingBlock->location()); |
| 168 | 168 |
| 169 float closestDistance = std::numeric_limits<float>::max(); | 169 float closestDistance = std::numeric_limits<float>::max(); |
| 170 float closestDistancePosition = 0; | 170 float closestDistancePosition = 0; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 ASSERT(layoutObject); | 211 ASSERT(layoutObject); |
| 212 | 212 |
| 213 // Alter font-size to the right on-screen value to avoid scaling the glyphs
themselves, except when GeometricPrecision is specified. | 213 // Alter font-size to the right on-screen value to avoid scaling the glyphs
themselves, except when GeometricPrecision is specified. |
| 214 scalingFactor = SVGLayoutSupport::calculateScreenFontSizeScalingFactor(layou
tObject); | 214 scalingFactor = SVGLayoutSupport::calculateScreenFontSizeScalingFactor(layou
tObject); |
| 215 if (style->effectiveZoom() == 1 && (scalingFactor == 1 || !scalingFactor)) { | 215 if (style->effectiveZoom() == 1 && (scalingFactor == 1 || !scalingFactor)) { |
| 216 scalingFactor = 1; | 216 scalingFactor = 1; |
| 217 scaledFont = style->font(); | 217 scaledFont = style->font(); |
| 218 return; | 218 return; |
| 219 } | 219 } |
| 220 | 220 |
| 221 if (style->fontDescription().textRendering() == GeometricPrecision) | 221 if (style->getFontDescription().textRendering() == GeometricPrecision) |
| 222 scalingFactor = 1; | 222 scalingFactor = 1; |
| 223 | 223 |
| 224 FontDescription fontDescription(style->fontDescription()); | 224 FontDescription fontDescription(style->getFontDescription()); |
| 225 | 225 |
| 226 Document& document = layoutObject->document(); | 226 Document& document = layoutObject->document(); |
| 227 // FIXME: We need to better handle the case when we compute very small fonts
below (below 1pt). | 227 // FIXME: We need to better handle the case when we compute very small fonts
below (below 1pt). |
| 228 fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(&
document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.speci
fiedSize(), DoNotUseSmartMinimumForFontSize)); | 228 fontDescription.setComputedSize(FontSize::getComputedSizeFromSpecifiedSize(&
document, scalingFactor, fontDescription.isAbsoluteSize(), fontDescription.speci
fiedSize(), DoNotUseSmartMinimumForFontSize)); |
| 229 | 229 |
| 230 scaledFont = Font(fontDescription); | 230 scaledFont = Font(fontDescription); |
| 231 scaledFont.update(document.styleEngine().fontSelector()); | 231 scaledFont.update(document.styleEngine().fontSelector()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 LayoutRect LayoutSVGInlineText::clippedOverflowRectForPaintInvalidation(const La
youtBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* pa
intInvalidationState) const | 234 LayoutRect LayoutSVGInlineText::clippedOverflowRectForPaintInvalidation(const La
youtBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* pa
intInvalidationState) const |
| 235 { | 235 { |
| 236 // FIXME: The following works because LayoutSVGBlock has forced slow rect ma
pping of the paintInvalidationState. | 236 // FIXME: The following works because LayoutSVGBlock has forced slow rect ma
pping of the paintInvalidationState. |
| 237 // Should let this really work with paintInvalidationState's fast mapping an
d remove the assert. | 237 // Should let this really work with paintInvalidationState's fast mapping an
d remove the assert. |
| 238 ASSERT(!paintInvalidationState || !paintInvalidationState->canMapToContainer
(paintInvalidationContainer)); | 238 ASSERT(!paintInvalidationState || !paintInvalidationState->canMapToContainer
(paintInvalidationContainer)); |
| 239 return parent()->clippedOverflowRectForPaintInvalidation(paintInvalidationCo
ntainer, paintInvalidationState); | 239 return parent()->clippedOverflowRectForPaintInvalidation(paintInvalidationCo
ntainer, paintInvalidationState); |
| 240 } | 240 } |
| 241 | 241 |
| 242 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const | 242 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const |
| 243 { | 243 { |
| 244 RefPtr<StringImpl> result = LayoutText::originalText(); | 244 RefPtr<StringImpl> result = LayoutText::originalText(); |
| 245 if (!result) | 245 if (!result) |
| 246 return nullptr; | 246 return nullptr; |
| 247 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); | 247 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P
RE); |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |