summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/RenderedDocumentMarker.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/RenderedDocumentMarker.h')
-rw-r--r--Source/WebCore/dom/RenderedDocumentMarker.h58
1 files changed, 31 insertions, 27 deletions
diff --git a/Source/WebCore/dom/RenderedDocumentMarker.h b/Source/WebCore/dom/RenderedDocumentMarker.h
index 7e8fe2b55..89e6493b7 100644
--- a/Source/WebCore/dom/RenderedDocumentMarker.h
+++ b/Source/WebCore/dom/RenderedDocumentMarker.h
@@ -24,49 +24,53 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef RenderedDocumentMarker_h
-#define RenderedDocumentMarker_h
+#pragma once
#include "DocumentMarker.h"
+#include <wtf/Vector.h>
namespace WebCore {
class RenderedDocumentMarker : public DocumentMarker {
public:
-
explicit RenderedDocumentMarker(const DocumentMarker& marker)
- : DocumentMarker(marker), m_renderedRect(invalidMarkerRect())
+ : DocumentMarker(marker)
{
}
- bool isRendered() const { return invalidMarkerRect() != m_renderedRect; }
- bool contains(const LayoutPoint& point) const { return isRendered() && m_renderedRect.contains(point); }
- void setRenderedRect(const LayoutRect& r) { m_renderedRect = r; }
- const LayoutRect& renderedRect() const { return m_renderedRect; }
- void invalidate(const LayoutRect&);
- void invalidate() { m_renderedRect = invalidMarkerRect(); }
+ bool contains(const FloatPoint& point) const
+ {
+ ASSERT(m_isValid);
+ for (const auto& rect : m_rects) {
+ if (rect.contains(point))
+ return true;
+ }
+ return false;
+ }
-private:
- static const LayoutRect& invalidMarkerRect()
+ void setUnclippedAbsoluteRects(Vector<FloatRect>& rects)
{
- static const LayoutRect rect = LayoutRect(-1, -1, -1, -1);
- return rect;
+ m_isValid = true;
+ m_rects = rects;
}
- LayoutRect m_renderedRect;
-};
+ const Vector<FloatRect, 1>& unclippedAbsoluteRects() const
+ {
+ ASSERT(m_isValid);
+ return m_rects;
+ }
-inline void RenderedDocumentMarker::invalidate(const LayoutRect& r)
-{
- if (m_renderedRect.intersects(r))
- invalidate();
-}
+ void invalidate()
+ {
+ m_isValid = false;
+ m_rects.clear();
+ }
-inline RenderedDocumentMarker* toRenderedDocumentMarker(DocumentMarker* marker)
-{
- return static_cast<RenderedDocumentMarker*>(marker);
-}
+ bool isValid() const { return m_isValid; }
-} // namespace
+private:
+ Vector<FloatRect, 1> m_rects;
+ bool m_isValid { false };
+};
-#endif
+} // namespace WebCore