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

Side by Side Diff: sky/engine/core/rendering/RenderCombineText.cpp

Issue 677843004: Remove text-combine. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « sky/engine/core/rendering/RenderCombineText.h ('k') | sky/engine/core/rendering/RenderText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21 #include "config.h"
22 #include "core/rendering/RenderCombineText.h"
23
24 #include "core/rendering/TextRunConstructor.h"
25
26 namespace blink {
27
28 RenderCombineText::RenderCombineText(Node* node, PassRefPtr<StringImpl> string)
29 : RenderText(node, string)
30 , m_combinedTextWidth(0)
31 , m_isCombined(false)
32 , m_needsFontUpdate(false)
33 {
34 }
35
36 void RenderCombineText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
37 {
38 setStyleInternal(RenderStyle::clone(style()));
39 RenderText::styleDidChange(diff, oldStyle);
40
41 if (m_isCombined) {
42 RenderText::setTextInternal(originalText()); // This RenderCombineText h as been combined once. Restore the original text for the next combineText().
43 m_isCombined = false;
44 }
45
46 m_needsFontUpdate = true;
47 }
48
49 void RenderCombineText::setTextInternal(PassRefPtr<StringImpl> text)
50 {
51 RenderText::setTextInternal(text);
52
53 m_needsFontUpdate = true;
54 }
55
56 float RenderCombineText::width(unsigned from, unsigned length, const Font& font, float xPosition, TextDirection direction, HashSet<const SimpleFontData*>* fallb ackFonts, GlyphOverflow* glyphOverflow) const
57 {
58 if (!length)
59 return 0;
60
61 if (hasEmptyText())
62 return 0;
63
64 if (m_isCombined)
65 return font.fontDescription().computedSize();
66
67 return RenderText::width(from, length, font, xPosition, direction, fallbackF onts, glyphOverflow);
68 }
69
70 void RenderCombineText::adjustTextOrigin(FloatPoint& textOrigin, const FloatRect & boxRect) const
71 {
72 if (m_isCombined)
73 textOrigin.move(boxRect.height() / 2 - ceilf(m_combinedTextWidth) / 2, s tyle()->font().fontDescription().computedPixelSize());
74 }
75
76 void RenderCombineText::getStringToRender(int start, StringView& string, int& le ngth) const
77 {
78 ASSERT(start >= 0);
79 if (m_isCombined) {
80 string = StringView(m_renderingText.impl());
81 length = string.length();
82 return;
83 }
84
85 string = text().createView(start, length);
86 }
87
88 void RenderCombineText::combineText()
89 {
90 if (!m_needsFontUpdate)
91 return;
92
93 m_isCombined = false;
94 m_needsFontUpdate = false;
95
96 // CSS3 spec says text-combine works only in vertical writing mode.
97 // FIXME(sky): Remove
98 }
99
100 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderCombineText.h ('k') | sky/engine/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698