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

Side by Side Diff: Source/core/layout/LayoutReplaced.cpp

Issue 1303653002: Introduce LayoutObject::createPositionWithAffinity(int offset) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:20:28 Created 5 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
« no previous file with comments | « Source/core/layout/LayoutObject.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 InlineBox* box = inlineBoxWrapper(); 413 InlineBox* box = inlineBoxWrapper();
414 RootInlineBox* rootBox = box ? &box->root() : 0; 414 RootInlineBox* rootBox = box ? &box->root() : 0;
415 415
416 LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop(); 416 LayoutUnit top = rootBox ? rootBox->selectionTop() : logicalTop();
417 LayoutUnit bottom = rootBox ? rootBox->selectionBottom() : logicalBottom(); 417 LayoutUnit bottom = rootBox ? rootBox->selectionBottom() : logicalBottom();
418 418
419 LayoutUnit blockDirectionPosition = isHorizontalWritingMode() ? point.y() + location().y() : point.x() + location().x(); 419 LayoutUnit blockDirectionPosition = isHorizontalWritingMode() ? point.y() + location().y() : point.x() + location().x();
420 LayoutUnit lineDirectionPosition = isHorizontalWritingMode() ? point.x() + l ocation().x() : point.y() + location().y(); 420 LayoutUnit lineDirectionPosition = isHorizontalWritingMode() ? point.x() + l ocation().x() : point.y() + location().y();
421 421
422 if (blockDirectionPosition < top) 422 if (blockDirectionPosition < top)
423 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); // coor dinates are above 423 return createPositionWithAffinity(caretMinOffset()); // coordinates are above
424 424
425 if (blockDirectionPosition >= bottom) 425 if (blockDirectionPosition >= bottom)
426 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); // coor dinates are below 426 return createPositionWithAffinity(caretMaxOffset()); // coordinates are below
427 427
428 if (node()) { 428 if (node()) {
429 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) 429 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2))
430 return createPositionWithAffinity(0, DOWNSTREAM); 430 return createPositionWithAffinity(0);
431 return createPositionWithAffinity(1, DOWNSTREAM); 431 return createPositionWithAffinity(1);
432 } 432 }
433 433
434 return LayoutBox::positionForPoint(point); 434 return LayoutBox::positionForPoint(point);
435 } 435 }
436 436
437 LayoutRect LayoutReplaced::selectionRectForPaintInvalidation(const LayoutBoxMode lObject* paintInvalidationContainer) const 437 LayoutRect LayoutReplaced::selectionRectForPaintInvalidation(const LayoutBoxMode lObject* paintInvalidationContainer) const
438 { 438 {
439 ASSERT(!needsLayout()); 439 ASSERT(!needsLayout());
440 440
441 if (!isSelected()) 441 if (!isSelected())
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 return LayoutRect(); 511 return LayoutRect();
512 512
513 // The selectionRect can project outside of the overflowRect, so take their union 513 // The selectionRect can project outside of the overflowRect, so take their union
514 // for paint invalidation to avoid selection painting glitches. 514 // for paint invalidation to avoid selection painting glitches.
515 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); 515 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect();
516 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState); 516 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState);
517 return r; 517 return r;
518 } 518 }
519 519
520 } 520 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutObject.cpp ('k') | Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698