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

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

Issue 1299873002: ALL-IN-ONE Introduce enum class TextAffinity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T18:08:52 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/html/HTMLTextFormControlElementTest.cpp ('k') | Source/core/layout/LayoutObject.h » ('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 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 1816
1817 // If we can't find an ancestor to check editability on, or editability is u nchanged, we recur like normal 1817 // If we can't find an ancestor to check editability on, or editability is u nchanged, we recur like normal
1818 if (isEditingBoundary(ancestor, child)) 1818 if (isEditingBoundary(ancestor, child))
1819 return child->positionForPoint(pointInChildCoordinates); 1819 return child->positionForPoint(pointInChildCoordinates);
1820 1820
1821 // Otherwise return before or after the child, depending on if the click was to the logical left or logical right of the child 1821 // Otherwise return before or after the child, depending on if the click was to the logical left or logical right of the child
1822 LayoutUnit childMiddle = parent->logicalWidthForChild(*child) / 2; 1822 LayoutUnit childMiddle = parent->logicalWidthForChild(*child) / 2;
1823 LayoutUnit logicalLeft = parent->isHorizontalWritingMode() ? pointInChildCoo rdinates.x() : pointInChildCoordinates.y(); 1823 LayoutUnit logicalLeft = parent->isHorizontalWritingMode() ? pointInChildCoo rdinates.x() : pointInChildCoordinates.y();
1824 if (logicalLeft < childMiddle) 1824 if (logicalLeft < childMiddle)
1825 return ancestor->createPositionWithAffinity(childNode->nodeIndex()); 1825 return ancestor->createPositionWithAffinity(childNode->nodeIndex());
1826 return ancestor->createPositionWithAffinity(childNode->nodeIndex() + 1, UPST REAM); 1826 return ancestor->createPositionWithAffinity(childNode->nodeIndex() + 1, Text Affinity::Upstream);
1827 } 1827 }
1828 1828
1829 PositionWithAffinity LayoutBlock::positionForPointWithInlineChildren(const Layou tPoint& pointInLogicalContents) 1829 PositionWithAffinity LayoutBlock::positionForPointWithInlineChildren(const Layou tPoint& pointInLogicalContents)
1830 { 1830 {
1831 ASSERT(childrenInline()); 1831 ASSERT(childrenInline());
1832 1832
1833 if (!firstRootBox()) 1833 if (!firstRootBox())
1834 return createPositionWithAffinity(0); 1834 return createPositionWithAffinity(0);
1835 1835
1836 bool linesAreFlipped = style()->isFlippedLinesWritingMode(); 1836 bool linesAreFlipped = style()->isFlippedLinesWritingMode();
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2919 { 2919 {
2920 showLayoutObject(); 2920 showLayoutObject();
2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2923 } 2923 }
2924 2924
2925 #endif 2925 #endif
2926 2926
2927 } // namespace blink 2927 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLTextFormControlElementTest.cpp ('k') | Source/core/layout/LayoutObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698