Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3139 } | 3139 } |
| 3140 | 3140 |
| 3141 if (hitLayer) | 3141 if (hitLayer) |
| 3142 return hitLayer; | 3142 return hitLayer; |
| 3143 } | 3143 } |
| 3144 } | 3144 } |
| 3145 | 3145 |
| 3146 return 0; | 3146 return 0; |
| 3147 } | 3147 } |
| 3148 | 3148 |
| 3149 void RenderLayer::blockSelectionGapsBoundsChanged() | |
| 3150 { | |
| 3151 setNeedsCompositingInputsUpdate(); | |
| 3152 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInp utChange); | |
| 3153 } | |
| 3154 | |
| 3149 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) | 3155 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) |
| 3150 { | 3156 { |
| 3151 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); | 3157 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); |
| 3158 blockSelectionGapsBoundsChanged(); | |
| 3152 } | 3159 } |
| 3153 | 3160 |
| 3154 void RenderLayer::clearBlockSelectionGapsBounds() | 3161 void RenderLayer::clearBlockSelectionGapsBounds() |
| 3155 { | 3162 { |
| 3156 m_blockSelectionGapsBounds = IntRect(); | 3163 m_blockSelectionGapsBounds = IntRect(); |
| 3157 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 3164 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 3158 child->clearBlockSelectionGapsBounds(); | 3165 child->clearBlockSelectionGapsBounds(); |
| 3166 blockSelectionGapsBoundsChanged(); | |
| 3159 } | 3167 } |
| 3160 | 3168 |
| 3161 void RenderLayer::repaintBlockSelectionGaps() | 3169 void RenderLayer::repaintBlockSelectionGaps() |
| 3162 { | 3170 { |
| 3163 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 3171 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 3164 child->repaintBlockSelectionGaps(); | 3172 child->repaintBlockSelectionGaps(); |
| 3165 | 3173 |
| 3166 if (m_blockSelectionGapsBounds.isEmpty()) | 3174 if (m_blockSelectionGapsBounds.isEmpty()) |
| 3167 return; | 3175 return; |
| 3168 | 3176 |
| 3169 LayoutRect rect = m_blockSelectionGapsBounds; | 3177 LayoutRect rect = m_blockSelectionGapsBounds; |
| 3170 if (renderer()->hasOverflowClip()) { | 3178 if (renderer()->hasOverflowClip()) { |
| 3171 RenderBox* box = renderBox(); | 3179 RenderBox* box = renderBox(); |
| 3172 rect.move(-box->scrolledContentOffset()); | 3180 rect.move(-box->scrolledContentOffset()); |
| 3173 if (!scrollableArea()->usesCompositedScrolling()) | 3181 if (!scrollableArea()->usesCompositedScrolling()) |
| 3174 rect.intersect(box->overflowClipRect(LayoutPoint())); | 3182 rect.intersect(box->overflowClipRect(LayoutPoint())); |
| 3175 } | 3183 } |
| 3176 if (renderer()->hasClip()) | 3184 if (renderer()->hasClip()) |
| 3177 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); | 3185 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); |
| 3178 if (!rect.isEmpty()) | 3186 if (!rect.isEmpty()) |
| 3179 renderer()->invalidatePaintRectangle(rect); | 3187 renderer()->invalidatePaintRectangle(rect); |
| 3180 } | 3188 } |
| 3181 | 3189 |
| 3190 IntRect RenderLayer::blockSelectionGapsBounds() const | |
| 3191 { | |
| 3192 if (!renderer()->isRenderBlock()) | |
| 3193 return IntRect(); | |
| 3194 | |
| 3195 RenderBlock* renderBlock = toRenderBlock(renderer()); | |
| 3196 LayoutRect gapRects = renderBlock->selectionGapRectsForRepaint(renderBlock); | |
| 3197 | |
| 3198 return pixelSnappedIntRect(gapRects); | |
| 3199 } | |
| 3200 | |
| 3182 bool RenderLayer::hasBlockSelectionGapBounds() const | 3201 bool RenderLayer::hasBlockSelectionGapBounds() const |
| 3183 { | 3202 { |
| 3184 return !m_blockSelectionGapsBounds.isEmpty(); | 3203 // FIXME: it would be more accurate to return !blockSelectionGapsBounds().is Empty(), but this is impossible |
| 3204 // at the moment because it causes invalid queries to layout-dependent code (crbug.com/372802). | |
|
Julien - ping for review
2014/06/16 18:30:24
As mentioned, we should have a lifecycle ASSERT he
hartmanng
2014/06/16 19:19:14
Done.
| |
| 3205 | |
| 3206 if (!renderer()->isRenderBlock()) | |
| 3207 return false; | |
| 3208 | |
| 3209 return toRenderBlock(renderer())->shouldPaintSelectionGaps(); | |
|
abarth-chromium
2014/06/13 21:55:54
LGTM, but I'm not 100% sure about these last two s
Julien - ping for review
2014/06/16 18:30:24
This will yield to false positive as shouldPaintSe
| |
| 3185 } | 3210 } |
| 3186 | 3211 |
| 3187 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const | 3212 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const |
| 3188 { | 3213 { |
| 3189 // Always examine the canvas and the root. | 3214 // Always examine the canvas and the root. |
| 3190 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView | 3215 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView |
| 3191 // paints the root's background. | 3216 // paints the root's background. |
| 3192 if (isRootLayer() || renderer()->isDocumentElement()) | 3217 if (isRootLayer() || renderer()->isDocumentElement()) |
| 3193 return true; | 3218 return true; |
| 3194 | 3219 |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3830 } | 3855 } |
| 3831 } | 3856 } |
| 3832 | 3857 |
| 3833 void showLayerTree(const WebCore::RenderObject* renderer) | 3858 void showLayerTree(const WebCore::RenderObject* renderer) |
| 3834 { | 3859 { |
| 3835 if (!renderer) | 3860 if (!renderer) |
| 3836 return; | 3861 return; |
| 3837 showLayerTree(renderer->enclosingLayer()); | 3862 showLayerTree(renderer->enclosingLayer()); |
| 3838 } | 3863 } |
| 3839 #endif | 3864 #endif |
| OLD | NEW |