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

Side by Side Diff: WebCore/rendering/RenderTextFragment.cpp

Issue 3324013: Merge 66911 - 2010-09-07 Abhishek Arya <inferno@chromium.org>... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/517/
Patch Set: Created 10 years, 3 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
« no previous file with comments | « LayoutTests/fast/text/one-letter-transform-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 30 matching lines...) Expand all
41 , m_end(str ? str->length() : 0) 41 , m_end(str ? str->length() : 0)
42 , m_contentString(str) 42 , m_contentString(str)
43 , m_firstLetter(0) 43 , m_firstLetter(0)
44 { 44 {
45 } 45 }
46 46
47 PassRefPtr<StringImpl> RenderTextFragment::originalText() const 47 PassRefPtr<StringImpl> RenderTextFragment::originalText() const
48 { 48 {
49 Node* e = node(); 49 Node* e = node();
50 RefPtr<StringImpl> result = ((e && e->isTextNode()) ? static_cast<Text*>(e)- >dataImpl() : contentString()); 50 RefPtr<StringImpl> result = ((e && e->isTextNode()) ? static_cast<Text*>(e)- >dataImpl() : contentString());
51 if (result && (start() > 0 || start() < result->length())) 51 if (!result)
52 result = result->substring(start(), end()); 52 return 0;
53 return result.release(); 53 return result->substring(start(), end());
54 } 54 }
55 55
56 void RenderTextFragment::destroy() 56 void RenderTextFragment::destroy()
57 { 57 {
58 if (m_firstLetter) 58 if (m_firstLetter)
59 m_firstLetter->destroy(); 59 m_firstLetter->destroy();
60 RenderText::destroy(); 60 RenderText::destroy();
61 } 61 }
62 62
63 void RenderTextFragment::setTextInternal(PassRefPtr<StringImpl> text) 63 void RenderTextFragment::setTextInternal(PassRefPtr<StringImpl> text)
(...skipping 10 matching lines...) Expand all
74 t->setRenderer(this); 74 t->setRenderer(this);
75 } 75 }
76 } 76 }
77 } 77 }
78 78
79 UChar RenderTextFragment::previousCharacter() const 79 UChar RenderTextFragment::previousCharacter() const
80 { 80 {
81 if (start()) { 81 if (start()) {
82 Node* e = node(); 82 Node* e = node();
83 StringImpl* original = ((e && e->isTextNode()) ? static_cast<Text*>(e)- >dataImpl() : contentString()); 83 StringImpl* original = ((e && e->isTextNode()) ? static_cast<Text*>(e)- >dataImpl() : contentString());
84 if (original) 84 if (original && start() <= original->length())
85 return (*original)[start() - 1]; 85 return (*original)[start() - 1];
86 } 86 }
87 87
88 return RenderText::previousCharacter(); 88 return RenderText::previousCharacter();
89 } 89 }
90 90
91 } // namespace WebCore 91 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/text/one-letter-transform-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698