summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/InlineFlowBox.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:48 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-29 12:18:57 +0100
commit4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064 (patch)
treebed2fe914fe0f7ec70abfb47d2d84af8a3604d09 /Source/WebCore/rendering/InlineFlowBox.cpp
parent01485457c9a5da3f1121015afd25bb53af77662e (diff)
downloadqtwebkit-4c01d0526ba4dd8cff0c0ff22a6f0ab5eb973064.tar.gz
Imported WebKit commit c60cfe0fc09efd257aa0111d7b133b02deb8a63e (http://svn.webkit.org/repository/webkit/trunk@136119)
New snapshot that includes the fix for installing the QtWebProcess into libexec Change-Id: I01344e079cbdac5678c4cba6ffcc05f4597cf0d7 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebCore/rendering/InlineFlowBox.cpp')
-rw-r--r--Source/WebCore/rendering/InlineFlowBox.cpp37
1 files changed, 33 insertions, 4 deletions
diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp
index 36aaf95ec..f2eed4b95 100644
--- a/Source/WebCore/rendering/InlineFlowBox.cpp
+++ b/Source/WebCore/rendering/InlineFlowBox.cpp
@@ -48,7 +48,7 @@ namespace WebCore {
struct SameSizeAsInlineFlowBox : public InlineBox {
void* pointers[5];
- uint32_t bitfields : 24;
+ uint32_t bitfields : 23;
};
COMPILE_ASSERT(sizeof(InlineFlowBox) == sizeof(SameSizeAsInlineFlowBox), InlineFlowBox_should_stay_small);
@@ -981,12 +981,41 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re
return false;
// Check children first.
+ // We need to account for culled inline parents of the hit-tested nodes, so that they may also get included in area-based hit-tests.
+ RenderObject* culledParent = 0;
for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) {
- if ((curr->renderer()->isText() || !curr->boxModelObject()->hasSelfPaintingLayer()) && curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
- renderer()->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
- return true;
+ if (curr->renderer()->isText() || !curr->boxModelObject()->hasSelfPaintingLayer()) {
+ RenderObject* newParent = 0;
+ // Culled parents are only relevant for area-based hit-tests, so ignore it in point-based ones.
+ if (locationInContainer.isRectBasedTest()) {
+ newParent = curr->renderer()->parent();
+ if (newParent == renderer())
+ newParent = 0;
+ }
+ // Check the culled parent after all its children have been checked, to do this we wait until
+ // we are about to test an element with a different parent.
+ if (newParent != culledParent) {
+ if (!newParent || !newParent->isDescendantOf(culledParent)) {
+ while (culledParent && culledParent != renderer() && culledParent != newParent) {
+ if (culledParent->isRenderInline() && toRenderInline(culledParent)->hitTestCulledInline(request, result, locationInContainer, accumulatedOffset))
+ return true;
+ culledParent = culledParent->parent();
+ }
+ }
+ culledParent = newParent;
+ }
+ if (curr->nodeAtPoint(request, result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
+ renderer()->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
+ return true;
+ }
}
}
+ // Check any culled ancestor of the final children tested.
+ while (culledParent && culledParent != renderer()) {
+ if (culledParent->isRenderInline() && toRenderInline(culledParent)->hitTestCulledInline(request, result, locationInContainer, accumulatedOffset))
+ return true;
+ culledParent = culledParent->parent();
+ }
// Now check ourselves. Pixel snap hit testing.
LayoutRect frameRect = roundedFrameRect();