DOMSupport.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 DOMSupport_h
  19. #define DOMSupport_h
  20. #include "IntPoint.h"
  21. #include "IntRect.h"
  22. #include <BlackBerryPlatformInputEvents.h>
  23. #include <wtf/Vector.h>
  24. namespace WTF {
  25. class String;
  26. }
  27. namespace WebCore {
  28. class Element;
  29. class FloatQuad;
  30. class Frame;
  31. class HTMLInputElement;
  32. class HTMLTextFormControlElement;
  33. class Node;
  34. class Position;
  35. class QualifiedName;
  36. class Range;
  37. class RenderObject;
  38. class VisiblePosition;
  39. class VisibleSelection;
  40. }
  41. namespace BlackBerry {
  42. namespace WebKit {
  43. namespace DOMSupport {
  44. enum AttributeState { On, Off, Default };
  45. bool isElementTypePlugin(const WebCore::Element*);
  46. bool isTextInputElement(WebCore::Element*);
  47. bool isShadowHostTextInputElement(WebCore::Node*);
  48. bool isTextBasedContentEditableElement(WebCore::Element*);
  49. bool isPasswordElement(const WebCore::Element*);
  50. bool isPopupInputField(const WebCore::Element*);
  51. bool isDateTimeInputField(const WebCore::Element*);
  52. bool isColorInputField(const WebCore::Element*);
  53. AttributeState elementAttributeState(const WebCore::Element*, const WebCore::QualifiedName&);
  54. AttributeState elementSupportsAutocorrect(const WebCore::Element*);
  55. AttributeState elementSupportsAutocomplete(const WebCore::Element*);
  56. AttributeState elementSupportsSpellCheck(const WebCore::Element*);
  57. bool isElementReadOnly(const WebCore::Element*);
  58. bool elementHasContinuousSpellCheckingEnabled(const PassRefPtr<WebCore::Element>);
  59. WTF::String inputElementText(WebCore::Element*);
  60. WTF::String webWorksContext(const WebCore::Element*);
  61. WebCore::HTMLTextFormControlElement* toTextControlElement(WebCore::Node*);
  62. WebCore::IntRect transformedBoundingBoxForRange(const WebCore::Range&);
  63. void visibleTextQuads(const WebCore::Range&, WTF::Vector<WebCore::FloatQuad>& quads, bool useSelectionHeight = false);
  64. void visibleTextQuads(const WebCore::VisibleSelection&, WTF::Vector<WebCore::FloatQuad>& quads);
  65. WebCore::VisibleSelection visibleSelectionForRangeInputElement(WebCore::Element*, int start, int end);
  66. WebCore::VisibleSelection visibleSelectionForInputElement(WebCore::Element*);
  67. bool elementIdOrNameIndicatesNoAutocomplete(const WebCore::Element*);
  68. bool elementIdOrNameIndicatesEmail(const WebCore::HTMLInputElement*);
  69. bool elementIdOrNameIndicatesUrl(const WebCore::HTMLInputElement*);
  70. bool elementPatternMatches(const char*, const WebCore::HTMLInputElement*);
  71. bool elementPatternIndicatesNumber(const WebCore::HTMLInputElement*);
  72. bool elementPatternIndicatesHexadecimal(const WebCore::HTMLInputElement*);
  73. WebCore::IntPoint convertPointToFrame(const WebCore::Frame* sourceFrame, const WebCore::Frame* targetFrame, const WebCore::IntPoint& sourcePoint, const bool clampToTargetFrame = false);
  74. static const WebCore::IntPoint InvalidPoint = WebCore::IntPoint(-1, -1);
  75. WebCore::VisibleSelection visibleSelectionForClosestActualWordStart(const WebCore::VisibleSelection&);
  76. WebCore::VisibleSelection visibleSelectionForFocusedBlock(WebCore::Element*);
  77. int offsetFromStartOfBlock(const WebCore::VisiblePosition offset);
  78. WebCore::Frame* incrementFrame(WebCore::Frame* curr, bool forward, bool wrapFlag);
  79. PassRefPtr<WebCore::Range> trimWhitespaceFromRange(PassRefPtr<WebCore::Range>);
  80. PassRefPtr<WebCore::Range> trimWhitespaceFromRange(WebCore::VisiblePosition startPosition, WebCore::VisiblePosition endPosition);
  81. bool isRangeTextAllWhitespace(WebCore::VisiblePosition startPosition, WebCore::VisiblePosition endPosition);
  82. bool isFixedPositionOrHasFixedPositionAncestor(WebCore::RenderObject*);
  83. WebCore::Element* selectionContainerElement(const WebCore::VisibleSelection&);
  84. BlackBerry::Platform::RequestedHandlePosition elementHandlePositionAttribute(const WebCore::Element*);
  85. bool isElementAndDocumentAttached(const WebCore::Element*);
  86. } // DOMSupport
  87. } // WebKit
  88. } // BlackBerry
  89. #endif // DOMSupport_h