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

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: remove -expected.txt 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 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(CompositingUpdateOnCompositedScroll) ;
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 return !blockSelectionGapsBounds().isEmpty();
3185 } 3204 }
3186 3205
3187 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const 3206 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const Layo utRect& damageRect, const RenderLayer* rootLayer, const LayoutPoint* offsetFromR oot) const
3188 { 3207 {
3189 // Always examine the canvas and the root. 3208 // Always examine the canvas and the root.
3190 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView 3209 // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the RenderView
3191 // paints the root's background. 3210 // paints the root's background.
3192 if (isRootLayer() || renderer()->isDocumentElement()) 3211 if (isRootLayer() || renderer()->isDocumentElement())
3193 return true; 3212 return true;
3194 3213
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
3830 } 3849 }
3831 } 3850 }
3832 3851
3833 void showLayerTree(const WebCore::RenderObject* renderer) 3852 void showLayerTree(const WebCore::RenderObject* renderer)
3834 { 3853 {
3835 if (!renderer) 3854 if (!renderer)
3836 return; 3855 return;
3837 showLayerTree(renderer->enclosingLayer()); 3856 showLayerTree(renderer->enclosingLayer());
3838 } 3857 }
3839 #endif 3858 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698