| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 textBox->nextTextBox()->start() > textBox->end() && text.length() && | 326 textBox->nextTextBox()->start() > textBox->end() && text.length() && |
| 327 !text.right(1).containsOnlyWhitespace()) | 327 !text.right(1).containsOnlyWhitespace()) |
| 328 plainTextBuilder.append(spaceCharacter); | 328 plainTextBuilder.append(spaceCharacter); |
| 329 } | 329 } |
| 330 return plainTextBuilder.toString(); | 330 return plainTextBuilder.toString(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void LayoutText::absoluteRects(Vector<IntRect>& rects, | 333 void LayoutText::absoluteRects(Vector<IntRect>& rects, |
| 334 const LayoutPoint& accumulatedOffset) const { | 334 const LayoutPoint& accumulatedOffset) const { |
| 335 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { | 335 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { |
| 336 rects.append(enclosingIntRect(LayoutRect( | 336 rects.push_back(enclosingIntRect(LayoutRect( |
| 337 LayoutPoint(accumulatedOffset) + box->location(), box->size()))); | 337 LayoutPoint(accumulatedOffset) + box->location(), box->size()))); |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 static FloatRect localQuadForTextBox(InlineTextBox* box, | 341 static FloatRect localQuadForTextBox(InlineTextBox* box, |
| 342 unsigned start, | 342 unsigned start, |
| 343 unsigned end, | 343 unsigned end, |
| 344 bool useSelectionHeight) { | 344 bool useSelectionHeight) { |
| 345 unsigned realEnd = std::min(box->end() + 1, end); | 345 unsigned realEnd = std::min(box->end() + 1, end); |
| 346 LayoutRect r = box->localSelectionRect(start, realEnd); | 346 LayoutRect r = box->localSelectionRect(start, realEnd); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 if (useSelectionHeight) { | 385 if (useSelectionHeight) { |
| 386 LayoutRect selectionRect = box->localSelectionRect(start, end); | 386 LayoutRect selectionRect = box->localSelectionRect(start, end); |
| 387 if (box->isHorizontal()) { | 387 if (box->isHorizontal()) { |
| 388 r.setHeight(selectionRect.height().toFloat()); | 388 r.setHeight(selectionRect.height().toFloat()); |
| 389 r.setY(selectionRect.y().toFloat()); | 389 r.setY(selectionRect.y().toFloat()); |
| 390 } else { | 390 } else { |
| 391 r.setWidth(selectionRect.width().toFloat()); | 391 r.setWidth(selectionRect.width().toFloat()); |
| 392 r.setX(selectionRect.x().toFloat()); | 392 r.setX(selectionRect.x().toFloat()); |
| 393 } | 393 } |
| 394 } | 394 } |
| 395 rects.append(localToAbsoluteQuad(r).enclosingBoundingBox()); | 395 rects.push_back(localToAbsoluteQuad(r).enclosingBoundingBox()); |
| 396 } else { | 396 } else { |
| 397 // FIXME: This code is wrong. It's converting local to absolute twice. | 397 // FIXME: This code is wrong. It's converting local to absolute twice. |
| 398 // http://webkit.org/b/65722 | 398 // http://webkit.org/b/65722 |
| 399 FloatRect rect = localQuadForTextBox(box, start, end, useSelectionHeight); | 399 FloatRect rect = localQuadForTextBox(box, start, end, useSelectionHeight); |
| 400 if (!rect.isZero()) | 400 if (!rect.isZero()) |
| 401 rects.append(localToAbsoluteQuad(rect).enclosingBoundingBox()); | 401 rects.push_back(localToAbsoluteQuad(rect).enclosingBoundingBox()); |
| 402 } | 402 } |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 static IntRect ellipsisRectForBox(InlineTextBox* box, | 406 static IntRect ellipsisRectForBox(InlineTextBox* box, |
| 407 unsigned startPos, | 407 unsigned startPos, |
| 408 unsigned endPos) { | 408 unsigned endPos) { |
| 409 if (!box) | 409 if (!box) |
| 410 return IntRect(); | 410 return IntRect(); |
| 411 | 411 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 442 IntRect ellipsisRect = (option == ClipToEllipsis) | 442 IntRect ellipsisRect = (option == ClipToEllipsis) |
| 443 ? ellipsisRectForBox(box, 0, textLength()) | 443 ? ellipsisRectForBox(box, 0, textLength()) |
| 444 : IntRect(); | 444 : IntRect(); |
| 445 if (!ellipsisRect.isEmpty()) { | 445 if (!ellipsisRect.isEmpty()) { |
| 446 if (style()->isHorizontalWritingMode()) | 446 if (style()->isHorizontalWritingMode()) |
| 447 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x()); | 447 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x()); |
| 448 else | 448 else |
| 449 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y()); | 449 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y()); |
| 450 } | 450 } |
| 451 if (localOrAbsolute == AbsoluteQuads) | 451 if (localOrAbsolute == AbsoluteQuads) |
| 452 quads.append(localToAbsoluteQuad(boundaries, mode)); | 452 quads.push_back(localToAbsoluteQuad(boundaries, mode)); |
| 453 else | 453 else |
| 454 quads.append(boundaries); | 454 quads.push_back(boundaries); |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 | 457 |
| 458 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads, | 458 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads, |
| 459 MapCoordinatesFlags mode) const { | 459 MapCoordinatesFlags mode) const { |
| 460 this->quads(quads, NoClipping, AbsoluteQuads, mode); | 460 this->quads(quads, NoClipping, AbsoluteQuads, mode); |
| 461 } | 461 } |
| 462 | 462 |
| 463 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, | 463 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, |
| 464 unsigned start, | 464 unsigned start, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 492 if (useSelectionHeight) { | 492 if (useSelectionHeight) { |
| 493 LayoutRect selectionRect = box->localSelectionRect(start, end); | 493 LayoutRect selectionRect = box->localSelectionRect(start, end); |
| 494 if (box->isHorizontal()) { | 494 if (box->isHorizontal()) { |
| 495 r.setHeight(selectionRect.height()); | 495 r.setHeight(selectionRect.height()); |
| 496 r.setY(selectionRect.y()); | 496 r.setY(selectionRect.y()); |
| 497 } else { | 497 } else { |
| 498 r.setWidth(selectionRect.width()); | 498 r.setWidth(selectionRect.width()); |
| 499 r.setX(selectionRect.x()); | 499 r.setX(selectionRect.x()); |
| 500 } | 500 } |
| 501 } | 501 } |
| 502 quads.append(localToAbsoluteQuad(FloatRect(r))); | 502 quads.push_back(localToAbsoluteQuad(FloatRect(r))); |
| 503 } else { | 503 } else { |
| 504 FloatRect rect = localQuadForTextBox(box, start, end, useSelectionHeight); | 504 FloatRect rect = localQuadForTextBox(box, start, end, useSelectionHeight); |
| 505 if (!rect.isZero()) | 505 if (!rect.isZero()) |
| 506 quads.append(localToAbsoluteQuad(rect)); | 506 quads.push_back(localToAbsoluteQuad(rect)); |
| 507 } | 507 } |
| 508 } | 508 } |
| 509 } | 509 } |
| 510 | 510 |
| 511 FloatRect LayoutText::localBoundingBoxRectForAccessibility() const { | 511 FloatRect LayoutText::localBoundingBoxRectForAccessibility() const { |
| 512 FloatRect result; | 512 FloatRect result; |
| 513 Vector<FloatQuad> quads; | 513 Vector<FloatQuad> quads; |
| 514 this->quads(quads, LayoutText::ClipToEllipsis, LayoutText::LocalQuads); | 514 this->quads(quads, LayoutText::ClipToEllipsis, LayoutText::LocalQuads); |
| 515 for (const FloatQuad& quad : quads) | 515 for (const FloatQuad& quad : quads) |
| 516 result.unite(quad.boundingBox()); | 516 result.unite(quad.boundingBox()); |
| (...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 LayoutRect rect = LayoutRect( | 1993 LayoutRect rect = LayoutRect( |
| 1994 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); | 1994 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); |
| 1995 LayoutBlock* block = containingBlock(); | 1995 LayoutBlock* block = containingBlock(); |
| 1996 if (block && hasTextBoxes()) | 1996 if (block && hasTextBoxes()) |
| 1997 block->adjustChildDebugRect(rect); | 1997 block->adjustChildDebugRect(rect); |
| 1998 | 1998 |
| 1999 return rect; | 1999 return rect; |
| 2000 } | 2000 } |
| 2001 | 2001 |
| 2002 } // namespace blink | 2002 } // namespace blink |
| OLD | NEW |