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 22 matching lines...) Expand all Loading... |
33 #include "core/editing/VisiblePosition.h" | 33 #include "core/editing/VisiblePosition.h" |
34 #include "core/layout/LayoutObject.h" | 34 #include "core/layout/LayoutObject.h" |
35 #include "public/platform/WebPoint.h" | 35 #include "public/platform/WebPoint.h" |
36 #include "public/web/WebHitTestResult.h" | 36 #include "public/web/WebHitTestResult.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node
Point, size_t maxLength) | 40 void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node
Point, size_t maxLength) |
41 { | 41 { |
42 const Node* node = webNode.constUnwrap<Node>(); | 42 const Node* node = webNode.constUnwrap<Node>(); |
43 if (!node || !node->renderer()) | 43 if (!node || !node->layoutObject()) |
44 return; | 44 return; |
45 | 45 |
46 m_private.reset(new SurroundingText(VisiblePosition(node->renderer()->positi
onForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentAnchoredEqu
ivalent(), maxLength)); | 46 m_private.reset(new SurroundingText(VisiblePosition(node->layoutObject()->po
sitionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentAnchore
dEquivalent(), maxLength)); |
47 } | 47 } |
48 | 48 |
49 void WebSurroundingText::initialize(const WebRange& webRange, size_t maxLength) | 49 void WebSurroundingText::initialize(const WebRange& webRange, size_t maxLength) |
50 { | 50 { |
51 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran
ge>>(webRange)) | 51 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran
ge>>(webRange)) |
52 m_private.reset(new SurroundingText(*range, maxLength)); | 52 m_private.reset(new SurroundingText(*range, maxLength)); |
53 } | 53 } |
54 | 54 |
55 WebString WebSurroundingText::textContent() const | 55 WebString WebSurroundingText::textContent() const |
56 { | 56 { |
(...skipping 25 matching lines...) Expand all Loading... |
82 { | 82 { |
83 return !m_private.get(); | 83 return !m_private.get(); |
84 } | 84 } |
85 | 85 |
86 void WebSurroundingText::reset() | 86 void WebSurroundingText::reset() |
87 { | 87 { |
88 m_private.reset(0); | 88 m_private.reset(0); |
89 } | 89 } |
90 | 90 |
91 } // namespace blink | 91 } // namespace blink |
OLD | NEW |