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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 CompositingState LayoutObject::compositingState() const 2557 CompositingState LayoutObject::compositingState() const
2558 { 2558 {
2559 return hasLayer() ? toLayoutBoxModelObject(this)->layer()->compositingState( ) : NotComposited; 2559 return hasLayer() ? toLayoutBoxModelObject(this)->layer()->compositingState( ) : NotComposited;
2560 } 2560 }
2561 2561
2562 CompositingReasons LayoutObject::additionalCompositingReasons() const 2562 CompositingReasons LayoutObject::additionalCompositingReasons() const
2563 { 2563 {
2564 return CompositingReasonNone; 2564 return CompositingReasonNone;
2565 } 2565 }
2566 2566
2567 bool LayoutObject::hitTest(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse t, HitTestFilter hitTestFilter) 2567 bool LayoutObject::hitTest(HitTestResult& result, const HitTestLocation& locatio nInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter hitTestFilter)
2568 { 2568 {
2569 bool inside = false; 2569 bool inside = false;
2570 if (hitTestFilter != HitTestSelf) { 2570 if (hitTestFilter != HitTestSelf) {
2571 // First test the foreground layer (lines and inlines). 2571 // First test the foreground layer (lines and inlines).
2572 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf fset, HitTestForeground); 2572 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, Hit TestForeground);
2573 2573
2574 // Test floats next. 2574 // Test floats next.
2575 if (!inside) 2575 if (!inside)
2576 inside = nodeAtPoint(request, result, locationInContainer, accumulat edOffset, HitTestFloat); 2576 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, HitTestFloat);
2577 2577
2578 // Finally test to see if the mouse is in the background (within a child block's background). 2578 // Finally test to see if the mouse is in the background (within a child block's background).
2579 if (!inside) 2579 if (!inside)
2580 inside = nodeAtPoint(request, result, locationInContainer, accumulat edOffset, HitTestChildBlockBackgrounds); 2580 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, HitTestChildBlockBackgrounds);
2581 } 2581 }
2582 2582
2583 // See if the mouse is inside us but not any of our descendants 2583 // See if the mouse is inside us but not any of our descendants
2584 if (hitTestFilter != HitTestDescendants && !inside) 2584 if (hitTestFilter != HitTestDescendants && !inside)
2585 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf fset, HitTestBlockBackground); 2585 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, Hit TestBlockBackground);
2586 2586
2587 return inside; 2587 return inside;
2588 } 2588 }
2589 2589
2590 void LayoutObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 2590 void LayoutObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
2591 { 2591 {
2592 if (result.innerNode()) 2592 if (result.innerNode())
2593 return; 2593 return;
2594 2594
2595 Node* node = this->node(); 2595 Node* node = this->node();
2596 2596
2597 // If we hit the anonymous renderers inside generated content we should 2597 // If we hit the anonymous renderers inside generated content we should
2598 // actually hit the generated content so walk up to the PseudoElement. 2598 // actually hit the generated content so walk up to the PseudoElement.
2599 if (!node && parent() && parent()->isBeforeOrAfterContent()) { 2599 if (!node && parent() && parent()->isBeforeOrAfterContent()) {
2600 for (LayoutObject* renderer = parent(); renderer && !node; renderer = re nderer->parent()) 2600 for (LayoutObject* renderer = parent(); renderer && !node; renderer = re nderer->parent())
2601 node = renderer->node(); 2601 node = renderer->node();
2602 } 2602 }
2603 2603
2604 if (node) { 2604 if (node) {
2605 result.setInnerNode(node); 2605 result.setInnerNode(node);
2606 if (!result.innerNonSharedNode()) 2606 if (!result.innerNonSharedNode())
2607 result.setInnerNonSharedNode(node); 2607 result.setInnerNonSharedNode(node);
2608 result.setLocalPoint(point); 2608 result.setLocalPoint(point);
2609 } 2609 }
2610 } 2610 }
2611 2611
2612 bool LayoutObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitT estLocation& /*locationInContainer*/, const LayoutPoint& /*accumulatedOffset*/, HitTestAction) 2612 bool LayoutObject::nodeAtPoint(HitTestResult&, const HitTestLocation& /*location InContainer*/, const LayoutPoint& /*accumulatedOffset*/, HitTestAction)
2613 { 2613 {
2614 return false; 2614 return false;
2615 } 2615 }
2616 2616
2617 void LayoutObject::scheduleRelayout() 2617 void LayoutObject::scheduleRelayout()
2618 { 2618 {
2619 if (isLayoutView()) { 2619 if (isLayoutView()) {
2620 FrameView* view = toLayoutView(this)->frameView(); 2620 FrameView* view = toLayoutView(this)->frameView();
2621 if (view) 2621 if (view)
2622 view->scheduleRelayout(); 2622 view->scheduleRelayout();
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3072 static const AffineTransform identity; 3072 static const AffineTransform identity;
3073 return identity; 3073 return identity;
3074 } 3074 }
3075 3075
3076 const AffineTransform& LayoutObject::localToParentTransform() const 3076 const AffineTransform& LayoutObject::localToParentTransform() const
3077 { 3077 {
3078 static const AffineTransform identity; 3078 static const AffineTransform identity;
3079 return identity; 3079 return identity;
3080 } 3080 }
3081 3081
3082 bool LayoutObject::nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint&, HitTestAction) 3082 bool LayoutObject::nodeAtFloatPoint(HitTestResult&, const FloatPoint&, HitTestAc tion)
3083 { 3083 {
3084 ASSERT_NOT_REACHED(); 3084 ASSERT_NOT_REACHED();
3085 return false; 3085 return false;
3086 } 3086 }
3087 3087
3088 bool LayoutObject::isRelayoutBoundaryForInspector() const 3088 bool LayoutObject::isRelayoutBoundaryForInspector() const
3089 { 3089 {
3090 return objectIsRelayoutBoundary(this); 3090 return objectIsRelayoutBoundary(this);
3091 } 3091 }
3092 3092
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 { 3226 {
3227 if (object1) { 3227 if (object1) {
3228 const blink::LayoutObject* root = object1; 3228 const blink::LayoutObject* root = object1;
3229 while (root->parent()) 3229 while (root->parent())
3230 root = root->parent(); 3230 root = root->parent();
3231 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3231 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3232 } 3232 }
3233 } 3233 }
3234 3234
3235 #endif 3235 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698