| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple 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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 if (target->isMouseFocusable() && !isFrameElement(target)) { | 1557 if (target->isMouseFocusable() && !isFrameElement(target)) { |
| 1558 m_frame->page()->focusController().setFocusedElement(target, m_f
rame); | 1558 m_frame->page()->focusController().setFocusedElement(target, m_f
rame); |
| 1559 return; | 1559 return; |
| 1560 } | 1560 } |
| 1561 target = target->parentOrShadowHostElement(); | 1561 target = target->parentOrShadowHostElement(); |
| 1562 } | 1562 } |
| 1563 m_frame->document()->setFocusedElement(nullptr); | 1563 m_frame->document()->setFocusedElement(nullptr); |
| 1564 } | 1564 } |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 static String extractSelectedText(const FrameSelection& selection, TextIteratorB
ehavior behavior) | |
| 1568 { | |
| 1569 // We remove '\0' characters because they are not visibly rendered to the us
er. | |
| 1570 return plainText(selection.toNormalizedRange().get(), behavior).replace(0, "
"); | |
| 1571 } | |
| 1572 | |
| 1573 String FrameSelection::selectedText() const | 1567 String FrameSelection::selectedText() const |
| 1574 { | 1568 { |
| 1575 return extractSelectedText(*this, TextIteratorDefaultBehavior); | 1569 // We remove '\0' characters because they are not visibly rendered to the us
er. |
| 1576 } | 1570 return plainText(toNormalizedRange().get()).replace(0, ""); |
| 1577 | |
| 1578 String FrameSelection::selectedTextForClipboard() const | |
| 1579 { | |
| 1580 if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageTex
t()) | |
| 1581 return extractSelectedText(*this, TextIteratorEmitsImageAltText); | |
| 1582 return selectedText(); | |
| 1583 } | 1571 } |
| 1584 | 1572 |
| 1585 FloatRect FrameSelection::bounds(bool clipToVisibleContent) const | 1573 FloatRect FrameSelection::bounds(bool clipToVisibleContent) const |
| 1586 { | 1574 { |
| 1587 m_frame->document()->updateRenderTreeIfNeeded(); | 1575 m_frame->document()->updateRenderTreeIfNeeded(); |
| 1588 | 1576 |
| 1589 FrameView* view = m_frame->view(); | 1577 FrameView* view = m_frame->view(); |
| 1590 RenderView* renderView = m_frame->contentRenderer(); | 1578 RenderView* renderView = m_frame->contentRenderer(); |
| 1591 | 1579 |
| 1592 if (!view || !renderView) | 1580 if (!view || !renderView) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 sel.showTreeForThis(); | 1730 sel.showTreeForThis(); |
| 1743 } | 1731 } |
| 1744 | 1732 |
| 1745 void showTree(const blink::FrameSelection* sel) | 1733 void showTree(const blink::FrameSelection* sel) |
| 1746 { | 1734 { |
| 1747 if (sel) | 1735 if (sel) |
| 1748 sel->showTreeForThis(); | 1736 sel->showTreeForThis(); |
| 1749 } | 1737 } |
| 1750 | 1738 |
| 1751 #endif | 1739 #endif |
| OLD | NEW |