| 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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1694 return true; | 1694 return true; |
| 1695 | 1695 |
| 1696 return false; | 1696 return false; |
| 1697 } | 1697 } |
| 1698 | 1698 |
| 1699 Position LayoutBlock::positionForBox(InlineBox *box, bool start) const | 1699 Position LayoutBlock::positionForBox(InlineBox *box, bool start) const |
| 1700 { | 1700 { |
| 1701 if (!box) | 1701 if (!box) |
| 1702 return Position(); | 1702 return Position(); |
| 1703 | 1703 |
| 1704 if (!box->lineLayoutItem().nonPseudoNode()) | 1704 if (!box->getLineLayoutItem().nonPseudoNode()) |
| 1705 return Position::editingPositionOf(nonPseudoNode(), start ? caretMinOffs
et() : caretMaxOffset()); | 1705 return Position::editingPositionOf(nonPseudoNode(), start ? caretMinOffs
et() : caretMaxOffset()); |
| 1706 | 1706 |
| 1707 if (!box->isInlineTextBox()) | 1707 if (!box->isInlineTextBox()) |
| 1708 return Position::editingPositionOf(box->lineLayoutItem().nonPseudoNode()
, start ? box->lineLayoutItem().caretMinOffset() : box->lineLayoutItem().caretMa
xOffset()); | 1708 return Position::editingPositionOf(box->getLineLayoutItem().nonPseudoNod
e(), start ? box->getLineLayoutItem().caretMinOffset() : box->getLineLayoutItem(
).caretMaxOffset()); |
| 1709 | 1709 |
| 1710 InlineTextBox* textBox = toInlineTextBox(box); | 1710 InlineTextBox* textBox = toInlineTextBox(box); |
| 1711 return Position::editingPositionOf(box->lineLayoutItem().nonPseudoNode(), st
art ? textBox->start() : textBox->start() + textBox->len()); | 1711 return Position::editingPositionOf(box->getLineLayoutItem().nonPseudoNode(),
start ? textBox->start() : textBox->start() + textBox->len()); |
| 1712 } | 1712 } |
| 1713 | 1713 |
| 1714 static inline bool isEditingBoundary(LayoutObject* ancestor, LayoutObject* child
) | 1714 static inline bool isEditingBoundary(LayoutObject* ancestor, LayoutObject* child
) |
| 1715 { | 1715 { |
| 1716 ASSERT(!ancestor || ancestor->nonPseudoNode()); | 1716 ASSERT(!ancestor || ancestor->nonPseudoNode()); |
| 1717 ASSERT(child && child->nonPseudoNode()); | 1717 ASSERT(child && child->nonPseudoNode()); |
| 1718 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isLayoutView()) | 1718 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isLayoutView()) |
| 1719 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode
()->hasEditableStyle(); | 1719 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode
()->hasEditableStyle(); |
| 1720 } | 1720 } |
| 1721 | 1721 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 } | 1816 } |
| 1817 // y coordinate is above first root line box, so return the star
t of the first | 1817 // y coordinate is above first root line box, so return the star
t of the first |
| 1818 return PositionWithAffinity(positionForBox(box, true)); | 1818 return PositionWithAffinity(positionForBox(box, true)); |
| 1819 } | 1819 } |
| 1820 } | 1820 } |
| 1821 | 1821 |
| 1822 // pass the box a top position that is inside it | 1822 // pass the box a top position that is inside it |
| 1823 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi
rectionPointInLine()); | 1823 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi
rectionPointInLine()); |
| 1824 if (!isHorizontalWritingMode()) | 1824 if (!isHorizontalWritingMode()) |
| 1825 point = point.transposedPoint(); | 1825 point = point.transposedPoint(); |
| 1826 if (closestBox->lineLayoutItem().isAtomicInlineLevel()) | 1826 if (closestBox->getLineLayoutItem().isAtomicInlineLevel()) |
| 1827 return positionForPointRespectingEditingBoundaries(this, LineLayoutB
ox(closestBox->lineLayoutItem()), point); | 1827 return positionForPointRespectingEditingBoundaries(this, LineLayoutB
ox(closestBox->getLineLayoutItem()), point); |
| 1828 return closestBox->lineLayoutItem().positionForPoint(point); | 1828 return closestBox->getLineLayoutItem().positionForPoint(point); |
| 1829 } | 1829 } |
| 1830 | 1830 |
| 1831 if (lastRootBoxWithChildren) { | 1831 if (lastRootBoxWithChildren) { |
| 1832 // We hit this case for Mac behavior when the Y coordinate is below the
last box. | 1832 // We hit this case for Mac behavior when the Y coordinate is below the
last box. |
| 1833 ASSERT(moveCaretToBoundary); | 1833 ASSERT(moveCaretToBoundary); |
| 1834 InlineBox* logicallyLastBox; | 1834 InlineBox* logicallyLastBox; |
| 1835 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) | 1835 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) |
| 1836 return PositionWithAffinity(positionForBox(logicallyLastBox, false))
; | 1836 return PositionWithAffinity(positionForBox(logicallyLastBox, false))
; |
| 1837 } | 1837 } |
| 1838 | 1838 |
| (...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2862 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 2862 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
| 2863 { | 2863 { |
| 2864 showLayoutObject(); | 2864 showLayoutObject(); |
| 2865 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2865 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2866 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2866 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2867 } | 2867 } |
| 2868 | 2868 |
| 2869 #endif | 2869 #endif |
| 2870 | 2870 |
| 2871 } // namespace blink | 2871 } // namespace blink |
| OLD | NEW |