| 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/dom/Range.h" | 29 #include "core/dom/Range.h" |
| 30 #include "core/dom/Text.h" | 30 #include "core/dom/Text.h" |
| 31 #include "core/editing/SurroundingText.h" | 31 #include "core/editing/SurroundingText.h" |
| 32 #include "core/editing/VisiblePosition.h" | 32 #include "core/editing/VisiblePosition.h" |
| 33 #include "core/layout/LayoutObject.h" | 33 #include "core/layout/LayoutObject.h" |
| 34 #include "public/platform/WebPoint.h" | 34 #include "public/platform/WebPoint.h" |
| 35 #include "public/web/WebHitTestResult.h" | 35 #include "public/web/WebHitTestResult.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 WebSurroundingText::WebSurroundingText() |
| 40 { |
| 41 } |
| 42 |
| 43 WebSurroundingText::~WebSurroundingText() |
| 44 { |
| 45 } |
| 46 |
| 39 void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node
Point, size_t maxLength) | 47 void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& node
Point, size_t maxLength) |
| 40 { | 48 { |
| 41 const Node* node = webNode.constUnwrap<Node>(); | 49 const Node* node = webNode.constUnwrap<Node>(); |
| 42 if (!node || !node->layoutObject()) | 50 if (!node || !node->layoutObject()) |
| 43 return; | 51 return; |
| 44 | 52 |
| 45 m_private.reset(new SurroundingText(createVisiblePosition(node->layoutObject
()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentA
nchoredEquivalent(), maxLength)); | 53 m_private.reset(new SurroundingText(createVisiblePosition(node->layoutObject
()->positionForPoint(static_cast<IntPoint>(nodePoint))).deepEquivalent().parentA
nchoredEquivalent(), maxLength)); |
| 46 } | 54 } |
| 47 | 55 |
| 48 void WebSurroundingText::initialize(const WebRange& webRange, size_t maxLength) | 56 void WebSurroundingText::initialize(const WebRange& webRange, size_t maxLength) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 75 WebRange WebSurroundingText::rangeFromContentOffsets(size_t startOffsetInContent
, size_t endOffsetInContent) | 83 WebRange WebSurroundingText::rangeFromContentOffsets(size_t startOffsetInContent
, size_t endOffsetInContent) |
| 76 { | 84 { |
| 77 return m_private->rangeFromContentOffsets(startOffsetInContent, endOffsetInC
ontent); | 85 return m_private->rangeFromContentOffsets(startOffsetInContent, endOffsetInC
ontent); |
| 78 } | 86 } |
| 79 | 87 |
| 80 bool WebSurroundingText::isNull() const | 88 bool WebSurroundingText::isNull() const |
| 81 { | 89 { |
| 82 return !m_private.get(); | 90 return !m_private.get(); |
| 83 } | 91 } |
| 84 | 92 |
| 85 void WebSurroundingText::reset() | |
| 86 { | |
| 87 m_private.reset(0); | |
| 88 } | |
| 89 | |
| 90 } // namespace blink | 93 } // namespace blink |
| OLD | NEW |