| OLD | NEW |
| 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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 if (moveCaretToBoundary) { | 1880 if (moveCaretToBoundary) { |
| 1881 LayoutUnit firstRootBoxWithChildrenTop = std::min<LayoutUnit>(firstR
ootBoxWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); | 1881 LayoutUnit firstRootBoxWithChildrenTop = std::min<LayoutUnit>(firstR
ootBoxWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); |
| 1882 if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop | 1882 if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop |
| 1883 || (blocksAreFlipped && pointInLogicalContents.y() == firstRootB
oxWithChildrenTop)) { | 1883 || (blocksAreFlipped && pointInLogicalContents.y() == firstRootB
oxWithChildrenTop)) { |
| 1884 InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); | 1884 InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); |
| 1885 if (box->isLineBreak()) { | 1885 if (box->isLineBreak()) { |
| 1886 if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak(
)) | 1886 if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak(
)) |
| 1887 box = newBox; | 1887 box = newBox; |
| 1888 } | 1888 } |
| 1889 // y coordinate is above first root line box, so return the star
t of the first | 1889 // y coordinate is above first root line box, so return the star
t of the first |
| 1890 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA
M); | 1890 return PositionWithAffinity(positionForBox(box, true)); |
| 1891 } | 1891 } |
| 1892 } | 1892 } |
| 1893 | 1893 |
| 1894 // pass the box a top position that is inside it | 1894 // pass the box a top position that is inside it |
| 1895 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi
rectionPointInLine()); | 1895 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi
rectionPointInLine()); |
| 1896 if (!isHorizontalWritingMode()) | 1896 if (!isHorizontalWritingMode()) |
| 1897 point = point.transposedPoint(); | 1897 point = point.transposedPoint(); |
| 1898 if (closestBox->layoutObject().isReplaced()) | 1898 if (closestBox->layoutObject().isReplaced()) |
| 1899 return positionForPointRespectingEditingBoundaries(this, &toLayoutBo
x(closestBox->layoutObject()), point); | 1899 return positionForPointRespectingEditingBoundaries(this, &toLayoutBo
x(closestBox->layoutObject()), point); |
| 1900 return closestBox->layoutObject().positionForPoint(point); | 1900 return closestBox->layoutObject().positionForPoint(point); |
| 1901 } | 1901 } |
| 1902 | 1902 |
| 1903 if (lastRootBoxWithChildren) { | 1903 if (lastRootBoxWithChildren) { |
| 1904 // We hit this case for Mac behavior when the Y coordinate is below the
last box. | 1904 // We hit this case for Mac behavior when the Y coordinate is below the
last box. |
| 1905 ASSERT(moveCaretToBoundary); | 1905 ASSERT(moveCaretToBoundary); |
| 1906 InlineBox* logicallyLastBox; | 1906 InlineBox* logicallyLastBox; |
| 1907 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) | 1907 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) |
| 1908 return PositionWithAffinity(positionForBox(logicallyLastBox, false),
DOWNSTREAM); | 1908 return PositionWithAffinity(positionForBox(logicallyLastBox, false))
; |
| 1909 } | 1909 } |
| 1910 | 1910 |
| 1911 // Can't reach this. We have a root line box, but it has no kids. | 1911 // Can't reach this. We have a root line box, but it has no kids. |
| 1912 // FIXME: This should ASSERT_NOT_REACHED(), but clicking on placeholder text | 1912 // FIXME: This should ASSERT_NOT_REACHED(), but clicking on placeholder text |
| 1913 // seems to hit this code path. | 1913 // seems to hit this code path. |
| 1914 return createPositionWithAffinity(0, DOWNSTREAM); | 1914 return createPositionWithAffinity(0, DOWNSTREAM); |
| 1915 } | 1915 } |
| 1916 | 1916 |
| 1917 static inline bool isChildHitTestCandidate(LayoutBox* box) | 1917 static inline bool isChildHitTestCandidate(LayoutBox* box) |
| 1918 { | 1918 { |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |