SelectionOverlay.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef SelectionOverlay_h
  19. #define SelectionOverlay_h
  20. #include "BlackBerryGlobal.h"
  21. #if USE(ACCELERATED_COMPOSITING)
  22. #include "Color.h"
  23. #include "FloatQuad.h"
  24. #include "GraphicsLayerClient.h"
  25. #include "IntRect.h"
  26. #include <BlackBerryPlatformIntRectRegion.h>
  27. #include <wtf/HashMap.h>
  28. #include <wtf/OwnPtr.h>
  29. #include <wtf/PassOwnPtr.h>
  30. #include <wtf/Vector.h>
  31. namespace BlackBerry {
  32. namespace WebKit {
  33. class WebPagePrivate;
  34. class SelectionOverlay : public WebCore::GraphicsLayerClient {
  35. public:
  36. typedef HashMap<WebCore::GraphicsLayer*, Vector<WebCore::FloatQuad> > Selection;
  37. static PassOwnPtr<SelectionOverlay> create(WebPagePrivate* page)
  38. {
  39. return adoptPtr(new SelectionOverlay(page));
  40. }
  41. ~SelectionOverlay();
  42. void draw(const Selection&);
  43. void hide();
  44. // GraphicsLayerClient
  45. virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double) { }
  46. virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
  47. virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&);
  48. private:
  49. SelectionOverlay(WebPagePrivate*);
  50. WebPagePrivate* m_page;
  51. Selection m_selection;
  52. Vector<OwnPtr<WebCore::GraphicsLayer> > m_layers;
  53. };
  54. } // namespace WebKit
  55. } // namespace BlackBerry
  56. #endif // USE(ACCELERATED_COMPOSITING)
  57. #endif // SelectionOverlay_h