| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (!layoutObjectNode || !layoutObjectNode->layoutObject()) | 64 if (!layoutObjectNode || !layoutObjectNode->layoutObject()) |
| 65 layoutObjectNode = position.anchorNode(); | 65 layoutObjectNode = position.anchorNode(); |
| 66 return layoutObjectNode->layoutObject(); | 66 return layoutObjectNode->layoutObject(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 RenderedPosition::RenderedPosition(const VisiblePosition& position) | 69 RenderedPosition::RenderedPosition(const VisiblePosition& position) |
| 70 : RenderedPosition(position.deepEquivalent(), position.affinity()) | 70 : RenderedPosition(position.deepEquivalent(), position.affinity()) |
| 71 { | 71 { |
| 72 } | 72 } |
| 73 | 73 |
| 74 RenderedPosition::RenderedPosition(const VisiblePositionInComposedTree& position
) | 74 RenderedPosition::RenderedPosition(const VisiblePositionInFlatTree& position) |
| 75 : RenderedPosition(position.deepEquivalent(), position.affinity()) | 75 : RenderedPosition(position.deepEquivalent(), position.affinity()) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 RenderedPosition::RenderedPosition(const Position& position, TextAffinity affini
ty) | 79 RenderedPosition::RenderedPosition(const Position& position, TextAffinity affini
ty) |
| 80 : m_layoutObject(nullptr) | 80 : m_layoutObject(nullptr) |
| 81 , m_inlineBox(nullptr) | 81 , m_inlineBox(nullptr) |
| 82 , m_offset(0) | 82 , m_offset(0) |
| 83 , m_prevLeafChild(uncachedInlineBox()) | 83 , m_prevLeafChild(uncachedInlineBox()) |
| 84 , m_nextLeafChild(uncachedInlineBox()) | 84 , m_nextLeafChild(uncachedInlineBox()) |
| 85 { | 85 { |
| 86 if (position.isNull()) | 86 if (position.isNull()) |
| 87 return; | 87 return; |
| 88 InlineBoxPosition boxPosition = computeInlineBoxPosition(position, affinity)
; | 88 InlineBoxPosition boxPosition = computeInlineBoxPosition(position, affinity)
; |
| 89 m_inlineBox = boxPosition.inlineBox; | 89 m_inlineBox = boxPosition.inlineBox; |
| 90 m_offset = boxPosition.offsetInBox; | 90 m_offset = boxPosition.offsetInBox; |
| 91 if (m_inlineBox) | 91 if (m_inlineBox) |
| 92 m_layoutObject = LineLayoutAPIShim::layoutObjectFrom(m_inlineBox->lineLa
youtItem()); | 92 m_layoutObject = LineLayoutAPIShim::layoutObjectFrom(m_inlineBox->lineLa
youtItem()); |
| 93 else | 93 else |
| 94 m_layoutObject = layoutObjectFromPosition(position); | 94 m_layoutObject = layoutObjectFromPosition(position); |
| 95 } | 95 } |
| 96 | 96 |
| 97 RenderedPosition::RenderedPosition(const PositionInComposedTree& position, TextA
ffinity affinity) | 97 RenderedPosition::RenderedPosition(const PositionInFlatTree& position, TextAffin
ity affinity) |
| 98 : RenderedPosition(toPositionInDOMTree(position), affinity) | 98 : RenderedPosition(toPositionInDOMTree(position), affinity) |
| 99 { | 99 { |
| 100 } | 100 } |
| 101 | 101 |
| 102 InlineBox* RenderedPosition::prevLeafChild() const | 102 InlineBox* RenderedPosition::prevLeafChild() const |
| 103 { | 103 { |
| 104 if (m_prevLeafChild == uncachedInlineBox()) | 104 if (m_prevLeafChild == uncachedInlineBox()) |
| 105 m_prevLeafChild = m_inlineBox->prevLeafChildIgnoringLineBreak(); | 105 m_prevLeafChild = m_inlineBox->prevLeafChildIgnoringLineBreak(); |
| 106 return m_prevLeafChild; | 106 return m_prevLeafChild; |
| 107 } | 107 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position
) | 271 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position
) |
| 272 { | 272 { |
| 273 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout
Object && layoutObject->node(); layoutObject = layoutObject->parent()) { | 273 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout
Object && layoutObject->node(); layoutObject = layoutObject->parent()) { |
| 274 if (layoutObject == target) | 274 if (layoutObject == target) |
| 275 return true; | 275 return true; |
| 276 } | 276 } |
| 277 return false; | 277 return false; |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace blink | 280 } // namespace blink |
| OLD | NEW |