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

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 875563003: Ensure that positioned objects' list is always in parent first order (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: WIP (just idea): redesign positioned objects handling 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) 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 while (cb && (cb->style()->position() == StaticPosition || (cb->isIn line() && !cb->isReplaced())) && !cb->isRenderView()) { 312 while (cb && (cb->style()->position() == StaticPosition || (cb->isIn line() && !cb->isReplaced())) && !cb->isRenderView()) {
313 if (cb->style()->position() == RelativePosition && cb->isInline( ) && !cb->isReplaced()) { 313 if (cb->style()->position() == RelativePosition && cb->isInline( ) && !cb->isReplaced()) {
314 cb = cb->containingBlock(); 314 cb = cb->containingBlock();
315 break; 315 break;
316 } 316 }
317 cb = cb->parent(); 317 cb = cb->parent();
318 } 318 }
319 319
320 if (cb->isRenderBlock()) 320 if (cb->isRenderBlock())
321 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl ock); 321 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl ock);
322 } else if (oldStyle->position() != newStyle.position()) {
323 for (RenderObject* curr = parent(); curr; curr = curr->parent()) {
324 if (curr->isRenderBlock())
325 toRenderBlock(curr)->removePositionedObjects(this, NewContai ningBlock);
326 }
322 } 327 }
323 } 328 }
324 329
325 RenderBox::styleWillChange(diff, newStyle); 330 RenderBox::styleWillChange(diff, newStyle);
326 } 331 }
327 332
328 static bool borderOrPaddingLogicalWidthChanged(const RenderStyle* oldStyle, cons t RenderStyle* newStyle) 333 static bool borderOrPaddingLogicalWidthChanged(const RenderStyle* oldStyle, cons t RenderStyle* newStyle)
329 { 334 {
330 if (newStyle->isHorizontalWritingMode()) 335 if (newStyle->isHorizontalWritingMode())
331 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() 336 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth()
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 if (!descendantsMap) { 1937 if (!descendantsMap) {
1933 descendantsMap = new TrackedDescendantsMap; 1938 descendantsMap = new TrackedDescendantsMap;
1934 containerMap = new TrackedContainerMap; 1939 containerMap = new TrackedContainerMap;
1935 } 1940 }
1936 1941
1937 TrackedRendererListHashSet* descendantSet = descendantsMap->get(this); 1942 TrackedRendererListHashSet* descendantSet = descendantsMap->get(this);
1938 if (!descendantSet) { 1943 if (!descendantSet) {
1939 descendantSet = new TrackedRendererListHashSet; 1944 descendantSet = new TrackedRendererListHashSet;
1940 descendantsMap->set(this, adoptPtr(descendantSet)); 1945 descendantsMap->set(this, adoptPtr(descendantSet));
1941 } 1946 }
1942 bool added = descendantSet->add(descendant).isNewEntry; 1947
1943 if (!added) { 1948 if (descendantSet->contains(descendant)) {
1944 ASSERT(containerMap->get(descendant)); 1949 ASSERT(containerMap->get(descendant));
1945 ASSERT(containerMap->get(descendant)->contains(this)); 1950 ASSERT(containerMap->get(descendant)->contains(this));
1946 return; 1951 return;
1947 } 1952 }
1953 descendantSet->add(descendant);
1948 1954
1949 HashSet<RenderBlock*>* containerSet = containerMap->get(descendant); 1955 HashSet<RenderBlock*>* containerSet = containerMap->get(descendant);
1950 if (!containerSet) { 1956 if (!containerSet) {
1951 containerSet = new HashSet<RenderBlock*>; 1957 containerSet = new HashSet<RenderBlock*>;
1952 containerMap->set(descendant, adoptPtr(containerSet)); 1958 containerMap->set(descendant, adoptPtr(containerSet));
1953 } 1959 }
1954 ASSERT(!containerSet->contains(this)); 1960 ASSERT(!containerSet->contains(this));
1955 containerSet->add(this); 1961 containerSet->add(this);
1956 } 1962 }
1957 1963
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
3941 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const 3947 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const
3942 { 3948 {
3943 showRenderObject(); 3949 showRenderObject();
3944 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 3950 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
3945 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 3951 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
3946 } 3952 }
3947 3953
3948 #endif 3954 #endif
3949 3955
3950 } // namespace blink 3956 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698