diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-02-24 16:36:50 +0100 |
commit | ad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch) | |
tree | b34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h | |
parent | 03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff) | |
download | qtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz |
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h')
-rw-r--r-- | Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h new file mode 100644 index 000000000..8c5fe7637 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef SelectionHandler_h +#define SelectionHandler_h + +#include "BlackBerryPlatformIntRectRegion.h" +#include "BlackBerryPlatformPrimitives.h" +#include "TextGranularity.h" + +namespace WTF { +class String; +} + +namespace WebCore { +class IntPoint; +class IntRect; +class Node; +class VisiblePosition; +class VisibleSelection; +} + +namespace BlackBerry { + +namespace WebKit { + +class WebPagePrivate; +class WebString; + +class SelectionHandler { +public: + SelectionHandler(WebPagePrivate*); + ~SelectionHandler(); + + bool isSelectionActive() { return m_selectionActive; } + void setSelectionActive(bool active) { m_selectionActive = active; } + + void cancelSelection(); + WebString selectedText() const; + + bool selectionContains(const WebCore::IntPoint&); + + void setSelection(const WebCore::IntPoint& start, const WebCore::IntPoint& end); + void selectAtPoint(const WebCore::IntPoint&); + void selectObject(const WebCore::IntPoint&, WebCore::TextGranularity); + void selectObject(WebCore::TextGranularity); + void selectObject(WebCore::Node*); + + void selectionPositionChanged(bool visualChangeOnly = false); + + void setCaretPosition(const WebCore::IntPoint&); + + bool lastUpdatedEndPointIsValid() const { return m_lastUpdatedEndPointIsValid; } + +private: + void caretPositionChanged(); + void getConsolidatedRegionOfTextQuadsForSelection(const WebCore::VisibleSelection&, BlackBerry::Platform::IntRectRegion&) const; + void clipRegionToVisibleContainer(BlackBerry::Platform::IntRectRegion&); + bool updateOrHandleInputSelection(WebCore::VisibleSelection& newSelection, const WebCore::IntPoint& relativeStart + , const WebCore::IntPoint& relativeEnd); + WebCore::Node* DOMContainerNodeForVisiblePosition(const WebCore::VisiblePosition&) const; + bool shouldUpdateSelectionOrCaretForPoint(const WebCore::IntPoint&, const WebCore::IntRect&, bool startCaret = true) const; + unsigned short extendSelectionToFieldBoundary(bool isStartHandle, const WebCore::IntPoint& selectionPoint, WebCore::VisibleSelection& newSelection); + WebCore::IntPoint clipPointToFocusNode(const WebCore::IntPoint&); + + WebPagePrivate* m_webPage; + + bool m_selectionActive; + bool m_caretActive; + bool m_lastUpdatedEndPointIsValid; + BlackBerry::Platform::IntRectRegion m_lastSelectionRegion; +}; + +} +} + +#endif // SelectionHandler_h |