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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutText.cpp

Issue 2604073002: Apply offset from the correct graphics layer; simplify code for link highlights. (Closed)
Patch Set: Created 3 years, 11 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
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 if (ellipsisEndPosition >= truncation && 422 if (ellipsisEndPosition >= truncation &&
423 ellipsisStartPosition <= truncation) 423 ellipsisStartPosition <= truncation)
424 return ellipsis->selectionRect(); 424 return ellipsis->selectionRect();
425 } 425 }
426 426
427 return IntRect(); 427 return IntRect();
428 } 428 }
429 429
430 void LayoutText::quads(Vector<FloatQuad>& quads, 430 void LayoutText::quads(Vector<FloatQuad>& quads,
431 ClippingOption option, 431 ClippingOption option,
432 LocalOrAbsoluteOption localOrAbsolute) const { 432 LocalOrAbsoluteOption localOrAbsolute,
433 MapCoordinatesFlags mode) const {
433 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 434 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
434 FloatRect boundaries(box->frameRect()); 435 FloatRect boundaries(box->frameRect());
435 436
436 // Shorten the width of this text box if it ends in an ellipsis. 437 // Shorten the width of this text box if it ends in an ellipsis.
437 // FIXME: ellipsisRectForBox should switch to return FloatRect soon with the 438 // FIXME: ellipsisRectForBox should switch to return FloatRect soon with the
438 // subpixellayout branch. 439 // subpixellayout branch.
439 IntRect ellipsisRect = (option == ClipToEllipsis) 440 IntRect ellipsisRect = (option == ClipToEllipsis)
440 ? ellipsisRectForBox(box, 0, textLength()) 441 ? ellipsisRectForBox(box, 0, textLength())
441 : IntRect(); 442 : IntRect();
442 if (!ellipsisRect.isEmpty()) { 443 if (!ellipsisRect.isEmpty()) {
443 if (style()->isHorizontalWritingMode()) 444 if (style()->isHorizontalWritingMode())
444 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x()); 445 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x());
445 else 446 else
446 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y()); 447 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y());
447 } 448 }
448 if (localOrAbsolute == AbsoluteQuads) 449 if (localOrAbsolute == AbsoluteQuads)
449 quads.append(localToAbsoluteQuad(boundaries)); 450 quads.append(localToAbsoluteQuad(boundaries, mode));
450 else 451 else
451 quads.append(boundaries); 452 quads.append(boundaries);
452 } 453 }
453 } 454 }
454 455
455 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads) const { 456 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads,
456 this->quads(quads, NoClipping, AbsoluteQuads); 457 MapCoordinatesFlags mode) const {
458 this->quads(quads, NoClipping, AbsoluteQuads, mode);
457 } 459 }
458 460
459 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, 461 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads,
460 unsigned start, 462 unsigned start,
461 unsigned end, 463 unsigned end,
462 bool useSelectionHeight) { 464 bool useSelectionHeight) {
463 // Work around signed/unsigned issues. This function takes unsigneds, and is 465 // Work around signed/unsigned issues. This function takes unsigneds, and is
464 // often passed UINT_MAX to mean "all the way to the end". InlineTextBox 466 // often passed UINT_MAX to mean "all the way to the end". InlineTextBox
465 // coordinates are unsigneds, so changing this function to take ints causes 467 // coordinates are unsigneds, so changing this function to take ints causes
466 // various internal mismatches. But selectionRect takes ints, and passing 468 // various internal mismatches. But selectionRect takes ints, and passing
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 LayoutRect rect = LayoutRect( 1990 LayoutRect rect = LayoutRect(
1989 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height())); 1991 IntRect(firstRunX(), firstRunY(), linesBox.width(), linesBox.height()));
1990 LayoutBlock* block = containingBlock(); 1992 LayoutBlock* block = containingBlock();
1991 if (block && hasTextBoxes()) 1993 if (block && hasTextBoxes())
1992 block->adjustChildDebugRect(rect); 1994 block->adjustChildDebugRect(rect);
1993 1995
1994 return rect; 1996 return rect;
1995 } 1997 }
1996 1998
1997 } // namespace blink 1999 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698