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

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: Updating as per review comments Created 5 years, 8 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 2550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 CompositingState LayoutObject::compositingState() const 2561 CompositingState LayoutObject::compositingState() const
2562 { 2562 {
2563 return hasLayer() ? toLayoutBoxModelObject(this)->layer()->compositingState( ) : NotComposited; 2563 return hasLayer() ? toLayoutBoxModelObject(this)->layer()->compositingState( ) : NotComposited;
2564 } 2564 }
2565 2565
2566 CompositingReasons LayoutObject::additionalCompositingReasons() const 2566 CompositingReasons LayoutObject::additionalCompositingReasons() const
2567 { 2567 {
2568 return CompositingReasonNone; 2568 return CompositingReasonNone;
2569 } 2569 }
2570 2570
2571 bool LayoutObject::hitTest(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse t, HitTestFilter hitTestFilter) 2571 bool LayoutObject::hitTest(HitTestResult& result, const HitTestLocation& locatio nInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter hitTestFilter)
2572 { 2572 {
2573 bool inside = false; 2573 bool inside = false;
2574 if (hitTestFilter != HitTestSelf) { 2574 if (hitTestFilter != HitTestSelf) {
2575 // First test the foreground layer (lines and inlines). 2575 // First test the foreground layer (lines and inlines).
2576 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf fset, HitTestForeground); 2576 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, Hit TestForeground);
2577 2577
2578 // Test floats next. 2578 // Test floats next.
2579 if (!inside) 2579 if (!inside)
2580 inside = nodeAtPoint(request, result, locationInContainer, accumulat edOffset, HitTestFloat); 2580 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, HitTestFloat);
2581 2581
2582 // Finally test to see if the mouse is in the background (within a child block's background). 2582 // Finally test to see if the mouse is in the background (within a child block's background).
2583 if (!inside) 2583 if (!inside)
2584 inside = nodeAtPoint(request, result, locationInContainer, accumulat edOffset, HitTestChildBlockBackgrounds); 2584 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, HitTestChildBlockBackgrounds);
2585 } 2585 }
2586 2586
2587 // See if the mouse is inside us but not any of our descendants 2587 // See if the mouse is inside us but not any of our descendants
2588 if (hitTestFilter != HitTestDescendants && !inside) 2588 if (hitTestFilter != HitTestDescendants && !inside)
2589 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf fset, HitTestBlockBackground); 2589 inside = nodeAtPoint(result, locationInContainer, accumulatedOffset, Hit TestBlockBackground);
2590 2590
2591 return inside; 2591 return inside;
2592 } 2592 }
2593 2593
2594 void LayoutObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point) 2594 void LayoutObject::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
2595 { 2595 {
2596 if (result.innerNode()) 2596 if (result.innerNode())
2597 return; 2597 return;
2598 2598
2599 Node* node = this->node(); 2599 Node* node = this->node();
2600 2600
2601 // If we hit the anonymous renderers inside generated content we should 2601 // If we hit the anonymous renderers inside generated content we should
2602 // actually hit the generated content so walk up to the PseudoElement. 2602 // actually hit the generated content so walk up to the PseudoElement.
2603 if (!node && parent() && parent()->isBeforeOrAfterContent()) { 2603 if (!node && parent() && parent()->isBeforeOrAfterContent()) {
2604 for (LayoutObject* renderer = parent(); renderer && !node; renderer = re nderer->parent()) 2604 for (LayoutObject* renderer = parent(); renderer && !node; renderer = re nderer->parent())
2605 node = renderer->node(); 2605 node = renderer->node();
2606 } 2606 }
2607 2607
2608 if (node) { 2608 if (node) {
2609 result.setInnerNode(node); 2609 result.setInnerNode(node);
2610 if (!result.innerNonSharedNode()) 2610 if (!result.innerNonSharedNode())
2611 result.setInnerNonSharedNode(node); 2611 result.setInnerNonSharedNode(node);
2612 result.setLocalPoint(point); 2612 result.setLocalPoint(point);
2613 } 2613 }
2614 } 2614 }
2615 2615
2616 bool LayoutObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitT estLocation& /*locationInContainer*/, const LayoutPoint& /*accumulatedOffset*/, HitTestAction) 2616 bool LayoutObject::nodeAtPoint(HitTestResult&, const HitTestLocation& /*location InContainer*/, const LayoutPoint& /*accumulatedOffset*/, HitTestAction)
2617 { 2617 {
2618 return false; 2618 return false;
2619 } 2619 }
2620 2620
2621 void LayoutObject::scheduleRelayout() 2621 void LayoutObject::scheduleRelayout()
2622 { 2622 {
2623 if (isLayoutView()) { 2623 if (isLayoutView()) {
2624 FrameView* view = toLayoutView(this)->frameView(); 2624 FrameView* view = toLayoutView(this)->frameView();
2625 if (view) 2625 if (view)
2626 view->scheduleRelayout(); 2626 view->scheduleRelayout();
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 static const AffineTransform identity; 3076 static const AffineTransform identity;
3077 return identity; 3077 return identity;
3078 } 3078 }
3079 3079
3080 const AffineTransform& LayoutObject::localToParentTransform() const 3080 const AffineTransform& LayoutObject::localToParentTransform() const
3081 { 3081 {
3082 static const AffineTransform identity; 3082 static const AffineTransform identity;
3083 return identity; 3083 return identity;
3084 } 3084 }
3085 3085
3086 bool LayoutObject::nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint&, HitTestAction) 3086 bool LayoutObject::nodeAtFloatPoint(HitTestResult&, const FloatPoint&, HitTestAc tion)
3087 { 3087 {
3088 ASSERT_NOT_REACHED(); 3088 ASSERT_NOT_REACHED();
3089 return false; 3089 return false;
3090 } 3090 }
3091 3091
3092 bool LayoutObject::isRelayoutBoundaryForInspector() const 3092 bool LayoutObject::isRelayoutBoundaryForInspector() const
3093 { 3093 {
3094 return objectIsRelayoutBoundary(this); 3094 return objectIsRelayoutBoundary(this);
3095 } 3095 }
3096 3096
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 { 3230 {
3231 if (object1) { 3231 if (object1) {
3232 const blink::LayoutObject* root = object1; 3232 const blink::LayoutObject* root = object1;
3233 while (root->parent()) 3233 while (root->parent())
3234 root = root->parent(); 3234 root = root->parent();
3235 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3235 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3236 } 3236 }
3237 } 3237 }
3238 3238
3239 #endif 3239 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698