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 3162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3173 } | 3173 } |
| 3174 | 3174 |
| 3175 if (hitLayer) | 3175 if (hitLayer) |
| 3176 return hitLayer; | 3176 return hitLayer; |
| 3177 } | 3177 } |
| 3178 } | 3178 } |
| 3179 | 3179 |
| 3180 return 0; | 3180 return 0; |
| 3181 } | 3181 } |
| 3182 | 3182 |
| 3183 void RenderLayer::blockSelectionGapsBoundsChanged() | |
| 3184 { | |
| 3185 if (needsCompositedScrolling() && hasCompositedLayerMapping()) | |
|
Ian Vollick
2014/06/12 14:54:57
This looks like a chicken-and-egg thing, but I thi
hartmanng
2014/06/13 14:51:37
Done.
| |
| 3186 m_compositedLayerMapping->updateScrollingBlockSelection(); | |
|
abarth-chromium
2014/06/13 04:31:05
Yeah, you should be able to just:
setNeedsComposi
hartmanng
2014/06/13 14:51:37
Would compositor()->setNeedsCompositingUpdate(Comp
| |
| 3187 } | |
| 3188 | |
| 3183 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) | 3189 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) |
| 3184 { | 3190 { |
| 3185 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); | 3191 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); |
| 3192 blockSelectionGapsBoundsChanged(); | |
| 3186 } | 3193 } |
| 3187 | 3194 |
| 3188 void RenderLayer::clearBlockSelectionGapsBounds() | 3195 void RenderLayer::clearBlockSelectionGapsBounds() |
| 3189 { | 3196 { |
| 3190 m_blockSelectionGapsBounds = IntRect(); | 3197 m_blockSelectionGapsBounds = IntRect(); |
| 3191 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 3198 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 3192 child->clearBlockSelectionGapsBounds(); | 3199 child->clearBlockSelectionGapsBounds(); |
| 3200 blockSelectionGapsBoundsChanged(); | |
| 3193 } | 3201 } |
| 3194 | 3202 |
| 3195 void RenderLayer::repaintBlockSelectionGaps() | 3203 void RenderLayer::repaintBlockSelectionGaps() |
| 3196 { | 3204 { |
| 3197 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) | 3205 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) |
| 3198 child->repaintBlockSelectionGaps(); | 3206 child->repaintBlockSelectionGaps(); |
| 3199 | 3207 |
| 3200 if (m_blockSelectionGapsBounds.isEmpty()) | 3208 if (m_blockSelectionGapsBounds.isEmpty()) |
| 3201 return; | 3209 return; |
| 3202 | 3210 |
| 3203 LayoutRect rect = m_blockSelectionGapsBounds; | 3211 LayoutRect rect = m_blockSelectionGapsBounds; |
| 3204 if (renderer()->hasOverflowClip()) { | 3212 if (renderer()->hasOverflowClip()) { |
| 3205 RenderBox* box = renderBox(); | 3213 RenderBox* box = renderBox(); |
| 3206 rect.move(-box->scrolledContentOffset()); | 3214 rect.move(-box->scrolledContentOffset()); |
| 3207 if (!scrollableArea()->usesCompositedScrolling()) | 3215 if (!scrollableArea()->usesCompositedScrolling()) |
| 3208 rect.intersect(box->overflowClipRect(LayoutPoint())); | 3216 rect.intersect(box->overflowClipRect(LayoutPoint())); |
| 3209 } | 3217 } |
| 3210 if (renderer()->hasClip()) | 3218 if (renderer()->hasClip()) |
| 3211 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); | 3219 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); |
| 3212 if (!rect.isEmpty()) | 3220 if (!rect.isEmpty()) |
| 3213 renderer()->invalidatePaintRectangle(rect); | 3221 renderer()->invalidatePaintRectangle(rect); |
| 3214 } | 3222 } |
| 3215 | 3223 |
| 3216 bool RenderLayer::hasBlockSelectionGapBounds() const | 3224 IntRect RenderLayer::blockSelectionGapsBounds() const |
| 3217 { | 3225 { |
| 3218 return !m_blockSelectionGapsBounds.isEmpty(); | 3226 if (!renderer()->isRenderBlock()) |
| 3227 return IntRect(); | |
| 3228 | |
| 3229 RenderBlock* renderBlock = toRenderBlock(renderer()); | |
| 3230 LayoutRect gapRects = renderBlock->selectionGapRectsForRepaint(renderBlock); | |
| 3231 | |
| 3232 return pixelSnappedIntRect(gapRects); | |
| 3233 } | |
| 3234 | |
| 3235 RenderLayer::PresenceOfBlockSelectionGaps RenderLayer::hasBlockSelectionGapBound s() const | |
| 3236 { | |
| 3237 return blockSelectionGapsBounds().isEmpty() ? LayerDoesNotHaveBlockSelection Gaps : LayerHasBlockSelectionGaps; | |
| 3219 } | 3238 } |
| 3220 | 3239 |
| 3221 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const | 3240 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const |
| 3222 { | 3241 { |
| 3223 // Always examine the canvas and the root. | 3242 // Always examine the canvas and the root. |
| 3224 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView | 3243 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView |
| 3225 // paints the root's background. | 3244 // paints the root's background. |
| 3226 if (isRootLayer() || renderer()->isDocumentElement()) | 3245 if (isRootLayer() || renderer()->isDocumentElement()) |
| 3227 return true; | 3246 return true; |
| 3228 | 3247 |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3864 } | 3883 } |
| 3865 } | 3884 } |
| 3866 | 3885 |
| 3867 void showLayerTree(const WebCore::RenderObject* renderer) | 3886 void showLayerTree(const WebCore::RenderObject* renderer) |
| 3868 { | 3887 { |
| 3869 if (!renderer) | 3888 if (!renderer) |
| 3870 return; | 3889 return; |
| 3871 showLayerTree(renderer->enclosingLayer()); | 3890 showLayerTree(renderer->enclosingLayer()); |
| 3872 } | 3891 } |
| 3873 #endif | 3892 #endif |
| OLD | NEW |