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

Side by Side Diff: Source/core/layout/LayoutBlockFlow.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 if (shapeLogicalBottom < floatLogicalBottom) 2638 if (shapeLogicalBottom < floatLogicalBottom)
2639 floatLogicalBottom = shapeLogicalBottom; 2639 floatLogicalBottom = shapeLogicalBottom;
2640 } 2640 }
2641 if (floatLogicalBottom > logicalHeight) 2641 if (floatLogicalBottom > logicalHeight)
2642 logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logical Bottom) : floatLogicalBottom; 2642 logicalBottom = logicalBottom ? std::min(floatLogicalBottom, logical Bottom) : floatLogicalBottom;
2643 } 2643 }
2644 2644
2645 return logicalBottom; 2645 return logicalBottom;
2646 } 2646 }
2647 2647
2648 bool LayoutBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult & result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul atedOffset) 2648 bool LayoutBlockFlow::hitTestFloats(HitTestResult& result, const HitTestLocation & locationInContainer, const LayoutPoint& accumulatedOffset)
2649 { 2649 {
2650 if (!m_floatingObjects) 2650 if (!m_floatingObjects)
2651 return false; 2651 return false;
2652 2652
2653 LayoutPoint adjustedLocation = accumulatedOffset; 2653 LayoutPoint adjustedLocation = accumulatedOffset;
2654 if (isLayoutView()) { 2654 if (isLayoutView()) {
2655 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo uble(); 2655 DoublePoint position = toLayoutView(this)->frameView()->scrollPositionDo uble();
2656 adjustedLocation.move(position.x(), position.y()); 2656 adjustedLocation.move(position.x(), position.y());
2657 } 2657 }
2658 2658
2659 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2659 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set();
2660 FloatingObjectSetIterator begin = floatingObjectSet.begin(); 2660 FloatingObjectSetIterator begin = floatingObjectSet.begin();
2661 for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { 2661 for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) {
2662 --it; 2662 --it;
2663 FloatingObject* floatingObject = it->get(); 2663 FloatingObject* floatingObject = it->get();
2664 if (floatingObject->shouldPaint() && !floatingObject->layoutObject()->ha sSelfPaintingLayer()) { 2664 if (floatingObject->shouldPaint() && !floatingObject->layoutObject()->ha sSelfPaintingLayer()) {
2665 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject ) - floatingObject->layoutObject()->location().x(); 2665 LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject ) - floatingObject->layoutObject()->location().x();
2666 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject ) - floatingObject->layoutObject()->location().y(); 2666 LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject ) - floatingObject->layoutObject()->location().y();
2667 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj ect, adjustedLocation + LayoutSize(xOffset, yOffset)); 2667 LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObj ect, adjustedLocation + LayoutSize(xOffset, yOffset));
2668 if (floatingObject->layoutObject()->hitTest(request, result, locatio nInContainer, childPoint)) { 2668 if (floatingObject->layoutObject()->hitTest(result, locationInContai ner, childPoint)) {
2669 updateHitTestResult(result, locationInContainer.point() - toLayo utSize(childPoint)); 2669 updateHitTestResult(result, locationInContainer.point() - toLayo utSize(childPoint));
2670 return true; 2670 return true;
2671 } 2671 }
2672 } 2672 }
2673 } 2673 }
2674 2674
2675 return false; 2675 return false;
2676 } 2676 }
2677 2677
2678 LayoutUnit LayoutBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const 2678 LayoutUnit LayoutBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 } 3155 }
3156 if (isAnonymous()) 3156 if (isAnonymous())
3157 return "LayoutBlockFlow (anonymous)"; 3157 return "LayoutBlockFlow (anonymous)";
3158 if (isRelPositioned()) 3158 if (isRelPositioned())
3159 return "LayoutBlockFlow (relative positioned)"; 3159 return "LayoutBlockFlow (relative positioned)";
3160 return "LayoutBlockFlow"; 3160 return "LayoutBlockFlow";
3161 } 3161 }
3162 3162
3163 3163
3164 } // namespace blink 3164 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698