Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 WebSurroundingText::~WebSurroundingText() | 45 WebSurroundingText::~WebSurroundingText() |
| 46 { | 46 { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node Point, size_t maxLength) | 49 void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node Point, size_t maxLength) |
| 50 { | 50 { |
| 51 const Node* node = webNode.constUnwrap<Node>(); | 51 const Node* node = webNode.constUnwrap<Node>(); |
| 52 if (!node || !node->layoutObject()) | 52 if (!node || !node->layoutObject()) |
|
yosin_UTC9
2016/09/16 02:01:21
We should update layout before using |Node::layout
| |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 m_private.reset(new SurroundingText(createVisiblePosition(node->layoutObject ()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentA nchoredEquivalent(), maxLength)); | 55 m_private.reset(new SurroundingText(createVisiblePositionDeprecated(node->la youtObject()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent ().parentAnchoredEquivalent(), maxLength)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void WebSurroundingText::initializeFromCurrentSelection(WebLocalFrame* frame, si ze_t maxLength) | 58 void WebSurroundingText::initializeFromCurrentSelection(WebLocalFrame* frame, si ze_t maxLength) |
| 59 { | 59 { |
| 60 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); | 60 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); |
| 61 if (Range* range = createRange(webFrame->selection().selection().toNormalize dEphemeralRange())) | 61 if (Range* range = createRange(webFrame->selection().selection().toNormalize dEphemeralRange())) |
| 62 m_private.reset(new SurroundingText(*range, maxLength)); | 62 m_private.reset(new SurroundingText(*range, maxLength)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 WebString WebSurroundingText::textContent() const | 65 WebString WebSurroundingText::textContent() const |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 82 { | 82 { |
| 83 return m_private->endOffsetInContent(); | 83 return m_private->endOffsetInContent(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool WebSurroundingText::isNull() const | 86 bool WebSurroundingText::isNull() const |
| 87 { | 87 { |
| 88 return !m_private.get(); | 88 return !m_private.get(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace blink | 91 } // namespace blink |
| OLD | NEW |