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