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

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

Issue 143323014: *** DO NOT LAND *** Attempt to understand Regions complexity Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderRegion.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/html/HTMLTableElement.h" 42 #include "core/html/HTMLTableElement.h"
43 #include "core/page/AutoscrollController.h" 43 #include "core/page/AutoscrollController.h"
44 #include "core/page/EventHandler.h" 44 #include "core/page/EventHandler.h"
45 #include "core/frame/Frame.h" 45 #include "core/frame/Frame.h"
46 #include "core/frame/FrameView.h" 46 #include "core/frame/FrameView.h"
47 #include "core/page/Page.h" 47 #include "core/page/Page.h"
48 #include "core/frame/Settings.h" 48 #include "core/frame/Settings.h"
49 #include "core/frame/UseCounter.h" 49 #include "core/frame/UseCounter.h"
50 #include "core/frame/animation/AnimationController.h" 50 #include "core/frame/animation/AnimationController.h"
51 #include "core/rendering/CompositedLayerMapping.h" 51 #include "core/rendering/CompositedLayerMapping.h"
52 #include "core/rendering/FlowThreadController.h"
53 #include "core/rendering/HitTestResult.h" 52 #include "core/rendering/HitTestResult.h"
54 #include "core/rendering/LayoutRectRecorder.h" 53 #include "core/rendering/LayoutRectRecorder.h"
55 #include "core/rendering/RenderCounter.h" 54 #include "core/rendering/RenderCounter.h"
56 #include "core/rendering/RenderDeprecatedFlexibleBox.h" 55 #include "core/rendering/RenderDeprecatedFlexibleBox.h"
57 #include "core/rendering/RenderFlexibleBox.h" 56 #include "core/rendering/RenderFlexibleBox.h"
58 #include "core/rendering/RenderGeometryMap.h" 57 #include "core/rendering/RenderGeometryMap.h"
59 #include "core/rendering/RenderGrid.h" 58 #include "core/rendering/RenderGrid.h"
60 #include "core/rendering/RenderImage.h" 59 #include "core/rendering/RenderImage.h"
61 #include "core/rendering/RenderImageResourceStyleImage.h" 60 #include "core/rendering/RenderImageResourceStyleImage.h"
62 #include "core/rendering/RenderInline.h" 61 #include "core/rendering/RenderInline.h"
63 #include "core/rendering/RenderLayer.h" 62 #include "core/rendering/RenderLayer.h"
64 #include "core/rendering/RenderLayerCompositor.h" 63 #include "core/rendering/RenderLayerCompositor.h"
65 #include "core/rendering/RenderListItem.h" 64 #include "core/rendering/RenderListItem.h"
66 #include "core/rendering/RenderMarquee.h" 65 #include "core/rendering/RenderMarquee.h"
67 #include "core/rendering/RenderMultiColumnBlock.h"
68 #include "core/rendering/RenderNamedFlowThread.h"
69 #include "core/rendering/RenderRegion.h"
70 #include "core/rendering/RenderRuby.h" 66 #include "core/rendering/RenderRuby.h"
71 #include "core/rendering/RenderRubyText.h" 67 #include "core/rendering/RenderRubyText.h"
72 #include "core/rendering/RenderScrollbarPart.h" 68 #include "core/rendering/RenderScrollbarPart.h"
73 #include "core/rendering/RenderTableCaption.h" 69 #include "core/rendering/RenderTableCaption.h"
74 #include "core/rendering/RenderTableCell.h" 70 #include "core/rendering/RenderTableCell.h"
75 #include "core/rendering/RenderTableCol.h" 71 #include "core/rendering/RenderTableCol.h"
76 #include "core/rendering/RenderTableRow.h" 72 #include "core/rendering/RenderTableRow.h"
77 #include "core/rendering/RenderTextControlPlaceholder.h" 73 #include "core/rendering/RenderTextControlPlaceholder.h"
78 #include "core/rendering/RenderTheme.h" 74 #include "core/rendering/RenderTheme.h"
79 #include "core/rendering/RenderView.h" 75 #include "core/rendering/RenderView.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 130 }
135 131
136 void RenderObject::operator delete(void* ptr) 132 void RenderObject::operator delete(void* ptr)
137 { 133 {
138 ASSERT(isMainThread()); 134 ASSERT(isMainThread());
139 partitionFree(ptr); 135 partitionFree(ptr);
140 } 136 }
141 137
142 RenderObject* RenderObject::createObject(Element* element, RenderStyle* style) 138 RenderObject* RenderObject::createObject(Element* element, RenderStyle* style)
143 { 139 {
144 Document& doc = element->document();
145
146 // Minimal support for content properties replacing an entire element. 140 // Minimal support for content properties replacing an entire element.
147 // Works only if we have exactly one piece of content and it's a URL. 141 // Works only if we have exactly one piece of content and it's a URL.
148 // Otherwise acts as if we didn't support this feature. 142 // Otherwise acts as if we didn't support this feature.
149 const ContentData* contentData = style->contentData(); 143 const ContentData* contentData = style->contentData();
150 if (contentData && !contentData->next() && contentData->isImage() && !elemen t->isPseudoElement()) { 144 if (contentData && !contentData->next() && contentData->isImage() && !elemen t->isPseudoElement()) {
151 RenderImage* image = new RenderImage(element); 145 RenderImage* image = new RenderImage(element);
152 // RenderImageResourceStyleImage requires a style being present on the i mage but we don't want to 146 // RenderImageResourceStyleImage requires a style being present on the i mage but we don't want to
153 // trigger a style change now as the node is not fully attached. Moving this code to style change 147 // trigger a style change now as the node is not fully attached. Moving this code to style change
154 // doesn't make sense as it should be run once at renderer creation. 148 // doesn't make sense as it should be run once at renderer creation.
155 image->setStyleInternal(style); 149 image->setStyleInternal(style);
(...skipping 19 matching lines...) Expand all
175 if (element->hasTagName(rtTag) && style->display() == BLOCK) 169 if (element->hasTagName(rtTag) && style->display() == BLOCK)
176 return new RenderRubyText(element); 170 return new RenderRubyText(element);
177 171
178 switch (style->display()) { 172 switch (style->display()) {
179 case NONE: 173 case NONE:
180 return 0; 174 return 0;
181 case INLINE: 175 case INLINE:
182 return new RenderInline(element); 176 return new RenderInline(element);
183 case BLOCK: 177 case BLOCK:
184 case INLINE_BLOCK: 178 case INLINE_BLOCK:
185 if ((!style->hasAutoColumnCount() || !style->hasAutoColumnWidth()) && do c.regionBasedColumnsEnabled())
186 return new RenderMultiColumnBlock(element);
187 return new RenderBlockFlow(element); 179 return new RenderBlockFlow(element);
188 case LIST_ITEM: 180 case LIST_ITEM:
189 return new RenderListItem(element); 181 return new RenderListItem(element);
190 case TABLE: 182 case TABLE:
191 case INLINE_TABLE: 183 case INLINE_TABLE:
192 return new RenderTable(element); 184 return new RenderTable(element);
193 case TABLE_ROW_GROUP: 185 case TABLE_ROW_GROUP:
194 case TABLE_HEADER_GROUP: 186 case TABLE_HEADER_GROUP:
195 case TABLE_FOOTER_GROUP: 187 case TABLE_FOOTER_GROUP:
196 return new RenderTableSection(element); 188 return new RenderTableSection(element);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 bool RenderObject::isHR() const 267 bool RenderObject::isHR() const
276 { 268 {
277 return node() && node()->hasTagName(hrTag); 269 return node() && node()->hasTagName(hrTag);
278 } 270 }
279 271
280 bool RenderObject::isLegend() const 272 bool RenderObject::isLegend() const
281 { 273 {
282 return node() && node()->hasTagName(legendTag); 274 return node() && node()->hasTagName(legendTag);
283 } 275 }
284 276
285 void RenderObject::setFlowThreadStateIncludingDescendants(FlowThreadState state)
286 {
287 setFlowThreadState(state);
288
289 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) {
290 // If the child is a fragmentation context it already updated the descen dants flag accordingly.
291 if (child->isRenderFlowThread())
292 continue;
293 ASSERT(state != child->flowThreadState());
294 child->setFlowThreadStateIncludingDescendants(state);
295 }
296 }
297
298 bool RenderObject::requiresAnonymousTableWrappers(const RenderObject* newChild) const 277 bool RenderObject::requiresAnonymousTableWrappers(const RenderObject* newChild) const
299 { 278 {
300 // Check should agree with: 279 // Check should agree with:
301 // CSS 2.1 Tables: 17.2.1 Anonymous table objects 280 // CSS 2.1 Tables: 17.2.1 Anonymous table objects
302 // http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes 281 // http://www.w3.org/TR/CSS21/tables.html#anonymous-boxes
303 if (newChild->isRenderTableCol()) { 282 if (newChild->isRenderTableCol()) {
304 const RenderTableCol* newTableColumn = toRenderTableCol(newChild); 283 const RenderTableCol* newTableColumn = toRenderTableCol(newChild);
305 bool isColumnInColumnGroup = newTableColumn->isTableColumn() && isRender TableCol(); 284 bool isColumnInColumnGroup = newTableColumn->isTableColumn() && isRender TableCol();
306 return !isTable() && !isColumnInColumnGroup; 285 return !isTable() && !isColumnInColumnGroup;
307 } else if (newChild->isTableCaption()) 286 } else if (newChild->isTableCaption())
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 continue; 579 continue;
601 580
602 RenderBox* ancestorBox = toRenderBox(ancestor); 581 RenderBox* ancestorBox = toRenderBox(ancestor);
603 if (ancestorBox->canBeScrolledAndHasScrollableArea()) 582 if (ancestorBox->canBeScrolledAndHasScrollableArea())
604 return ancestorBox; 583 return ancestorBox;
605 } 584 }
606 585
607 return 0; 586 return 0;
608 } 587 }
609 588
610 RenderFlowThread* RenderObject::locateFlowThreadContainingBlock() const
611 {
612 ASSERT(flowThreadState() != NotInsideFlowThread);
613
614 // See if we have the thread cached because we're in the middle of layout.
615 RenderFlowThread* flowThread = view()->flowThreadController()->currentRender FlowThread();
616 if (flowThread)
617 return flowThread;
618
619 // Not in the middle of layout so have to find the thread the slow way.
620 RenderObject* curr = const_cast<RenderObject*>(this);
621 while (curr) {
622 if (curr->isRenderFlowThread())
623 return toRenderFlowThread(curr);
624 curr = curr->containingBlock();
625 }
626 return 0;
627 }
628
629 RenderNamedFlowThread* RenderObject::renderNamedFlowThreadWrapper() const
630 {
631 RenderObject* object = const_cast<RenderObject*>(this);
632 while (object && object->isAnonymousBlock() && !object->isRenderNamedFlowThr ead())
633 object = object->parent();
634
635 return object && object->isRenderNamedFlowThread() ? toRenderNamedFlowThread (object) : 0;
636 }
637
638 RenderBlock* RenderObject::firstLineBlock() const 589 RenderBlock* RenderObject::firstLineBlock() const
639 { 590 {
640 return 0; 591 return 0;
641 } 592 }
642 593
643 static inline bool objectIsRelayoutBoundary(const RenderObject* object) 594 static inline bool objectIsRelayoutBoundary(const RenderObject* object)
644 { 595 {
645 // FIXME: In future it may be possible to broaden these conditions in order to improve performance. 596 // FIXME: In future it may be possible to broaden these conditions in order to improve performance.
646 if (object->isTextControl()) 597 if (object->isTextControl())
647 return true; 598 return true;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 } 1306 }
1356 } 1307 }
1357 1308
1358 if (document().view()->hasSoftwareFilters()) { 1309 if (document().view()->hasSoftwareFilters()) {
1359 if (RenderLayer* parentLayer = enclosingLayer()) { 1310 if (RenderLayer* parentLayer = enclosingLayer()) {
1360 RenderLayer* enclosingFilterLayer = parentLayer->enclosingFilterLaye r(); 1311 RenderLayer* enclosingFilterLayer = parentLayer->enclosingFilterLaye r();
1361 if (enclosingFilterLayer) 1312 if (enclosingFilterLayer)
1362 return enclosingFilterLayer->renderer(); 1313 return enclosingFilterLayer->renderer();
1363 } 1314 }
1364 } 1315 }
1365
1366 // If we have a flow thread, then we need to do individual repaints within t he RenderRegions instead.
1367 // Return the flow thread as a repaint container in order to create a chokep oint that allows us to change
1368 // repainting to do individual region repaints.
1369 RenderFlowThread* parentRenderFlowThread = flowThreadContainingBlock();
1370 if (parentRenderFlowThread) {
1371 // The ancestor document will do the reparenting when the repaint propag ates further up.
1372 // We're just a seamless child document, and we don't need to do the hac king.
1373 if (parentRenderFlowThread->document() != document())
1374 return repaintContainer;
1375 // If we have already found a repaint container then we will repaint int o that container only if it is part of the same
1376 // flow thread. Otherwise we will need to catch the repaint call and sen d it to the flow thread.
1377 RenderFlowThread* repaintContainerFlowThread = repaintContainer ? repain tContainer->flowThreadContainingBlock() : 0;
1378 if (!repaintContainerFlowThread || repaintContainerFlowThread != parentR enderFlowThread)
1379 repaintContainer = parentRenderFlowThread;
1380 }
1381 return repaintContainer; 1316 return repaintContainer;
1382 } 1317 }
1383 1318
1384 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo ntainer, const IntRect& r) const 1319 void RenderObject::repaintUsingContainer(const RenderLayerModelObject* repaintCo ntainer, const IntRect& r) const
1385 { 1320 {
1386 if (!repaintContainer) { 1321 if (!repaintContainer) {
1387 view()->repaintViewRectangle(r); 1322 view()->repaintViewRectangle(r);
1388 return; 1323 return;
1389 } 1324 }
1390 1325
(...skipping 18 matching lines...) Expand all
1409 // directly to the next chunk of code. 1344 // directly to the next chunk of code.
1410 1345
1411 // Then, convert the repaint rect from repaintConainer space into the sq uashing GraphicsLayer's coordinates. 1346 // Then, convert the repaint rect from repaintConainer space into the sq uashing GraphicsLayer's coordinates.
1412 if (repaintContainer->hasTransform()) 1347 if (repaintContainer->hasTransform())
1413 offsetRect = repaintContainer->layer()->transform()->mapRect(r); 1348 offsetRect = repaintContainer->layer()->transform()->mapRect(r);
1414 offsetRect.move(-repaintContainer->layer()->offsetFromSquashingLayerOrig in()); 1349 offsetRect.move(-repaintContainer->layer()->offsetFromSquashingLayerOrig in());
1415 repaintContainer->groupedMapping()->squashingLayer()->setNeedsDisplayInR ect(offsetRect); 1350 repaintContainer->groupedMapping()->squashingLayer()->setNeedsDisplayInR ect(offsetRect);
1416 return; 1351 return;
1417 } 1352 }
1418 1353
1419 if (repaintContainer->isRenderFlowThread()) {
1420 toRenderFlowThread(repaintContainer)->repaintRectangleInRegions(r);
1421 return;
1422 }
1423
1424 if (repaintContainer->hasFilter() && repaintContainer->layer()->requiresFull LayerImageForFilters()) { 1354 if (repaintContainer->hasFilter() && repaintContainer->layer()->requiresFull LayerImageForFilters()) {
1425 repaintContainer->layer()->repainter().setFilterBackendNeedsRepaintingIn Rect(r); 1355 repaintContainer->layer()->repainter().setFilterBackendNeedsRepaintingIn Rect(r);
1426 return; 1356 return;
1427 } 1357 }
1428 1358
1429 RenderView* v = view(); 1359 RenderView* v = view();
1430 if (repaintContainer->isRenderView()) { 1360 if (repaintContainer->isRenderView()) {
1431 ASSERT(repaintContainer == v); 1361 ASSERT(repaintContainer == v);
1432 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->compositingSt ate() == PaintsIntoOwnBacking; 1362 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->compositingSt ate() == PaintsIntoOwnBacking;
1433 if (!viewHasCompositedLayer) { 1363 if (!viewHasCompositedLayer) {
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 ASSERT(o == container()); 2246 ASSERT(o == container());
2317 2247
2318 LayoutSize offset; 2248 LayoutSize offset;
2319 2249
2320 o->adjustForColumns(offset, point); 2250 o->adjustForColumns(offset, point);
2321 2251
2322 if (o->hasOverflowClip()) 2252 if (o->hasOverflowClip())
2323 offset -= toRenderBox(o)->scrolledContentOffset(); 2253 offset -= toRenderBox(o)->scrolledContentOffset();
2324 2254
2325 if (offsetDependsOnPoint) 2255 if (offsetDependsOnPoint)
2326 *offsetDependsOnPoint = hasColumns() || o->isRenderFlowThread(); 2256 *offsetDependsOnPoint = hasColumns();
2327 2257
2328 return offset; 2258 return offset;
2329 } 2259 }
2330 2260
2331 LayoutSize RenderObject::offsetFromAncestorContainer(RenderObject* container) co nst 2261 LayoutSize RenderObject::offsetFromAncestorContainer(RenderObject* container) co nst
2332 { 2262 {
2333 LayoutSize offset; 2263 LayoutSize offset;
2334 LayoutPoint referencePoint; 2264 LayoutPoint referencePoint;
2335 const RenderObject* currContainer = this; 2265 const RenderObject* currContainer = this;
2336 do { 2266 do {
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 if (AXObjectCache* cache = document().existingAXObjectCache()) 2501 if (AXObjectCache* cache = document().existingAXObjectCache())
2572 cache->childrenChanged(this->parent()); 2502 cache->childrenChanged(this->parent());
2573 2503
2574 remove(); 2504 remove();
2575 2505
2576 // The remove() call above may invoke axObjectCache()->childrenChanged() on the parent, which may require the AX render 2506 // The remove() call above may invoke axObjectCache()->childrenChanged() on the parent, which may require the AX render
2577 // object for this renderer. So we remove the AX render object now, after th e renderer is removed. 2507 // object for this renderer. So we remove the AX render object now, after th e renderer is removed.
2578 if (AXObjectCache* cache = document().existingAXObjectCache()) 2508 if (AXObjectCache* cache = document().existingAXObjectCache())
2579 cache->remove(this); 2509 cache->remove(this);
2580 2510
2581 #ifndef NDEBUG
2582 if (!documentBeingDestroyed() && view() && view()->hasRenderNamedFlowThreads ()) {
2583 // After remove, the object and the associated information should not be in any flow thread.
2584 const RenderNamedFlowThreadList* flowThreadList = view()->flowThreadCont roller()->renderNamedFlowThreadList();
2585 for (RenderNamedFlowThreadList::const_iterator iter = flowThreadList->be gin(); iter != flowThreadList->end(); ++iter) {
2586 const RenderNamedFlowThread* renderFlowThread = *iter;
2587 ASSERT(!renderFlowThread->hasChild(this));
2588 ASSERT(!renderFlowThread->hasChildInfo(this));
2589 }
2590 }
2591 #endif
2592
2593 // If this renderer had a parent, remove should have destroyed any counters 2511 // If this renderer had a parent, remove should have destroyed any counters
2594 // attached to this renderer and marked the affected other counters for 2512 // attached to this renderer and marked the affected other counters for
2595 // reevaluation. This apparently redundant check is here for the case when 2513 // reevaluation. This apparently redundant check is here for the case when
2596 // this renderer had no parent at the time remove() was called. 2514 // this renderer had no parent at the time remove() was called.
2597 2515
2598 if (hasCounterNodeMap()) 2516 if (hasCounterNodeMap())
2599 RenderCounter::destroyCounterNodes(*this); 2517 RenderCounter::destroyCounterNodes(*this);
2600 2518
2601 setAncestorLineBoxDirty(false); 2519 setAncestorLineBoxDirty(false);
2602 2520
(...skipping 16 matching lines...) Expand all
2619 // that needs to be drawn and layer visibility optimization can't be used 2537 // that needs to be drawn and layer visibility optimization can't be used
2620 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2538 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2621 if (!layer) 2539 if (!layer)
2622 layer = parent()->enclosingLayer(); 2540 layer = parent()->enclosingLayer();
2623 if (layer) 2541 if (layer)
2624 layer->setHasVisibleContent(); 2542 layer->setHasVisibleContent();
2625 } 2543 }
2626 2544
2627 if (!isFloating() && parent()->childrenInline()) 2545 if (!isFloating() && parent()->childrenInline())
2628 parent()->dirtyLinesFromChangedChild(this); 2546 parent()->dirtyLinesFromChangedChild(this);
2629
2630 if (RenderNamedFlowThread* containerFlowThread = parent()->renderNamedFlowTh readWrapper())
2631 containerFlowThread->addFlowChild(this);
2632 } 2547 }
2633 2548
2634 void RenderObject::willBeRemovedFromTree() 2549 void RenderObject::willBeRemovedFromTree()
2635 { 2550 {
2636 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first. 2551 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal s which would need to be fixed first.
2637 2552
2638 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more. 2553 // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
2639 RenderLayer* layer = 0; 2554 RenderLayer* layer = 0;
2640 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) { 2555 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V ISIBLE && !hasLayer()) {
2641 if ((layer = parent()->enclosingLayer())) 2556 if ((layer = parent()->enclosingLayer()))
2642 layer->dirtyVisibleContentStatus(); 2557 layer->dirtyVisibleContentStatus();
2643 } 2558 }
2644 2559
2645 // Keep our layer hierarchy updated. 2560 // Keep our layer hierarchy updated.
2646 if (firstChild() || hasLayer()) { 2561 if (firstChild() || hasLayer()) {
2647 if (!layer) 2562 if (!layer)
2648 layer = parent()->enclosingLayer(); 2563 layer = parent()->enclosingLayer();
2649 removeLayers(layer); 2564 removeLayers(layer);
2650 } 2565 }
2651 2566
2652 if (isOutOfFlowPositioned() && parent()->childrenInline()) 2567 if (isOutOfFlowPositioned() && parent()->childrenInline())
2653 parent()->dirtyLinesFromChangedChild(this); 2568 parent()->dirtyLinesFromChangedChild(this);
2654 2569
2655 removeFromRenderFlowThread();
2656
2657 if (RenderNamedFlowThread* containerFlowThread = parent()->renderNamedFlowTh readWrapper())
2658 containerFlowThread->removeFlowChild(this);
2659
2660 // Update cached boundaries in SVG renderers if a child is removed. 2570 // Update cached boundaries in SVG renderers if a child is removed.
2661 if (parent()->isSVG()) 2571 if (parent()->isSVG())
2662 parent()->setNeedsBoundariesUpdate(); 2572 parent()->setNeedsBoundariesUpdate();
2663 } 2573 }
2664 2574
2665 void RenderObject::removeFromRenderFlowThread()
2666 {
2667 if (flowThreadState() == NotInsideFlowThread)
2668 return;
2669
2670 // Sometimes we remove the element from the flow, but it's not destroyed at that time.
2671 // It's only until later when we actually destroy it and remove all the chil dren from it.
2672 // Currently, that happens for firstLetter elements and list markers.
2673 // Pass in the flow thread so that we don't have to look it up for all the c hildren.
2674 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock());
2675 }
2676
2677 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF lowThread)
2678 {
2679 if (const RenderObjectChildList* children = virtualChildren()) {
2680 for (RenderObject* child = children->firstChild(); child; child = child- >nextSibling())
2681 child->removeFromRenderFlowThreadRecursive(renderFlowThread);
2682 }
2683
2684 RenderFlowThread* localFlowThread = renderFlowThread;
2685 if (flowThreadState() == InsideInFlowThread)
2686 localFlowThread = flowThreadContainingBlock(); // We have to ask. We can 't just assume we are in the same flow thread.
2687 if (localFlowThread)
2688 localFlowThread->removeFlowChildInfo(this);
2689 setFlowThreadState(NotInsideFlowThread);
2690 }
2691
2692 void RenderObject::destroyAndCleanupAnonymousWrappers() 2575 void RenderObject::destroyAndCleanupAnonymousWrappers()
2693 { 2576 {
2694 // If the tree is destroyed, there is no need for a clean-up phase. 2577 // If the tree is destroyed, there is no need for a clean-up phase.
2695 if (documentBeingDestroyed()) { 2578 if (documentBeingDestroyed()) {
2696 destroy(); 2579 destroy();
2697 return; 2580 return;
2698 } 2581 }
2699 2582
2700 RenderObject* destroyRoot = this; 2583 RenderObject* destroyRoot = this;
2701 for (RenderObject* destroyRootParent = destroyRoot->parent(); destroyRootPar ent && destroyRootParent->isAnonymous(); destroyRoot = destroyRootParent, destro yRootParent = destroyRootParent->parent()) { 2584 for (RenderObject* destroyRootParent = destroyRoot->parent(); destroyRootPar ent && destroyRootParent->isAnonymous(); destroyRoot = destroyRootParent, destro yRootParent = destroyRootParent->parent()) {
2702 // Anonymous block continuations are tracked and destroyed elsewhere (se e the bottom of RenderBlock::removeChild) 2585 // Anonymous block continuations are tracked and destroyed elsewhere (se e the bottom of RenderBlock::removeChild)
2703 if (destroyRootParent->isRenderBlock() && toRenderBlock(destroyRootParen t)->isAnonymousBlockContinuation()) 2586 if (destroyRootParent->isRenderBlock() && toRenderBlock(destroyRootParen t)->isAnonymousBlockContinuation())
2704 break; 2587 break;
2705 // Render flow threads are tracked by the FlowThreadController, so we ca n't destroy them here.
2706 // Column spans are tracked elsewhere. 2588 // Column spans are tracked elsewhere.
2707 if (destroyRootParent->isRenderFlowThread() || destroyRootParent->isAnon ymousColumnSpanBlock()) 2589 if (destroyRootParent->isAnonymousColumnSpanBlock())
2708 break; 2590 break;
2709 2591
2710 if (destroyRootParent->firstChild() != this || destroyRootParent->lastCh ild() != this) 2592 if (destroyRootParent->firstChild() != this || destroyRootParent->lastCh ild() != this)
2711 break; 2593 break;
2712 } 2594 }
2713 2595
2714 destroyRoot->destroy(); 2596 destroyRoot->destroy();
2715 2597
2716 // WARNING: |this| is deleted here. 2598 // WARNING: |this| is deleted here.
2717 } 2599 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 return renderer->node()->isInert(); 3037 return renderer->node()->isInert();
3156 } 3038 }
3157 3039
3158 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect) 3040 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect)
3159 { 3041 {
3160 imageChanged(static_cast<WrappedImagePtr>(image), rect); 3042 imageChanged(static_cast<WrappedImagePtr>(image), rect);
3161 } 3043 }
3162 3044
3163 RenderObject* RenderObject::hoverAncestor() const 3045 RenderObject* RenderObject::hoverAncestor() const
3164 { 3046 {
3165 // When searching for the hover ancestor and encountering a named flow threa d, 3047 // FIXME: Remove.
3166 // the search will continue with the DOM ancestor of the top-most element 3048 return parent();
3167 // in the named flow thread.
3168 // See https://code.google.com/p/chromium/issues/detail?id=243278
3169 RenderObject* hoverAncestor = parent();
3170
3171 // Skip anonymous blocks directly flowed into flow threads as it would
3172 // prevent us from continuing the search on the DOM tree when reaching the n amed flow thread.
3173 if (hoverAncestor && hoverAncestor->isAnonymousBlock() && hoverAncestor->par ent() && hoverAncestor->parent()->isRenderNamedFlowThread())
3174 hoverAncestor = hoverAncestor->parent();
3175
3176 if (hoverAncestor && hoverAncestor->isRenderNamedFlowThread()) {
3177 hoverAncestor = 0;
3178
3179 Node* node = this->node();
3180 if (node) {
3181 Node* domAncestorNode = node->parentNode();
3182 if (domAncestorNode)
3183 hoverAncestor = domAncestorNode->renderer();
3184 }
3185 }
3186
3187 return hoverAncestor;
3188 } 3049 }
3189 3050
3190 Element* RenderObject::offsetParent() const 3051 Element* RenderObject::offsetParent() const
3191 { 3052 {
3192 if (isRoot() || isBody()) 3053 if (isRoot() || isBody())
3193 return 0; 3054 return 0;
3194 3055
3195 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) 3056 if (isOutOfFlowPositioned() && style()->position() == FixedPosition)
3196 return 0; 3057 return 0;
3197 3058
3198 // If A is an area HTML element which has a map HTML element somewhere in th e ancestor 3059 // If A is an area HTML element which has a map HTML element somewhere in th e ancestor
3199 // chain return the nearest ancestor map HTML element and stop this algorith m. 3060 // chain return the nearest ancestor map HTML element and stop this algorith m.
3200 // FIXME: Implement! 3061 // FIXME: Implement!
3201 3062
3202 float effectiveZoom = style()->effectiveZoom(); 3063 float effectiveZoom = style()->effectiveZoom();
3203 Node* node = 0; 3064 Node* node = 0;
3204 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { 3065 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) {
3205 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes 3066 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes
3206 3067
3207 // CSS regions specification says that region flows should return the bo dy element as their offsetParent.
3208 if (ancestor->isRenderNamedFlowThread())
3209 return document().body();
3210
3211 node = ancestor->node(); 3068 node = ancestor->node();
3212 3069
3213 if (!node) 3070 if (!node)
3214 continue; 3071 continue;
3215 3072
3216 if (ancestor->isPositioned()) 3073 if (ancestor->isPositioned())
3217 break; 3074 break;
3218 3075
3219 if (node->hasTagName(bodyTag)) 3076 if (node->hasTagName(bodyTag))
3220 break; 3077 break;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3358 { 3215 {
3359 ASSERT_NOT_REACHED(); 3216 ASSERT_NOT_REACHED();
3360 return false; 3217 return false;
3361 } 3218 }
3362 3219
3363 bool RenderObject::isRelayoutBoundaryForInspector() const 3220 bool RenderObject::isRelayoutBoundaryForInspector() const
3364 { 3221 {
3365 return objectIsRelayoutBoundary(this); 3222 return objectIsRelayoutBoundary(this);
3366 } 3223 }
3367 3224
3368 bool RenderObject::isRenderNamedFlowFragmentContainer() const
3369 {
3370 return isRenderBlockFlow() && toRenderBlockFlow(this)->renderNamedFlowFragme nt();
3371 }
3372
3373 } // namespace WebCore 3225 } // namespace WebCore
3374 3226
3375 #ifndef NDEBUG 3227 #ifndef NDEBUG
3376 3228
3377 void showTree(const WebCore::RenderObject* object) 3229 void showTree(const WebCore::RenderObject* object)
3378 { 3230 {
3379 if (object) 3231 if (object)
3380 object->showTreeForThis(); 3232 object->showTreeForThis();
3381 } 3233 }
3382 3234
(...skipping 12 matching lines...) Expand all
3395 { 3247 {
3396 if (object1) { 3248 if (object1) {
3397 const WebCore::RenderObject* root = object1; 3249 const WebCore::RenderObject* root = object1;
3398 while (root->parent()) 3250 while (root->parent())
3399 root = root->parent(); 3251 root = root->parent();
3400 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3252 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3401 } 3253 }
3402 } 3254 }
3403 3255
3404 #endif 3256 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderRegion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698