InRegionScroller_p.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (C) 2011, 2012 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 InRegionScroller_p_h
  19. #define InRegionScroller_p_h
  20. #include "IntPoint.h"
  21. #include "IntSize.h"
  22. #include <interaction/ScrollViewBase.h>
  23. #include <vector>
  24. namespace WebCore {
  25. class Frame;
  26. class LayerWebKitThread;
  27. class Node;
  28. class RenderBox;
  29. class RenderObject;
  30. class RenderLayer;
  31. }
  32. namespace BlackBerry {
  33. namespace WebKit {
  34. class InRegionScrollableArea;
  35. class WebPagePrivate;
  36. class InRegionScrollerPrivate {
  37. public:
  38. InRegionScrollerPrivate(WebPagePrivate*);
  39. void reset();
  40. void resetSelectionScrollView();
  41. bool isActive() const;
  42. bool setScrollPositionCompositingThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition);
  43. bool setScrollPositionWebKitThread(unsigned camouflagedLayer, const WebCore::IntPoint& scrollPosition,
  44. bool /*acceleratedScrolling*/, Platform::ScrollViewBase::ScrollTarget);
  45. void calculateInRegionScrollableAreasForPoint(const WebCore::IntPoint&);
  46. const std::vector<Platform::ScrollViewBase*>& activeInRegionScrollableAreas() const;
  47. void updateSelectionScrollView(const WebCore::Node*);
  48. void clearDocumentData(const WebCore::Document*);
  49. static bool canScrollRenderBox(WebCore::RenderBox*);
  50. WebPagePrivate* m_webPage;
  51. bool m_needsActiveScrollableAreaCalculation;
  52. private:
  53. Platform::ScrollViewBase* firstScrollableInRegionForNode(const WebCore::Node*);
  54. bool setLayerScrollPosition(WebCore::RenderLayer*, const WebCore::IntPoint& scrollPosition);
  55. void calculateActiveAndShrinkCachedScrollableAreas(WebCore::RenderLayer*);
  56. void pushBackInRegionScrollable(InRegionScrollableArea*);
  57. void adjustScrollDelta(const WebCore::IntPoint& maxOffset, const WebCore::IntPoint& currentOffset, WebCore::IntSize& delta) const;
  58. Platform::ScrollViewBase* clipAndCreateInRegionScrollableArea(WebCore::RenderLayer*);
  59. bool isValidScrollableLayerWebKitThread(WebCore::LayerWebKitThread*) const;
  60. bool isValidScrollableNode(WebCore::Node*) const;
  61. WebCore::IntRect clipToRect(const WebCore::IntRect&, InRegionScrollableArea*);
  62. std::vector<Platform::ScrollViewBase*> m_activeInRegionScrollableAreas;
  63. Platform::ScrollViewBase* m_selectionScrollView;
  64. };
  65. }
  66. }
  67. #endif