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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 1956033002: Move hit testing of lines and floats to LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 updateHitTestResult(result, locationInContainer.point() - localOffset); 1513 updateHitTestResult(result, locationInContainer.point() - localOffset);
1514 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet . 1514 // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet .
1515 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont ainer) == StopHitTesting) 1515 if (result.addNodeToListBasedTestResult(nodeForHitTest(), locationInCont ainer) == StopHitTesting)
1516 return true; 1516 return true;
1517 } 1517 }
1518 return LayoutBox::nodeAtPoint(result, locationInContainer, accumulatedOffset , hitTestAction); 1518 return LayoutBox::nodeAtPoint(result, locationInContainer, accumulatedOffset , hitTestAction);
1519 } 1519 }
1520 1520
1521 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest Action) 1521 bool LayoutBlock::hitTestChildren(HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTest Action)
1522 { 1522 {
1523 // TODO(pdr): We should also check for css clip in the !isSelfPaintingLayer 1523 ASSERT(!childrenInline());
1524 // case, similar to overflow clip below.
1525 if (hasOverflowClip() && !hasSelfPaintingLayer()) {
1526 if (!locationInContainer.intersects(overflowClipRect(accumulatedOffset, ExcludeOverlayScrollbarSizeForHitTesting)))
1527 return false;
1528 if (style()->hasBorderRadius()) {
1529 LayoutRect borderRect = borderBoxRect();
1530 borderRect.moveBy(accumulatedOffset);
1531 if (!locationInContainer.intersects(style()->getRoundedInnerBorderFo r(borderRect)))
1532 return false;
1533 }
1534 }
1535
1536 // A control clip can also clip out child hit testing.
1537 if (hasControlClip() && !locationInContainer.intersects(controlClipRect(accu mulatedOffset)))
1538 return false;
1539
1540 LayoutPoint scrolledOffset(hasOverflowClip() ? accumulatedOffset - scrolledC ontentOffset() : accumulatedOffset); 1524 LayoutPoint scrolledOffset(hasOverflowClip() ? accumulatedOffset - scrolledC ontentOffset() : accumulatedOffset);
1541 if (childrenInline() && !isTable()) { 1525 HitTestAction childHitTest = hitTestAction;
1542 if (m_lineBoxes.hitTest(LineLayoutBoxModel(this), result, locationInCont ainer, scrolledOffset, hitTestAction)) { 1526 if (hitTestAction == HitTestChildBlockBackgrounds)
1527 childHitTest = HitTestChildBlockBackground;
1528 for (LayoutBox* child = lastChildBox(); child; child = child->previousSiblin gBox()) {
1529 LayoutPoint childPoint = flipForWritingModeForChild(child, scrolledOffse t);
1530 if (!child->hasSelfPaintingLayer() && !child->isFloating() && !child->is ColumnSpanAll() && child->nodeAtPoint(result, locationInContainer, childPoint, c hildHitTest)) {
1543 updateHitTestResult(result, flipForWritingMode(toLayoutPoint(locatio nInContainer.point() - accumulatedOffset))); 1531 updateHitTestResult(result, flipForWritingMode(toLayoutPoint(locatio nInContainer.point() - accumulatedOffset)));
1544 return true; 1532 return true;
1545 } 1533 }
1546 } else {
1547 HitTestAction childHitTest = hitTestAction;
1548 if (hitTestAction == HitTestChildBlockBackgrounds)
1549 childHitTest = HitTestChildBlockBackground;
1550 for (LayoutBox* child = lastChildBox(); child; child = child->previousSi blingBox()) {
1551 LayoutPoint childPoint = flipForWritingModeForChild(child, scrolledO ffset);
1552 if (!child->hasSelfPaintingLayer() && !child->isFloating() && !child ->isColumnSpanAll() && child->nodeAtPoint(result, locationInContainer, childPoin t, childHitTest)) {
1553 updateHitTestResult(result, flipForWritingMode(toLayoutPoint(loc ationInContainer.point() - accumulatedOffset)));
1554 return true;
1555 }
1556 }
1557 } 1534 }
1558 1535
1559 if (hitTestAction == HitTestFloat && hitTestFloats(result, locationInContain er, scrolledOffset))
1560 return true;
1561
1562 return false; 1536 return false;
1563 } 1537 }
1564 1538
1565 Position LayoutBlock::positionForBox(InlineBox *box, bool start) const 1539 Position LayoutBlock::positionForBox(InlineBox *box, bool start) const
1566 { 1540 {
1567 if (!box) 1541 if (!box)
1568 return Position(); 1542 return Position();
1569 1543
1570 if (!box->getLineLayoutItem().nonPseudoNode()) 1544 if (!box->getLineLayoutItem().nonPseudoNode())
1571 return Position::editingPositionOf(nonPseudoNode(), start ? caretMinOffs et() : caretMaxOffset()); 1545 return Position::editingPositionOf(nonPseudoNode(), start ? caretMinOffs et() : caretMaxOffset());
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2567 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) { 2541 for (TrackedLayoutBoxListHashSet::const_iterator it = positionedDescenda ntSet->begin(); it != end; ++it) {
2568 LayoutBox* currBox = *it; 2542 LayoutBox* currBox = *it;
2569 ASSERT(!currBox->needsLayout()); 2543 ASSERT(!currBox->needsLayout());
2570 } 2544 }
2571 } 2545 }
2572 } 2546 }
2573 2547
2574 #endif 2548 #endif
2575 2549
2576 } // namespace blink 2550 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlockFlow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698