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

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderText.cpp

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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 * (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 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
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 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 } 1060 }
1061 result.setWidth(rightSide - leftSide); 1061 result.setWidth(rightSide - leftSide);
1062 result.setX(leftSide); 1062 result.setX(leftSide);
1063 result.setHeight(lastTextBox()->yPos() + lastTextBox()->height() - first TextBox()->yPos()); 1063 result.setHeight(lastTextBox()->yPos() + lastTextBox()->height() - first TextBox()->yPos());
1064 result.setY(firstTextBox()->yPos()); 1064 result.setY(firstTextBox()->yPos());
1065 } 1065 }
1066 1066
1067 return result; 1067 return result;
1068 } 1068 }
1069 1069
1070 IntRect RenderText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintC ontainer) 1070 IntRect RenderText::clippedOverflowRectForRepaint(RenderBox* repaintContainer)
1071 { 1071 {
1072 RenderObject* cb = containingBlock(); 1072 RenderObject* cb = containingBlock();
1073 return cb->clippedOverflowRectForRepaint(repaintContainer); 1073 return cb->clippedOverflowRectForRepaint(repaintContainer);
1074 } 1074 }
1075 1075
1076 IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContain er, bool clipToVisibleContent) 1076 IntRect RenderText::selectionRectForRepaint(RenderBox* repaintContainer, bool cl ipToVisibleContent)
1077 { 1077 {
1078 ASSERT(!needsLayout()); 1078 ASSERT(!needsLayout());
1079 1079
1080 if (selectionState() == SelectionNone) 1080 if (selectionState() == SelectionNone)
1081 return IntRect(); 1081 return IntRect();
1082 RenderBlock* cb = containingBlock(); 1082 RenderBlock* cb = containingBlock();
1083 if (!cb) 1083 if (!cb)
1084 return IntRect(); 1084 return IntRect();
1085 1085
1086 // Now calculate startPos and endPos for painting selection. 1086 // Now calculate startPos and endPos for painting selection.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 if (!iterator) 1161 if (!iterator)
1162 return current - 1; 1162 return current - 1;
1163 1163
1164 long result = textBreakPreceding(iterator, current); 1164 long result = textBreakPreceding(iterator, current);
1165 if (result == TextBreakDone) 1165 if (result == TextBreakDone)
1166 result = current - 1; 1166 result = current - 1;
1167 1167
1168 return result; 1168 return result;
1169 } 1169 }
1170 1170
1171 #define HANGUL_CHOSEONG_START (0x1100)
1172 #define HANGUL_CHOSEONG_END (0x115F)
1173 #define HANGUL_JUNGSEONG_START (0x1160)
1174 #define HANGUL_JUNGSEONG_END (0x11A2)
1175 #define HANGUL_JONGSEONG_START (0x11A8)
1176 #define HANGUL_JONGSEONG_END (0x11F9)
1177 #define HANGUL_SYLLABLE_START (0xAC00)
1178 #define HANGUL_SYLLABLE_END (0xD7AF)
1179 #define HANGUL_JONGSEONG_COUNT (28)
1180
1181 enum HangulState {
1182 HangulStateL,
1183 HangulStateV,
1184 HangulStateT,
1185 HangulStateLV,
1186 HangulStateLVT,
1187 HangulStateBreak
1188 };
1189
1190 inline bool isHangulLVT(UChar32 character)
1191 {
1192 return (character - HANGUL_SYLLABLE_START) % HANGUL_JONGSEONG_COUNT;
1193 }
1194
1195 int RenderText::previousOffsetForBackwardDeletion(int current) const
1196 {
1197 #if PLATFORM(MAC)
1198 UChar32 character;
1199 while (current > 0) {
1200 if (U16_IS_TRAIL((*m_text)[--current]))
1201 --current;
1202 if (current < 0)
1203 break;
1204
1205 UChar32 character = m_text->characterStartingAt(current);
1206
1207 // We don't combine characters in Armenian ... Limbu range for backward deletion.
1208 if ((character >= 0x0530) && (character < 0x1950))
1209 break;
1210
1211 if (u_isbase(character) && (character != 0xFF9E) && (character != 0xFF9F ))
1212 break;
1213 }
1214
1215 if (current <= 0)
1216 return current;
1217
1218 // Hangul
1219 character = m_text->characterStartingAt(current);
1220 if (((character >= HANGUL_CHOSEONG_START) && (character <= HANGUL_JONGSEONG_ END)) || ((character >= HANGUL_SYLLABLE_START) && (character <= HANGUL_SYLLABLE_ END))) {
1221 HangulState state;
1222 HangulState initialState;
1223
1224 if (character < HANGUL_JUNGSEONG_START)
1225 state = HangulStateL;
1226 else if (character < HANGUL_JONGSEONG_START)
1227 state = HangulStateV;
1228 else if (character < HANGUL_SYLLABLE_START)
1229 state = HangulStateT;
1230 else
1231 state = isHangulLVT(character) ? HangulStateLVT : HangulStateLV;
1232
1233 initialState = state;
1234
1235 while (current > 0 && ((character = m_text->characterStartingAt(current - 1)) >= HANGUL_CHOSEONG_START) && (character <= HANGUL_SYLLABLE_END) && ((chara cter <= HANGUL_JONGSEONG_END) || (character >= HANGUL_SYLLABLE_START))) {
1236 switch (state) {
1237 case HangulStateV:
1238 if (character <= HANGUL_CHOSEONG_END)
1239 state = HangulStateL;
1240 else if ((character >= HANGUL_SYLLABLE_START) && (character <= H ANGUL_SYLLABLE_END) && !isHangulLVT(character))
1241 state = HangulStateLV;
1242 else if (character > HANGUL_JUNGSEONG_END)
1243 state = HangulStateBreak;
1244 break;
1245 case HangulStateT:
1246 if ((character >= HANGUL_JUNGSEONG_START) && (character <= HANGU L_JUNGSEONG_END))
1247 state = HangulStateV;
1248 else if ((character >= HANGUL_SYLLABLE_START) && (character <= H ANGUL_SYLLABLE_END))
1249 state = (isHangulLVT(character) ? HangulStateLVT : HangulSta teLV);
1250 else if (character < HANGUL_JUNGSEONG_START)
1251 state = HangulStateBreak;
1252 break;
1253 default:
1254 state = (character < HANGUL_JUNGSEONG_START) ? HangulStateL : Ha ngulStateBreak;
1255 break;
1256 }
1257 if (state == HangulStateBreak)
1258 break;
1259
1260 --current;
1261 }
1262 }
1263
1264 return current;
1265 #else
1266 // Platforms other than Mac delete by one code point.
1267 return current - 1;
1268 #endif
1269 }
1270
1271 int RenderText::nextOffset(int current) const 1171 int RenderText::nextOffset(int current) const
1272 { 1172 {
1273 StringImpl* si = m_text.get(); 1173 StringImpl* si = m_text.get();
1274 TextBreakIterator* iterator = characterBreakIterator(si->characters(), si->l ength()); 1174 TextBreakIterator* iterator = characterBreakIterator(si->characters(), si->l ength());
1275 if (!iterator) 1175 if (!iterator)
1276 return current + 1; 1176 return current + 1;
1277 1177
1278 long result = textBreakFollowing(iterator, current); 1178 long result = textBreakFollowing(iterator, current);
1279 if (result == TextBreakDone) 1179 if (result == TextBreakDone)
1280 result = current + 1; 1180 result = current + 1;
(...skipping 12 matching lines...) Expand all
1293 ASSERT(child->prevTextBox() == prev); 1193 ASSERT(child->prevTextBox() == prev);
1294 prev = child; 1194 prev = child;
1295 } 1195 }
1296 ASSERT(prev == m_lastTextBox); 1196 ASSERT(prev == m_lastTextBox);
1297 #endif 1197 #endif
1298 } 1198 }
1299 1199
1300 #endif 1200 #endif
1301 1201
1302 } // namespace WebCore 1202 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderText.h ('k') | third_party/WebKit/WebCore/rendering/RenderTextControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698