| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 createVisiblePosition(node->layoutObject()->positionForPoint( | 62 createVisiblePosition(node->layoutObject()->positionForPoint( |
| 63 static_cast<IntPoint>(nodePoint))) | 63 static_cast<IntPoint>(nodePoint))) |
| 64 .deepEquivalent() | 64 .deepEquivalent() |
| 65 .parentAnchoredEquivalent(), | 65 .parentAnchoredEquivalent(), |
| 66 maxLength)); | 66 maxLength)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void WebSurroundingText::initializeFromCurrentSelection(WebLocalFrame* frame, | 69 void WebSurroundingText::initializeFromCurrentSelection(WebLocalFrame* frame, |
| 70 size_t maxLength) { | 70 size_t maxLength) { |
| 71 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); | 71 LocalFrame* webFrame = toWebLocalFrameImpl(frame)->frame(); |
| 72 |
| 73 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 74 // needs to be audited. See http://crbug.com/590369 for more details. |
| 75 webFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 76 |
| 72 if (Range* range = createRange( | 77 if (Range* range = createRange( |
| 73 webFrame->selection().selection().toNormalizedEphemeralRange())) | 78 webFrame->selection().selection().toNormalizedEphemeralRange())) |
| 74 m_private.reset(new SurroundingText(*range, maxLength)); | 79 m_private.reset(new SurroundingText(*range, maxLength)); |
| 75 } | 80 } |
| 76 | 81 |
| 77 WebString WebSurroundingText::textContent() const { | 82 WebString WebSurroundingText::textContent() const { |
| 78 return m_private->content(); | 83 return m_private->content(); |
| 79 } | 84 } |
| 80 | 85 |
| 81 size_t WebSurroundingText::hitOffsetInTextContent() const { | 86 size_t WebSurroundingText::hitOffsetInTextContent() const { |
| 82 DCHECK_EQ(m_private->startOffsetInContent(), m_private->endOffsetInContent()); | 87 DCHECK_EQ(m_private->startOffsetInContent(), m_private->endOffsetInContent()); |
| 83 return m_private->startOffsetInContent(); | 88 return m_private->startOffsetInContent(); |
| 84 } | 89 } |
| 85 | 90 |
| 86 size_t WebSurroundingText::startOffsetInTextContent() const { | 91 size_t WebSurroundingText::startOffsetInTextContent() const { |
| 87 return m_private->startOffsetInContent(); | 92 return m_private->startOffsetInContent(); |
| 88 } | 93 } |
| 89 | 94 |
| 90 size_t WebSurroundingText::endOffsetInTextContent() const { | 95 size_t WebSurroundingText::endOffsetInTextContent() const { |
| 91 return m_private->endOffsetInContent(); | 96 return m_private->endOffsetInContent(); |
| 92 } | 97 } |
| 93 | 98 |
| 94 bool WebSurroundingText::isNull() const { | 99 bool WebSurroundingText::isNull() const { |
| 95 return !m_private.get(); | 100 return !m_private.get(); |
| 96 } | 101 } |
| 97 | 102 |
| 98 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |