| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 case PositionAnchorType::AfterChildren: | 60 case PositionAnchorType::AfterChildren: |
| 61 layoutObjectNode = position.anchorNode()->lastChild(); | 61 layoutObjectNode = position.anchorNode()->lastChild(); |
| 62 break; | 62 break; |
| 63 } | 63 } |
| 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 : m_layoutObject(nullptr) | 70 : RenderedPosition(position.deepEquivalent(), position.affinity()) |
| 71 , m_inlineBox(nullptr) | |
| 72 , m_offset(0) | |
| 73 , m_prevLeafChild(uncachedInlineBox()) | |
| 74 , m_nextLeafChild(uncachedInlineBox()) | |
| 75 { | 71 { |
| 76 if (position.isNull()) | |
| 77 return; | |
| 78 InlineBoxPosition boxPosition = computeInlineBoxPosition(position); | |
| 79 m_inlineBox = boxPosition.inlineBox; | |
| 80 m_offset = boxPosition.offsetInBox; | |
| 81 if (m_inlineBox) | |
| 82 m_layoutObject = &m_inlineBox->layoutObject(); | |
| 83 else | |
| 84 m_layoutObject = layoutObjectFromPosition(position.deepEquivalent()); | |
| 85 } | 72 } |
| 86 | 73 |
| 87 RenderedPosition::RenderedPosition(const Position& position, TextAffinity affini
ty) | 74 RenderedPosition::RenderedPosition(const Position& position, TextAffinity affini
ty) |
| 88 : m_layoutObject(nullptr) | 75 : m_layoutObject(nullptr) |
| 89 , m_inlineBox(nullptr) | 76 , m_inlineBox(nullptr) |
| 90 , m_offset(0) | 77 , m_offset(0) |
| 91 , m_prevLeafChild(uncachedInlineBox()) | 78 , m_prevLeafChild(uncachedInlineBox()) |
| 92 , m_nextLeafChild(uncachedInlineBox()) | 79 , m_nextLeafChild(uncachedInlineBox()) |
| 93 { | 80 { |
| 94 if (position.isNull()) | 81 if (position.isNull()) |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position
) | 248 bool layoutObjectContainsPosition(LayoutObject* target, const Position& position
) |
| 262 { | 249 { |
| 263 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout
Object && layoutObject->node(); layoutObject = layoutObject->parent()) { | 250 for (LayoutObject* layoutObject = layoutObjectFromPosition(position); layout
Object && layoutObject->node(); layoutObject = layoutObject->parent()) { |
| 264 if (layoutObject == target) | 251 if (layoutObject == target) |
| 265 return true; | 252 return true; |
| 266 } | 253 } |
| 267 return false; | 254 return false; |
| 268 } | 255 } |
| 269 | 256 |
| 270 }; | 257 }; |
| OLD | NEW |