OLD | NEW |
---|---|
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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 updateHitTestResult(result, adjustedLocation.point()); | 929 updateHitTestResult(result, adjustedLocation.point()); |
930 if (result.addNodeToListBasedTestResult(node(), adjustedLocation, | 930 if (result.addNodeToListBasedTestResult(node(), adjustedLocation, |
931 regionResult) == StopHitTesting) | 931 regionResult) == StopHitTesting) |
932 return true; | 932 return true; |
933 } | 933 } |
934 return false; | 934 return false; |
935 } | 935 } |
936 | 936 |
937 PositionWithAffinity LayoutInline::positionForPoint(const LayoutPoint& point) { | 937 PositionWithAffinity LayoutInline::positionForPoint(const LayoutPoint& point) { |
938 // FIXME: Does not deal with relative positioned inlines (should it?) | 938 // FIXME: Does not deal with relative positioned inlines (should it?) |
939 LayoutBlock* cb = containingBlock(); | 939 |
940 // If there are continuations, test them first because our containing block | |
941 // will not check them. | |
942 LayoutBoxModelObject* continuation = this->continuation(); | |
943 while (continuation) { | |
944 if (continuation->isInline() || continuation->slowFirstChild()) | |
945 return continuation->positionForPoint(point); | |
946 continuation = toLayoutBlockFlow(continuation)->inlineElementContinuation(); | |
947 } | |
948 | |
940 if (firstLineBoxIncludingCulling()) { | 949 if (firstLineBoxIncludingCulling()) { |
941 // This inline actually has a line box. We must have clicked in the border/ padding of one of these boxes. We | 950 // This inline actually has a line box. We must have clicked in the border/ padding of one of these boxes. We |
942 // should try to find a result by asking our containing block. | 951 // should try to find a result by asking our containing block. |
943 return cb->positionForPoint(point); | 952 return containingBlock()->positionForPoint(point); |
944 } | |
945 | |
946 // Translate the coords from the pre-anonymous block to the post-anonymous blo ck. | |
pdr.
2016/10/06 04:52:32
This code was added in 2007 in https://chromium.go
| |
947 LayoutPoint parentBlockPoint = cb->location() + point; | |
948 LayoutBoxModelObject* c = continuation(); | |
949 while (c) { | |
950 LayoutBox* contBlock = | |
951 c->isInline() ? c->containingBlock() : toLayoutBlock(c); | |
952 if (c->isInline() || c->slowFirstChild()) | |
953 return c->positionForPoint(parentBlockPoint - | |
954 contBlock->locationOffset()); | |
955 c = toLayoutBlockFlow(c)->inlineElementContinuation(); | |
956 } | 953 } |
957 | 954 |
958 return LayoutBoxModelObject::positionForPoint(point); | 955 return LayoutBoxModelObject::positionForPoint(point); |
959 } | 956 } |
960 | 957 |
961 namespace { | 958 namespace { |
962 | 959 |
963 class LinesBoundingBoxGeneratorContext { | 960 class LinesBoundingBoxGeneratorContext { |
964 public: | 961 public: |
965 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) {} | 962 LinesBoundingBoxGeneratorContext(FloatRect& rect) : m_rect(rect) {} |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1519 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); | 1516 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); |
1520 } | 1517 } |
1521 | 1518 |
1522 // TODO(lunalu): Not to just dump 0, 0 as the x and y here | 1519 // TODO(lunalu): Not to just dump 0, 0 as the x and y here |
1523 LayoutRect LayoutInline::debugRect() const { | 1520 LayoutRect LayoutInline::debugRect() const { |
1524 IntRect linesBox = enclosingIntRect(linesBoundingBox()); | 1521 IntRect linesBox = enclosingIntRect(linesBoundingBox()); |
1525 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); | 1522 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); |
1526 } | 1523 } |
1527 | 1524 |
1528 } // namespace blink | 1525 } // namespace blink |
OLD | NEW |