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

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

Issue 2169273004: Switch all LayoutTests to use new accessibility relative bounding box API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make two tests more robust Created 4 years, 4 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 // The ellipsis should be considered to be selected if the end of 395 // The ellipsis should be considered to be selected if the end of
396 // the selection is past the beginning of the truncation and the 396 // the selection is past the beginning of the truncation and the
397 // beginning of the selection is before or at the beginning of the trunc ation. 397 // beginning of the selection is before or at the beginning of the trunc ation.
398 if (ellipsisEndPosition >= truncation && ellipsisStartPosition <= trunca tion) 398 if (ellipsisEndPosition >= truncation && ellipsisStartPosition <= trunca tion)
399 return ellipsis->selectionRect(); 399 return ellipsis->selectionRect();
400 } 400 }
401 401
402 return IntRect(); 402 return IntRect();
403 } 403 }
404 404
405 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads, ClippingOption option) const 405 void LayoutText::quads(Vector<FloatQuad>& quads, ClippingOption option, LocalOrA bsoluteOption localOrAbsolute) const
406 { 406 {
407 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 407 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
408 FloatRect boundaries(box->calculateBoundaries()); 408 FloatRect boundaries(box->calculateBoundaries());
409 409
410 // Shorten the width of this text box if it ends in an ellipsis. 410 // Shorten the width of this text box if it ends in an ellipsis.
411 // FIXME: ellipsisRectForBox should switch to return FloatRect soon with the subpixellayout branch. 411 // FIXME: ellipsisRectForBox should switch to return FloatRect soon with the subpixellayout branch.
412 IntRect ellipsisRect = (option == ClipToEllipsis) ? ellipsisRectForBox(b ox, 0, textLength()) : IntRect(); 412 IntRect ellipsisRect = (option == ClipToEllipsis) ? ellipsisRectForBox(b ox, 0, textLength()) : IntRect();
413 if (!ellipsisRect.isEmpty()) { 413 if (!ellipsisRect.isEmpty()) {
414 if (style()->isHorizontalWritingMode()) 414 if (style()->isHorizontalWritingMode())
415 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x()); 415 boundaries.setWidth(ellipsisRect.maxX() - boundaries.x());
416 else 416 else
417 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y()); 417 boundaries.setHeight(ellipsisRect.maxY() - boundaries.y());
418 } 418 }
419 quads.append(localToAbsoluteQuad(boundaries)); 419 if (localOrAbsolute == AbsoluteQuads)
420 quads.append(localToAbsoluteQuad(boundaries));
421 else
422 quads.append(boundaries);
420 } 423 }
421 } 424 }
422 425
423 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads) const 426 void LayoutText::absoluteQuads(Vector<FloatQuad>& quads) const
424 { 427 {
425 absoluteQuads(quads, NoClipping); 428 this->quads(quads, NoClipping, AbsoluteQuads);
426 } 429 }
427 430
428 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool useSelectionHeight) 431 void LayoutText::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool useSelectionHeight)
429 { 432 {
430 // Work around signed/unsigned issues. This function takes unsigneds, and is often passed UINT_MAX 433 // Work around signed/unsigned issues. This function takes unsigneds, and is often passed UINT_MAX
431 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds , so changing this 434 // to mean "all the way to the end". InlineTextBox coordinates are unsigneds , so changing this
432 // function to take ints causes various internal mismatches. But selectionRe ct takes ints, and 435 // function to take ints causes various internal mismatches. But selectionRe ct takes ints, and
433 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect to take unsigneds, but 436 // passing UINT_MAX to it causes trouble. Ideally we'd change selectionRect to take unsigneds, but
434 // that would cause many ripple effects, so for now we'll just clamp our uns igned parameters to INT_MAX. 437 // that would cause many ripple effects, so for now we'll just clamp our uns igned parameters to INT_MAX.
435 ASSERT(end == UINT_MAX || end <= INT_MAX); 438 ASSERT(end == UINT_MAX || end <= INT_MAX);
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1752 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
1750 invalidateDisplayItemClient(*box, invalidationReason); 1753 invalidateDisplayItemClient(*box, invalidationReason);
1751 if (box->truncation() != cNoTruncation) { 1754 if (box->truncation() != cNoTruncation) {
1752 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox()) 1755 if (EllipsisBox* ellipsisBox = box->root().ellipsisBox())
1753 invalidateDisplayItemClient(*ellipsisBox, invalidationReason); 1756 invalidateDisplayItemClient(*ellipsisBox, invalidationReason);
1754 } 1757 }
1755 } 1758 }
1756 } 1759 }
1757 1760
1758 } // namespace blink 1761 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698