DefaultTapHighlight.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (C) 2011, 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 DefaultTapHighlight_h
  19. #define DefaultTapHighlight_h
  20. #include "BlackBerryGlobal.h"
  21. #if USE(ACCELERATED_COMPOSITING)
  22. #include "Color.h"
  23. #include "GraphicsLayerClient.h"
  24. #include "WebOverlay.h"
  25. #include "WebTapHighlight.h"
  26. #include <BlackBerryPlatformIntRectRegion.h>
  27. #include <wtf/OwnPtr.h>
  28. #include <wtf/PassOwnPtr.h>
  29. #include <wtf/Threading.h>
  30. namespace BlackBerry {
  31. namespace WebKit {
  32. class WebPagePrivate;
  33. class DefaultTapHighlight : public WebTapHighlight, public WebCore::GraphicsLayerClient {
  34. public:
  35. static PassOwnPtr<DefaultTapHighlight> create(WebPagePrivate* page)
  36. {
  37. return adoptPtr(new DefaultTapHighlight(page));
  38. }
  39. virtual ~DefaultTapHighlight();
  40. virtual void draw(const Platform::IntRectRegion&, int red, int green, int blue, int alpha, bool hideAfterScroll, bool isStartOfSelection = false);
  41. virtual void hide();
  42. virtual bool isVisible() const { return m_visible; }
  43. virtual bool shouldHideAfterScroll() const { return m_shouldHideAfterScroll; }
  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& inClip);
  48. private:
  49. DefaultTapHighlight(WebPagePrivate*);
  50. WebPagePrivate* m_page;
  51. OwnPtr<WebOverlay> m_overlay;
  52. BlackBerry::Platform::IntRectRegion m_region;
  53. WebCore::Color m_color;
  54. bool m_visible;
  55. bool m_shouldHideAfterScroll;
  56. Mutex m_mutex;
  57. };
  58. } // namespace WebKit
  59. } // namespace BlackBerry
  60. #endif // USE(ACCELERATED_COMPOSITING)
  61. #endif // DefaultTapHighlight_h