| OLD | NEW |
| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // change the height and y position because selectionRect us
es selection-specific values | 234 // change the height and y position because selectionRect us
es selection-specific values |
| 235 r.setHeight(box->height()); | 235 r.setHeight(box->height()); |
| 236 r.setY(absPos.y() + box->yPos()); | 236 r.setY(absPos.y() + box->yPos()); |
| 237 } | 237 } |
| 238 rects.append(r); | 238 rects.append(r); |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 | 243 |
| 244 void RenderText::absoluteQuads(Vector<FloatQuad>& quads, bool topLevel) |
| 245 { |
| 246 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) |
| 247 quads.append(localToAbsoluteQuad(FloatRect(box->xPos(), box->yPos(), box
->width(), box->height()))); |
| 248 } |
| 249 |
| 250 void RenderText::collectAbsoluteLineBoxQuads(Vector<FloatQuad>& quads, unsigned
start, unsigned end, bool useSelectionHeight) |
| 251 { |
| 252 // Work around signed/unsigned issues. This function takes unsigneds, and is
often passed UINT_MAX |
| 253 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds
, so changing this |
| 254 // function to take ints causes various internal mismatches. But selectionRe
ct takes ints, and |
| 255 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect
to take unsigneds, but |
| 256 // that would cause many ripple effects, so for now we'll just clamp our uns
igned parameters to INT_MAX. |
| 257 ASSERT(end == UINT_MAX || end <= INT_MAX); |
| 258 ASSERT(start <= INT_MAX); |
| 259 start = min(start, static_cast<unsigned>(INT_MAX)); |
| 260 end = min(end, static_cast<unsigned>(INT_MAX)); |
| 261 |
| 262 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
| 263 // Note: box->end() returns the index of the last character, not the ind
ex past it |
| 264 if (start <= box->start() && box->end() < end) { |
| 265 IntRect r = IntRect(box->xPos(), box->yPos(), box->width(), box->hei
ght()); |
| 266 if (useSelectionHeight) { |
| 267 IntRect selectionRect = box->selectionRect(0, 0, start, end); |
| 268 r.setHeight(selectionRect.height()); |
| 269 r.setY(selectionRect.y()); |
| 270 } |
| 271 quads.append(localToAbsoluteQuad(FloatRect(r))); |
| 272 } else { |
| 273 unsigned realEnd = min(box->end() + 1, end); |
| 274 IntRect r = box->selectionRect(0, 0, start, realEnd); |
| 275 if (!r.isEmpty()) { |
| 276 if (!useSelectionHeight) { |
| 277 // change the height and y position because selectionRect us
es selection-specific values |
| 278 r.setHeight(box->height()); |
| 279 r.setY(box->yPos()); |
| 280 } |
| 281 quads.append(localToAbsoluteQuad(FloatRect(r))); |
| 282 } |
| 283 } |
| 284 } |
| 285 } |
| 286 |
| 244 InlineTextBox* RenderText::findNextInlineTextBox(int offset, int& pos) const | 287 InlineTextBox* RenderText::findNextInlineTextBox(int offset, int& pos) const |
| 245 { | 288 { |
| 246 // The text runs point to parts of the RenderText's m_text | 289 // The text runs point to parts of the RenderText's m_text |
| 247 // (they don't include '\n') | 290 // (they don't include '\n') |
| 248 // Find the text run that includes the character at offset | 291 // Find the text run that includes the character at offset |
| 249 // and return pos, which is the position of the char in the run. | 292 // and return pos, which is the position of the char in the run. |
| 250 | 293 |
| 251 if (!m_firstTextBox) | 294 if (!m_firstTextBox) |
| 252 return 0; | 295 return 0; |
| 253 | 296 |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 ASSERT(child->prevTextBox() == prev); | 1205 ASSERT(child->prevTextBox() == prev); |
| 1163 prev = child; | 1206 prev = child; |
| 1164 } | 1207 } |
| 1165 ASSERT(prev == m_lastTextBox); | 1208 ASSERT(prev == m_lastTextBox); |
| 1166 #endif | 1209 #endif |
| 1167 } | 1210 } |
| 1168 | 1211 |
| 1169 #endif | 1212 #endif |
| 1170 | 1213 |
| 1171 } // namespace WebCore | 1214 } // namespace WebCore |
| OLD | NEW |