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 * (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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1932 if (!descendantsMap) { | 1932 if (!descendantsMap) { |
1933 descendantsMap = new TrackedDescendantsMap; | 1933 descendantsMap = new TrackedDescendantsMap; |
1934 containerMap = new TrackedContainerMap; | 1934 containerMap = new TrackedContainerMap; |
1935 } | 1935 } |
1936 | 1936 |
1937 TrackedRendererListHashSet* descendantSet = descendantsMap->get(this); | 1937 TrackedRendererListHashSet* descendantSet = descendantsMap->get(this); |
1938 if (!descendantSet) { | 1938 if (!descendantSet) { |
1939 descendantSet = new TrackedRendererListHashSet; | 1939 descendantSet = new TrackedRendererListHashSet; |
1940 descendantsMap->set(this, adoptPtr(descendantSet)); | 1940 descendantsMap->set(this, adoptPtr(descendantSet)); |
1941 } | 1941 } |
1942 bool added = descendantSet->add(descendant).isNewEntry; | 1942 |
1943 if (!added) { | 1943 if (descendantSet->contains(descendant)) { |
1944 ASSERT(containerMap->get(descendant)); | 1944 ASSERT(containerMap->get(descendant)); |
1945 ASSERT(containerMap->get(descendant)->contains(this)); | 1945 ASSERT(containerMap->get(descendant)->contains(this)); |
1946 return; | 1946 return; |
1947 } | 1947 } |
1948 | 1948 |
1949 // Try to insert parent before child, as layoutPositionedObjects relies on ' parent first' ordering. | |
1950 bool didInsertDescendant = false; | |
1951 if (descendant->isRenderBlock()) { | |
1952 TrackedRendererListHashSet::iterator end = descendantSet->end(); | |
1953 for (TrackedRendererListHashSet::iterator it = descendantSet->begin(); i t != end; ++it) { | |
1954 RenderBox* box = *it; | |
1955 if (box->isDescendantOf(descendant)) { | |
Julien - ping for review
2015/01/27 14:47:46
This check is expensive as it involves walking the
alexanderk
2015/01/28 14:15:27
Right, isDescendantOf() is expensive.
And optimiza
| |
1956 didInsertDescendant = descendantSet->insertBefore(box, descendan t).isNewEntry; | |
1957 break; | |
1958 } | |
1959 } | |
1960 } | |
1961 if (!didInsertDescendant) | |
1962 descendantSet->add(descendant); | |
Julien - ping for review
2015/01/27 14:47:46
I think descendantSet->insertBefore() should be ab
alexanderk
2015/01/28 14:15:27
Unfortunately insertBefore() does not move already
| |
1963 | |
1949 HashSet<RenderBlock*>* containerSet = containerMap->get(descendant); | 1964 HashSet<RenderBlock*>* containerSet = containerMap->get(descendant); |
1950 if (!containerSet) { | 1965 if (!containerSet) { |
1951 containerSet = new HashSet<RenderBlock*>; | 1966 containerSet = new HashSet<RenderBlock*>; |
1952 containerMap->set(descendant, adoptPtr(containerSet)); | 1967 containerMap->set(descendant, adoptPtr(containerSet)); |
1953 } | 1968 } |
1954 ASSERT(!containerSet->contains(this)); | 1969 ASSERT(!containerSet->contains(this)); |
1955 containerSet->add(this); | 1970 containerSet->add(this); |
1956 } | 1971 } |
1957 | 1972 |
1958 void RenderBlock::removeFromTrackedRendererMaps(RenderBox* descendant, TrackedDe scendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) | 1973 void RenderBlock::removeFromTrackedRendererMaps(RenderBox* descendant, TrackedDe scendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3941 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 3956 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
3942 { | 3957 { |
3943 showRenderObject(); | 3958 showRenderObject(); |
3944 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 3959 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
3945 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 3960 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
3946 } | 3961 } |
3947 | 3962 |
3948 #endif | 3963 #endif |
3949 | 3964 |
3950 } // namespace blink | 3965 } // namespace blink |
OLD | NEW |