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

Side by Side Diff: Source/core/layout/svg/LayoutSVGInlineText.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 { 66 {
67 } 67 }
68 68
69 void LayoutSVGInlineText::setTextInternal(PassRefPtr<StringImpl> text) 69 void LayoutSVGInlineText::setTextInternal(PassRefPtr<StringImpl> text)
70 { 70 {
71 LayoutText::setTextInternal(text); 71 LayoutText::setTextInternal(text);
72 if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAnce stor(this)) 72 if (LayoutSVGText* textLayoutObject = LayoutSVGText::locateLayoutSVGTextAnce stor(this))
73 textLayoutObject->subtreeTextDidChange(this); 73 textLayoutObject->subtreeTextDidChange(this);
74 } 74 }
75 75
76 void LayoutSVGInlineText::styleDidChange(StyleDifference diff, const LayoutStyle * oldStyle) 76 void LayoutSVGInlineText::styleDidChange(StyleDifference diff, const ComputedSty le* oldStyle)
77 { 77 {
78 LayoutText::styleDidChange(diff, oldStyle); 78 LayoutText::styleDidChange(diff, oldStyle);
79 updateScaledFont(); 79 updateScaledFont();
80 80
81 bool newPreserves = style() ? style()->whiteSpace() == PRE : false; 81 bool newPreserves = style() ? style()->whiteSpace() == PRE : false;
82 bool oldPreserves = oldStyle ? oldStyle->whiteSpace() == PRE : false; 82 bool oldPreserves = oldStyle ? oldStyle->whiteSpace() == PRE : false;
83 if (oldPreserves != newPreserves) { 83 if (oldPreserves != newPreserves) {
84 setText(originalText(), true); 84 setText(originalText(), true);
85 return; 85 return;
86 } 86 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanc eFragment, absolutePoint.x() - closestDistancePosition, true); 202 int offset = closestDistanceBox->offsetForPositionInFragment(*closestDistanc eFragment, absolutePoint.x() - closestDistancePosition, true);
203 return createPositionWithAffinity(offset + closestDistanceBox->start(), offs et > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM); 203 return createPositionWithAffinity(offset + closestDistanceBox->start(), offs et > 0 ? VP_UPSTREAM_IF_POSSIBLE : DOWNSTREAM);
204 } 204 }
205 205
206 void LayoutSVGInlineText::updateScaledFont() 206 void LayoutSVGInlineText::updateScaledFont()
207 { 207 {
208 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont); 208 computeNewScaledFontForStyle(this, style(), m_scalingFactor, m_scaledFont);
209 } 209 }
210 210
211 void LayoutSVGInlineText::computeNewScaledFontForStyle(LayoutObject* layoutObjec t, const LayoutStyle* style, float& scalingFactor, Font& scaledFont) 211 void LayoutSVGInlineText::computeNewScaledFontForStyle(LayoutObject* layoutObjec t, const ComputedStyle* style, float& scalingFactor, Font& scaledFont)
212 { 212 {
213 ASSERT(style); 213 ASSERT(style);
214 ASSERT(layoutObject); 214 ASSERT(layoutObject);
215 215
216 // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified. 216 // Alter font-size to the right on-screen value to avoid scaling the glyphs themselves, except when GeometricPrecision is specified.
217 scalingFactor = SVGLayoutSupport::calculateScreenFontSizeScalingFactor(layou tObject); 217 scalingFactor = SVGLayoutSupport::calculateScreenFontSizeScalingFactor(layou tObject);
218 if (style->effectiveZoom() == 1 && (scalingFactor == 1 || !scalingFactor)) { 218 if (style->effectiveZoom() == 1 && (scalingFactor == 1 || !scalingFactor)) {
219 scalingFactor = 1; 219 scalingFactor = 1;
220 scaledFont = style->font(); 220 scaledFont = style->font();
221 return; 221 return;
(...skipping 22 matching lines...) Expand all
244 244
245 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const 245 PassRefPtr<StringImpl> LayoutSVGInlineText::originalText() const
246 { 246 {
247 RefPtr<StringImpl> result = LayoutText::originalText(); 247 RefPtr<StringImpl> result = LayoutText::originalText();
248 if (!result) 248 if (!result)
249 return nullptr; 249 return nullptr;
250 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P RE); 250 return applySVGWhitespaceRules(result, style() && style()->whiteSpace() == P RE);
251 } 251 }
252 252
253 } 253 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGInlineText.h ('k') | Source/core/layout/svg/LayoutSVGModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698