Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(954)

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 303253004: Allow proper highlighting on universal overflow scroll. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add commented lifecycle assert Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 } 3144 }
3145 3145
3146 if (hitLayer) 3146 if (hitLayer)
3147 return hitLayer; 3147 return hitLayer;
3148 } 3148 }
3149 } 3149 }
3150 3150
3151 return 0; 3151 return 0;
3152 } 3152 }
3153 3153
3154 void RenderLayer::blockSelectionGapsBoundsChanged()
3155 {
3156 setNeedsCompositingInputsUpdate();
3157 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInp utChange);
3158 }
3159
3154 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds) 3160 void RenderLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds)
3155 { 3161 {
3156 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds)); 3162 m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds));
3163 blockSelectionGapsBoundsChanged();
3157 } 3164 }
3158 3165
3159 void RenderLayer::clearBlockSelectionGapsBounds() 3166 void RenderLayer::clearBlockSelectionGapsBounds()
3160 { 3167 {
3161 m_blockSelectionGapsBounds = IntRect(); 3168 m_blockSelectionGapsBounds = IntRect();
3162 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 3169 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
3163 child->clearBlockSelectionGapsBounds(); 3170 child->clearBlockSelectionGapsBounds();
3171 blockSelectionGapsBoundsChanged();
3164 } 3172 }
3165 3173
3166 void RenderLayer::repaintBlockSelectionGaps() 3174 void RenderLayer::repaintBlockSelectionGaps()
3167 { 3175 {
3168 for (RenderLayer* child = firstChild(); child; child = child->nextSibling()) 3176 for (RenderLayer* child = firstChild(); child; child = child->nextSibling())
3169 child->repaintBlockSelectionGaps(); 3177 child->repaintBlockSelectionGaps();
3170 3178
3171 if (m_blockSelectionGapsBounds.isEmpty()) 3179 if (m_blockSelectionGapsBounds.isEmpty())
3172 return; 3180 return;
3173 3181
3174 LayoutRect rect = m_blockSelectionGapsBounds; 3182 LayoutRect rect = m_blockSelectionGapsBounds;
3175 if (renderer()->hasOverflowClip()) { 3183 if (renderer()->hasOverflowClip()) {
3176 RenderBox* box = renderBox(); 3184 RenderBox* box = renderBox();
3177 rect.move(-box->scrolledContentOffset()); 3185 rect.move(-box->scrolledContentOffset());
3178 if (!scrollableArea()->usesCompositedScrolling()) 3186 if (!scrollableArea()->usesCompositedScrolling())
3179 rect.intersect(box->overflowClipRect(LayoutPoint())); 3187 rect.intersect(box->overflowClipRect(LayoutPoint()));
3180 } 3188 }
3181 if (renderer()->hasClip()) 3189 if (renderer()->hasClip())
3182 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); 3190 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint()));
3183 if (!rect.isEmpty()) 3191 if (!rect.isEmpty())
3184 renderer()->invalidatePaintRectangle(rect); 3192 renderer()->invalidatePaintRectangle(rect);
3185 } 3193 }
3186 3194
3195 IntRect RenderLayer::blockSelectionGapsBounds() const
3196 {
3197 if (!renderer()->isRenderBlock())
3198 return IntRect();
3199
3200 RenderBlock* renderBlock = toRenderBlock(renderer());
3201 LayoutRect gapRects = renderBlock->selectionGapRectsForRepaint(renderBlock);
3202
3203 return pixelSnappedIntRect(gapRects);
3204 }
3205
3187 bool RenderLayer::hasBlockSelectionGapBounds() const 3206 bool RenderLayer::hasBlockSelectionGapBounds() const
3188 { 3207 {
3189 return !m_blockSelectionGapsBounds.isEmpty(); 3208 // FIXME: it would be more accurate to return !blockSelectionGapsBounds().is Empty(), but this is impossible
3209 // at the moment because it causes invalid queries to layout-dependent code (crbug.com/372802).
3210 // ASSERT(renderer()->document().lifecycle().state() >= DocumentLifecycle::L ayoutClean);
3211
3212 if (!renderer()->isRenderBlock())
3213 return false;
3214
3215 return toRenderBlock(renderer())->shouldPaintSelectionGaps();
3190 } 3216 }
3191 3217
3192 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const 3218 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const
3193 { 3219 {
3194 // Always examine the canvas and the root. 3220 // Always examine the canvas and the root.
3195 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView 3221 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView
3196 // paints the root's background. 3222 // paints the root's background.
3197 if (isRootLayer() || renderer()->isDocumentElement()) 3223 if (isRootLayer() || renderer()->isDocumentElement())
3198 return true; 3224 return true;
3199 3225
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 } 3861 }
3836 } 3862 }
3837 3863
3838 void showLayerTree(const WebCore::RenderObject* renderer) 3864 void showLayerTree(const WebCore::RenderObject* renderer)
3839 { 3865 {
3840 if (!renderer) 3866 if (!renderer)
3841 return; 3867 return;
3842 showLayerTree(renderer->enclosingLayer()); 3868 showLayerTree(renderer->enclosingLayer());
3843 } 3869 }
3844 #endif 3870 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/compositing/CompositedLayerMapping.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698