| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 if (m_paintInvalidationContainer && o->canUpdateSelectionOnRootLineBoxes
()) { | 63 if (m_paintInvalidationContainer && o->canUpdateSelectionOnRootLineBoxes
()) { |
| 64 m_rect = o->selectionRectForPaintInvalidation(m_paintInvalidationCon
tainer); | 64 m_rect = o->selectionRectForPaintInvalidation(m_paintInvalidationCon
tainer); |
| 65 // FIXME: groupedMapping() leaks the squashing abstraction. See Rend
erBlockSelectionInfo for more details. | 65 // FIXME: groupedMapping() leaks the squashing abstraction. See Rend
erBlockSelectionInfo for more details. |
| 66 if (m_paintInvalidationContainer->layer()->groupedMapping()) | 66 if (m_paintInvalidationContainer->layer()->groupedMapping()) |
| 67 RenderLayer::mapRectToPaintBackingCoordinates(m_paintInvalidatio
nContainer, m_rect); | 67 RenderLayer::mapRectToPaintBackingCoordinates(m_paintInvalidatio
nContainer, m_rect); |
| 68 } else { | 68 } else { |
| 69 m_rect = LayoutRect(); | 69 m_rect = LayoutRect(); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 void invalidatePaint() | |
| 74 { | |
| 75 m_object->invalidatePaintUsingContainer(m_paintInvalidationContainer, en
closingIntRect(m_rect), PaintInvalidationSelection); | |
| 76 } | |
| 77 | |
| 78 LayoutRect absoluteSelectionRect() const | 73 LayoutRect absoluteSelectionRect() const |
| 79 { | 74 { |
| 80 if (!m_paintInvalidationContainer) | 75 if (!m_paintInvalidationContainer) |
| 81 return LayoutRect(); | 76 return LayoutRect(); |
| 82 | 77 |
| 83 FloatQuad absQuad = m_paintInvalidationContainer->localToAbsoluteQuad(Fl
oatRect(m_rect)); | 78 FloatQuad absQuad = m_paintInvalidationContainer->localToAbsoluteQuad(Fl
oatRect(m_rect)); |
| 84 return absQuad.enclosingBoundingBox(); | 79 return absQuad.enclosingBoundingBox(); |
| 85 } | 80 } |
| 86 | 81 |
| 87 bool hasChangedFrom(const RenderSelectionInfo& other) const | |
| 88 { | |
| 89 // There is no point in comparing selection info for different objects. | |
| 90 ASSERT(m_object == other.m_object); | |
| 91 ASSERT(m_paintInvalidationContainer == other.m_paintInvalidationContaine
r); | |
| 92 | |
| 93 return m_state != other.m_state || m_rect != other.m_rect; | |
| 94 } | |
| 95 | |
| 96 private: | 82 private: |
| 97 LayoutRect m_rect; // relative to paint invalidation container | 83 LayoutRect m_rect; // relative to paint invalidation container |
| 98 }; | 84 }; |
| 99 | 85 |
| 100 // This struct is used when the selection changes to cache the old and new state
of the selection for each RenderBlock. | |
| 101 class RenderBlockSelectionInfo final : public RenderSelectionInfoBase { | |
| 102 public: | |
| 103 RenderBlockSelectionInfo(RenderBlock* b) | |
| 104 : RenderSelectionInfoBase(b) | |
| 105 { | |
| 106 if (m_paintInvalidationContainer && b->canUpdateSelectionOnRootLineBoxes
()) | |
| 107 m_rects = block()->selectionGapRectsForPaintInvalidation(m_paintInva
lidationContainer); | |
| 108 else | |
| 109 m_rects = GapRects(); | |
| 110 } | |
| 111 | |
| 112 void invalidatePaint() | |
| 113 { | |
| 114 LayoutRect paintInvalidationRect = m_rects; | |
| 115 // FIXME: this is leaking the squashing abstraction. However, removing t
he groupedMapping() condiitional causes | |
| 116 // RenderBox::mapRectToPaintInvalidationBacking to get called, which mak
es rect adjustments even if you pass the same | |
| 117 // paintInvalidationContainer as the render object. Find out why it does
that and fix. | |
| 118 if (m_paintInvalidationContainer && m_paintInvalidationContainer->layer(
)->groupedMapping()) | |
| 119 RenderLayer::mapRectToPaintBackingCoordinates(m_paintInvalidationCon
tainer, paintInvalidationRect); | |
| 120 m_object->invalidatePaintUsingContainer(m_paintInvalidationContainer, en
closingIntRect(paintInvalidationRect), PaintInvalidationSelection); | |
| 121 } | |
| 122 | |
| 123 bool hasChangedFrom(const RenderBlockSelectionInfo& other) const | |
| 124 { | |
| 125 // There is no point in comparing selection info for different objects. | |
| 126 ASSERT(m_object == other.m_object); | |
| 127 ASSERT(m_paintInvalidationContainer == other.m_paintInvalidationContaine
r); | |
| 128 | |
| 129 return m_state != other.m_state || m_rects != other.m_rects; | |
| 130 } | |
| 131 | |
| 132 private: | |
| 133 RenderBlock* block() const { return toRenderBlock(m_object); } | |
| 134 | |
| 135 GapRects m_rects; // relative to paint invalidation container | |
| 136 }; | |
| 137 | |
| 138 } // namespace blink | 86 } // namespace blink |
| 139 | 87 |
| 140 | 88 |
| 141 #endif // RenderSelectionInfo_h | 89 #endif // RenderSelectionInfo_h |
| OLD | NEW |