Changeset 90485 in webkit
- Timestamp:
- Jul 6, 2011, 1:20:05 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
rendering/LayoutTypes.h (modified) (2 diffs)
-
rendering/RenderLayer.cpp (modified) (17 diffs)
-
rendering/RenderLayer.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90484 r90485 1 2011-07-06 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Switch RenderLayer::hitTest* to to new layout types 6 https://bugs.webkit.org/show_bug.cgi?id=63640 7 8 Switch hit testing and supporting methods for RenderLayer over to the new 9 layout unit abstraction. 10 11 No new tests, no functionality changes. 12 13 * rendering/LayoutTypes.h: 14 (WebCore::roundedLayoutPoint): 15 Add roundedLayoutPoint abstraction, calls roundedIntPoint now but will be a 16 no-op (and eventually go away) once we switch to float or fixed point. 17 18 * rendering/RenderLayer.cpp: 19 (WebCore::RenderLayer::createLocalTransformState): 20 (WebCore::RenderLayer::hitTestLayer): 21 (WebCore::RenderLayer::hitTestList): 22 (WebCore::RenderLayer::hitTestPaginatedChildLayer): 23 (WebCore::RenderLayer::hitTestChildLayerColumns): 24 (WebCore::RenderLayer::calculateRects): 25 * rendering/RenderLayer.h: 26 1 27 2011-07-06 Simon Fraser <simon.fraser@apple.com> 2 28 -
trunk/Source/WebCore/rendering/LayoutTypes.h
r89945 r90485 37 37 #define LayoutTypes_h 38 38 39 #include "FloatPoint.h" 39 40 #include "IntRect.h" 40 41 … … 46 47 typedef IntRect LayoutRect; 47 48 49 inline LayoutPoint roundedLayoutPoint(FloatPoint point) 50 { 51 return roundedIntPoint(point); 52 } 53 48 54 } // namespace WebCore 49 55 -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r90484 r90485 2913 2913 2914 2914 PassRefPtr<HitTestingTransformState> RenderLayer::createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer, 2915 const IntRect& hitTestRect, const IntPoint& hitTestPoint,2915 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, 2916 2916 const HitTestingTransformState* containerTransformState) const 2917 2917 { 2918 2918 RefPtr<HitTestingTransformState> transformState; 2919 IntPoint offset;2919 LayoutPoint offset; 2920 2920 if (containerTransformState) { 2921 2921 // If we're already computing transform state, then it's relative to the container (which we know is non-null). … … 2975 2975 // *zOffset on return is the z offset of the hit point relative to the containing flattening layer. 2976 2976 RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, 2977 const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,2977 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, bool appliedTransform, 2978 2978 const HitTestingTransformState* transformState, double* zOffset) 2979 2979 { … … 2986 2986 useTemporaryClipRects |= renderer()->view()->frameView()->containsScrollableAreaWithOverlayScrollbars(); 2987 2987 2988 IntRect hitTestArea = result.rectForPoint(hitTestPoint);2988 LayoutRect hitTestArea = result.rectForPoint(hitTestPoint); 2989 2989 2990 2990 // Apply a transform if we have one. … … 3011 3011 // We can't just map hitTestPoint and hitTestRect because they may have been flattened (losing z) 3012 3012 // by our container. 3013 IntPoint localPoint = roundedIntPoint(newTransformState->mappedPoint());3014 IntRect localHitTestRect;3013 LayoutPoint localPoint = roundedLayoutPoint(newTransformState->mappedPoint()); 3014 LayoutRect localHitTestRect; 3015 3015 #if USE(ACCELERATED_COMPOSITING) 3016 3016 if (isComposited()) { … … 3056 3056 3057 3057 // Calculate the clip rects we should use. 3058 IntRect layerBounds;3059 IntRect bgRect;3060 IntRect fgRect;3061 IntRect outlineRect;3058 LayoutRect layerBounds; 3059 LayoutRect bgRect; 3060 LayoutRect fgRect; 3061 LayoutRect outlineRect; 3062 3062 calculateRects(rootLayer, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, useTemporaryClipRects, IncludeOverlayScrollbarSize); 3063 3063 … … 3181 3181 RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* rootLayer, 3182 3182 const HitTestRequest& request, HitTestResult& result, 3183 const IntRect& hitTestRect, const IntPoint& hitTestPoint,3183 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, 3184 3184 const HitTestingTransformState* transformState, 3185 3185 double* zOffsetForDescendants, double* zOffset, … … 3218 3218 3219 3219 RenderLayer* RenderLayer::hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, 3220 const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset)3220 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset) 3221 3221 { 3222 3222 Vector<RenderLayer*> columnLayers; … … 3235 3235 3236 3236 RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, 3237 const IntRect& hitTestRect, const IntPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset,3237 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, const HitTestingTransformState* transformState, double* zOffset, 3238 3238 const Vector<RenderLayer*>& columnLayers, size_t columnIndex) 3239 3239 { … … 3244 3244 return 0; 3245 3245 3246 IntPoint layerOffset;3246 LayoutPoint layerOffset; 3247 3247 columnBlock->layer()->convertToLayerCoords(rootLayer, layerOffset); 3248 3248 … … 3252 3252 // We have to go backwards from the last column to the first. 3253 3253 bool isHorizontal = columnBlock->style()->isHorizontalWritingMode(); 3254 int logicalLeft = columnBlock->logicalLeftOffsetForContent();3255 int currLogicalTopOffset = 0;3254 LayoutUnit logicalLeft = columnBlock->logicalLeftOffsetForContent(); 3255 LayoutUnit currLogicalTopOffset = 0; 3256 3256 int i; 3257 3257 for (i = 0; i < colCount; i++) { 3258 IntRect colRect = columnBlock->columnRectAt(colInfo, i);3259 int blockDelta = (isHorizontal ? colRect.height() : colRect.width());3258 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); 3259 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.width()); 3260 3260 if (columnBlock->style()->isFlippedBlocksWritingMode()) 3261 3261 currLogicalTopOffset += blockDelta; … … 3265 3265 for (i = colCount - 1; i >= 0; i--) { 3266 3266 // For each rect, we clip to the rect, and then we adjust our coords. 3267 IntRect colRect = columnBlock->columnRectAt(colInfo, i);3267 LayoutRect colRect = columnBlock->columnRectAt(colInfo, i); 3268 3268 columnBlock->flipForWritingMode(colRect); 3269 int currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft;3270 int blockDelta = (isHorizontal ? colRect.height() : colRect.width());3269 LayoutUnit currLogicalLeftOffset = (isHorizontal ? colRect.x() : colRect.y()) - logicalLeft; 3270 LayoutUnit blockDelta = (isHorizontal ? colRect.height() : colRect.width()); 3271 3271 if (columnBlock->style()->isFlippedBlocksWritingMode()) 3272 3272 currLogicalTopOffset -= blockDelta; … … 3275 3275 colRect.moveBy(layerOffset); 3276 3276 3277 IntRect localClipRect(hitTestRect);3277 LayoutRect localClipRect(hitTestRect); 3278 3278 localClipRect.intersect(colRect); 3279 3279 3280 IntSize offset = isHorizontal ? IntSize(currLogicalLeftOffset, currLogicalTopOffset) : IntSize(currLogicalTopOffset, currLogicalLeftOffset);3280 LayoutSize offset = isHorizontal ? LayoutSize(currLogicalLeftOffset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, currLogicalLeftOffset); 3281 3281 3282 3282 if (!localClipRect.isEmpty() && localClipRect.intersects(result.rectForPoint(hitTestPoint))) { … … 3303 3303 RefPtr<HitTestingTransformState> newTransformState = nextLayer->createLocalTransformState(rootLayer, nextLayer, localClipRect, hitTestPoint, transformState); 3304 3304 newTransformState->translate(offset.width(), offset.height(), HitTestingTransformState::AccumulateTransform); 3305 IntPoint localPoint = roundedIntPoint(newTransformState->mappedPoint());3306 IntRect localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox();3305 LayoutPoint localPoint = roundedLayoutPoint(newTransformState->mappedPoint()); 3306 LayoutRect localHitTestRect = newTransformState->mappedQuad().enclosingBoundingBox(); 3307 3307 newTransformState->flatten(); 3308 3308 … … 3434 3434 } 3435 3435 3436 void RenderLayer::calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds,3437 IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects,3436 void RenderLayer::calculateRects(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 3437 LayoutRect& backgroundRect, LayoutRect& foregroundRect, LayoutRect& outlineRect, bool temporaryClipRects, 3438 3438 OverlayScrollbarSizeRelevancy relevancy) const 3439 3439 { … … 3447 3447 outlineRect = backgroundRect; 3448 3448 3449 IntPoint offset;3449 LayoutPoint offset; 3450 3450 convertToLayerCoords(rootLayer, offset); 3451 layerBounds = IntRect(offset, size());3451 layerBounds = LayoutRect(offset, size()); 3452 3452 3453 3453 // Update the clip rects that will be passed to child layers. … … 3458 3458 if (renderer()->hasClip()) { 3459 3459 // Clip applies to *us* as well, so go ahead and update the damageRect. 3460 IntRect newPosClip = toRenderBox(renderer())->clipRect(offset);3460 LayoutRect newPosClip = toRenderBox(renderer())->clipRect(offset); 3461 3461 backgroundRect.intersect(newPosClip); 3462 3462 foregroundRect.intersect(newPosClip); … … 3469 3469 // See https://bugs.webkit.org/show_bug.cgi?id=37467 for more information. 3470 3470 if (const ShadowData* boxShadow = renderer()->style()->boxShadow()) { 3471 IntRect overflow = layerBounds;3471 LayoutRect overflow = layerBounds; 3472 3472 do { 3473 3473 if (boxShadow->style() == Normal) { -
trunk/Source/WebCore/rendering/RenderLayer.h
r90484 r90485 376 376 // |rootLayer}. It also computes our background and foreground clip rects 377 377 // for painting/event handling. 378 void calculateRects(const RenderLayer* rootLayer, const IntRect& paintDirtyRect, IntRect& layerBounds,379 IntRect& backgroundRect, IntRect& foregroundRect, IntRect& outlineRect, bool temporaryClipRects = false,378 void calculateRects(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, 379 LayoutRect& backgroundRect, LayoutRect& foregroundRect, LayoutRect& outlineRect, bool temporaryClipRects = false, 380 380 OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; 381 381 … … 507 507 508 508 RenderLayer* hitTestLayer(RenderLayer* rootLayer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, 509 const IntRect& hitTestRect, const IntPoint& hitTestPoint, bool appliedTransform,509 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, bool appliedTransform, 510 510 const HitTestingTransformState* transformState = 0, double* zOffset = 0); 511 511 RenderLayer* hitTestList(Vector<RenderLayer*>*, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, 512 const IntRect& hitTestRect, const IntPoint& hitTestPoint,512 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, 513 513 const HitTestingTransformState* transformState, double* zOffsetForDescendants, double* zOffset, 514 514 const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants); 515 515 RenderLayer* hitTestPaginatedChildLayer(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, 516 const IntRect& hitTestRect, const IntPoint& hitTestPoint,516 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, 517 517 const HitTestingTransformState* transformState, double* zOffset); 518 518 RenderLayer* hitTestChildLayerColumns(RenderLayer* childLayer, RenderLayer* rootLayer, const HitTestRequest& request, HitTestResult& result, 519 const IntRect& hitTestRect, const IntPoint& hitTestPoint,519 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, 520 520 const HitTestingTransformState* transformState, double* zOffset, 521 521 const Vector<RenderLayer*>& columnLayers, size_t columnIndex); 522 522 523 523 PassRefPtr<HitTestingTransformState> createLocalTransformState(RenderLayer* rootLayer, RenderLayer* containerLayer, 524 const IntRect& hitTestRect, const IntPoint& hitTestPoint,524 const LayoutRect& hitTestRect, const LayoutPoint& hitTestPoint, 525 525 const HitTestingTransformState* containerTransformState) const; 526 526
Note:
See TracChangeset
for help on using the changeset viewer.