WebHitTestResult.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library 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. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public License
  15. * along with this library; see the file COPYING.LIB. If not, write to
  16. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19. #ifndef WebHitTestResult_h
  20. #define WebHitTestResult_h
  21. #include "APIObject.h"
  22. #include <WebCore/IntRect.h>
  23. #include <wtf/Forward.h>
  24. #include <wtf/PassRefPtr.h>
  25. #include <wtf/RefPtr.h>
  26. #include <wtf/text/WTFString.h>
  27. namespace CoreIPC {
  28. class ArgumentDecoder;
  29. class ArgumentEncoder;
  30. }
  31. namespace WebCore {
  32. class HitTestResult;
  33. }
  34. namespace WebKit {
  35. class WebFrame;
  36. class WebHitTestResult : public TypedAPIObject<APIObject::TypeHitTestResult> {
  37. public:
  38. struct Data {
  39. String absoluteImageURL;
  40. String absolutePDFURL;
  41. String absoluteLinkURL;
  42. String absoluteMediaURL;
  43. String linkLabel;
  44. String linkTitle;
  45. bool isContentEditable;
  46. WebCore::IntRect elementBoundingBox;
  47. bool isScrollbar;
  48. Data();
  49. explicit Data(const WebCore::HitTestResult&);
  50. ~Data();
  51. void encode(CoreIPC::ArgumentEncoder&) const;
  52. static bool decode(CoreIPC::ArgumentDecoder&, WebHitTestResult::Data&);
  53. WebCore::IntRect elementBoundingBoxInWindowCoordinates(const WebCore::HitTestResult&);
  54. };
  55. static PassRefPtr<WebHitTestResult> create(const WebHitTestResult::Data&);
  56. String absoluteImageURL() const { return m_data.absoluteImageURL; }
  57. String absolutePDFURL() const { return m_data.absolutePDFURL; }
  58. String absoluteLinkURL() const { return m_data.absoluteLinkURL; }
  59. String absoluteMediaURL() const { return m_data.absoluteMediaURL; }
  60. String linkLabel() const { return m_data.linkLabel; }
  61. String linkTitle() const { return m_data.linkTitle; }
  62. bool isContentEditable() const { return m_data.isContentEditable; }
  63. WebCore::IntRect elementBoundingBox() const { return m_data.elementBoundingBox; }
  64. bool isScrollbar() const { return m_data.isScrollbar; }
  65. private:
  66. explicit WebHitTestResult(const WebHitTestResult::Data& hitTestResultData)
  67. : m_data(hitTestResultData)
  68. {
  69. }
  70. Data m_data;
  71. };
  72. } // namespace WebKit
  73. #endif // WebHitTestResult_h