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) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "core/page/Page.h" | 48 #include "core/page/Page.h" |
49 #include "core/frame/Settings.h" | 49 #include "core/frame/Settings.h" |
50 #include "core/frame/UseCounter.h" | 50 #include "core/frame/UseCounter.h" |
51 #include "core/rendering/CompositedLayerMapping.h" | 51 #include "core/rendering/CompositedLayerMapping.h" |
52 #include "core/rendering/FlowThreadController.h" | 52 #include "core/rendering/FlowThreadController.h" |
53 #include "core/rendering/HitTestResult.h" | 53 #include "core/rendering/HitTestResult.h" |
54 #include "core/rendering/LayoutRectRecorder.h" | 54 #include "core/rendering/LayoutRectRecorder.h" |
55 #include "core/rendering/RenderCounter.h" | 55 #include "core/rendering/RenderCounter.h" |
56 #include "core/rendering/RenderDeprecatedFlexibleBox.h" | 56 #include "core/rendering/RenderDeprecatedFlexibleBox.h" |
57 #include "core/rendering/RenderFlexibleBox.h" | 57 #include "core/rendering/RenderFlexibleBox.h" |
| 58 #include "core/rendering/RenderFlowThread.h" |
58 #include "core/rendering/RenderGeometryMap.h" | 59 #include "core/rendering/RenderGeometryMap.h" |
59 #include "core/rendering/RenderGrid.h" | 60 #include "core/rendering/RenderGrid.h" |
60 #include "core/rendering/RenderImage.h" | 61 #include "core/rendering/RenderImage.h" |
61 #include "core/rendering/RenderImageResourceStyleImage.h" | 62 #include "core/rendering/RenderImageResourceStyleImage.h" |
62 #include "core/rendering/RenderInline.h" | 63 #include "core/rendering/RenderInline.h" |
63 #include "core/rendering/RenderLayer.h" | 64 #include "core/rendering/RenderLayer.h" |
64 #include "core/rendering/RenderLayerCompositor.h" | 65 #include "core/rendering/RenderLayerCompositor.h" |
65 #include "core/rendering/RenderListItem.h" | 66 #include "core/rendering/RenderListItem.h" |
66 #include "core/rendering/RenderMarquee.h" | 67 #include "core/rendering/RenderMarquee.h" |
67 #include "core/rendering/RenderMultiColumnBlock.h" | 68 #include "core/rendering/RenderMultiColumnBlock.h" |
68 #include "core/rendering/RenderNamedFlowThread.h" | |
69 #include "core/rendering/RenderRegion.h" | |
70 #include "core/rendering/RenderScrollbarPart.h" | 69 #include "core/rendering/RenderScrollbarPart.h" |
71 #include "core/rendering/RenderTableCaption.h" | 70 #include "core/rendering/RenderTableCaption.h" |
72 #include "core/rendering/RenderTableCell.h" | 71 #include "core/rendering/RenderTableCell.h" |
73 #include "core/rendering/RenderTableCol.h" | 72 #include "core/rendering/RenderTableCol.h" |
74 #include "core/rendering/RenderTableRow.h" | 73 #include "core/rendering/RenderTableRow.h" |
75 #include "core/rendering/RenderTheme.h" | 74 #include "core/rendering/RenderTheme.h" |
76 #include "core/rendering/RenderView.h" | 75 #include "core/rendering/RenderView.h" |
77 #include "core/rendering/style/ContentData.h" | 76 #include "core/rendering/style/ContentData.h" |
78 #include "core/rendering/style/CursorList.h" | 77 #include "core/rendering/style/CursorList.h" |
79 #include "core/rendering/style/ShadowList.h" | 78 #include "core/rendering/style/ShadowList.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // Not in the middle of layout so have to find the thread the slow way. | 599 // Not in the middle of layout so have to find the thread the slow way. |
601 RenderObject* curr = const_cast<RenderObject*>(this); | 600 RenderObject* curr = const_cast<RenderObject*>(this); |
602 while (curr) { | 601 while (curr) { |
603 if (curr->isRenderFlowThread()) | 602 if (curr->isRenderFlowThread()) |
604 return toRenderFlowThread(curr); | 603 return toRenderFlowThread(curr); |
605 curr = curr->containingBlock(); | 604 curr = curr->containingBlock(); |
606 } | 605 } |
607 return 0; | 606 return 0; |
608 } | 607 } |
609 | 608 |
610 RenderNamedFlowThread* RenderObject::renderNamedFlowThreadWrapper() const | |
611 { | |
612 RenderObject* object = const_cast<RenderObject*>(this); | |
613 while (object && object->isAnonymousBlock() && !object->isRenderNamedFlowThr
ead()) | |
614 object = object->parent(); | |
615 | |
616 return object && object->isRenderNamedFlowThread() ? toRenderNamedFlowThread
(object) : 0; | |
617 } | |
618 | |
619 RenderBlock* RenderObject::firstLineBlock() const | 609 RenderBlock* RenderObject::firstLineBlock() const |
620 { | 610 { |
621 return 0; | 611 return 0; |
622 } | 612 } |
623 | 613 |
624 static inline bool objectIsRelayoutBoundary(const RenderObject* object) | 614 static inline bool objectIsRelayoutBoundary(const RenderObject* object) |
625 { | 615 { |
626 // FIXME: In future it may be possible to broaden these conditions in order
to improve performance. | 616 // FIXME: In future it may be possible to broaden these conditions in order
to improve performance. |
627 if (object->isTextControl()) | 617 if (object->isTextControl()) |
628 return true; | 618 return true; |
(...skipping 1929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 if (AXObjectCache* cache = document().existingAXObjectCache()) | 2548 if (AXObjectCache* cache = document().existingAXObjectCache()) |
2559 cache->childrenChanged(this->parent()); | 2549 cache->childrenChanged(this->parent()); |
2560 | 2550 |
2561 remove(); | 2551 remove(); |
2562 | 2552 |
2563 // The remove() call above may invoke axObjectCache()->childrenChanged() on
the parent, which may require the AX render | 2553 // The remove() call above may invoke axObjectCache()->childrenChanged() on
the parent, which may require the AX render |
2564 // object for this renderer. So we remove the AX render object now, after th
e renderer is removed. | 2554 // object for this renderer. So we remove the AX render object now, after th
e renderer is removed. |
2565 if (AXObjectCache* cache = document().existingAXObjectCache()) | 2555 if (AXObjectCache* cache = document().existingAXObjectCache()) |
2566 cache->remove(this); | 2556 cache->remove(this); |
2567 | 2557 |
2568 #ifndef NDEBUG | |
2569 if (!documentBeingDestroyed() && view() && view()->hasRenderNamedFlowThreads
()) { | |
2570 // After remove, the object and the associated information should not be
in any flow thread. | |
2571 const RenderNamedFlowThreadList* flowThreadList = view()->flowThreadCont
roller()->renderNamedFlowThreadList(); | |
2572 for (RenderNamedFlowThreadList::const_iterator iter = flowThreadList->be
gin(); iter != flowThreadList->end(); ++iter) { | |
2573 const RenderNamedFlowThread* renderFlowThread = *iter; | |
2574 ASSERT(!renderFlowThread->hasChild(this)); | |
2575 ASSERT(!renderFlowThread->hasChildInfo(this)); | |
2576 } | |
2577 } | |
2578 #endif | |
2579 | |
2580 // If this renderer had a parent, remove should have destroyed any counters | 2558 // If this renderer had a parent, remove should have destroyed any counters |
2581 // attached to this renderer and marked the affected other counters for | 2559 // attached to this renderer and marked the affected other counters for |
2582 // reevaluation. This apparently redundant check is here for the case when | 2560 // reevaluation. This apparently redundant check is here for the case when |
2583 // this renderer had no parent at the time remove() was called. | 2561 // this renderer had no parent at the time remove() was called. |
2584 | 2562 |
2585 if (hasCounterNodeMap()) | 2563 if (hasCounterNodeMap()) |
2586 RenderCounter::destroyCounterNodes(*this); | 2564 RenderCounter::destroyCounterNodes(*this); |
2587 | 2565 |
2588 setAncestorLineBoxDirty(false); | 2566 setAncestorLineBoxDirty(false); |
2589 | 2567 |
(...skipping 16 matching lines...) Expand all Loading... |
2606 // that needs to be drawn and layer visibility optimization can't be used | 2584 // that needs to be drawn and layer visibility optimization can't be used |
2607 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V
ISIBLE && !hasLayer()) { | 2585 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V
ISIBLE && !hasLayer()) { |
2608 if (!layer) | 2586 if (!layer) |
2609 layer = parent()->enclosingLayer(); | 2587 layer = parent()->enclosingLayer(); |
2610 if (layer) | 2588 if (layer) |
2611 layer->setHasVisibleContent(); | 2589 layer->setHasVisibleContent(); |
2612 } | 2590 } |
2613 | 2591 |
2614 if (!isFloating() && parent()->childrenInline()) | 2592 if (!isFloating() && parent()->childrenInline()) |
2615 parent()->dirtyLinesFromChangedChild(this); | 2593 parent()->dirtyLinesFromChangedChild(this); |
2616 | |
2617 if (RenderNamedFlowThread* containerFlowThread = parent()->renderNamedFlowTh
readWrapper()) | |
2618 containerFlowThread->addFlowChild(this); | |
2619 } | 2594 } |
2620 | 2595 |
2621 void RenderObject::willBeRemovedFromTree() | 2596 void RenderObject::willBeRemovedFromTree() |
2622 { | 2597 { |
2623 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal
s which would need to be fixed first. | 2598 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removal
s which would need to be fixed first. |
2624 | 2599 |
2625 // If we remove a visible child from an invisible parent, we don't know the
layer visibility any more. | 2600 // If we remove a visible child from an invisible parent, we don't know the
layer visibility any more. |
2626 RenderLayer* layer = 0; | 2601 RenderLayer* layer = 0; |
2627 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V
ISIBLE && !hasLayer()) { | 2602 if (parent()->style()->visibility() != VISIBLE && style()->visibility() == V
ISIBLE && !hasLayer()) { |
2628 if ((layer = parent()->enclosingLayer())) | 2603 if ((layer = parent()->enclosingLayer())) |
2629 layer->dirtyVisibleContentStatus(); | 2604 layer->dirtyVisibleContentStatus(); |
2630 } | 2605 } |
2631 | 2606 |
2632 // Keep our layer hierarchy updated. | 2607 // Keep our layer hierarchy updated. |
2633 if (firstChild() || hasLayer()) { | 2608 if (firstChild() || hasLayer()) { |
2634 if (!layer) | 2609 if (!layer) |
2635 layer = parent()->enclosingLayer(); | 2610 layer = parent()->enclosingLayer(); |
2636 removeLayers(layer); | 2611 removeLayers(layer); |
2637 } | 2612 } |
2638 | 2613 |
2639 if (isOutOfFlowPositioned() && parent()->childrenInline()) | 2614 if (isOutOfFlowPositioned() && parent()->childrenInline()) |
2640 parent()->dirtyLinesFromChangedChild(this); | 2615 parent()->dirtyLinesFromChangedChild(this); |
2641 | 2616 |
2642 removeFromRenderFlowThread(); | 2617 removeFromRenderFlowThread(); |
2643 | 2618 |
2644 if (RenderNamedFlowThread* containerFlowThread = parent()->renderNamedFlowTh
readWrapper()) | |
2645 containerFlowThread->removeFlowChild(this); | |
2646 | |
2647 // Update cached boundaries in SVG renderers if a child is removed. | 2619 // Update cached boundaries in SVG renderers if a child is removed. |
2648 if (parent()->isSVG()) | 2620 if (parent()->isSVG()) |
2649 parent()->setNeedsBoundariesUpdate(); | 2621 parent()->setNeedsBoundariesUpdate(); |
2650 } | 2622 } |
2651 | 2623 |
2652 void RenderObject::removeFromRenderFlowThread() | 2624 void RenderObject::removeFromRenderFlowThread() |
2653 { | 2625 { |
2654 if (flowThreadState() == NotInsideFlowThread) | 2626 if (flowThreadState() == NotInsideFlowThread) |
2655 return; | 2627 return; |
2656 | 2628 |
2657 // Sometimes we remove the element from the flow, but it's not destroyed at
that time. | 2629 // Sometimes we remove the element from the flow, but it's not destroyed at
that time. |
2658 // It's only until later when we actually destroy it and remove all the chil
dren from it. | 2630 // It's only until later when we actually destroy it and remove all the chil
dren from it. |
2659 // Currently, that happens for firstLetter elements and list markers. | 2631 // Currently, that happens for firstLetter elements and list markers. |
2660 // Pass in the flow thread so that we don't have to look it up for all the c
hildren. | 2632 // Pass in the flow thread so that we don't have to look it up for all the c
hildren. |
2661 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock()); | 2633 removeFromRenderFlowThreadRecursive(flowThreadContainingBlock()); |
2662 } | 2634 } |
2663 | 2635 |
2664 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF
lowThread) | 2636 void RenderObject::removeFromRenderFlowThreadRecursive(RenderFlowThread* renderF
lowThread) |
2665 { | 2637 { |
2666 if (const RenderObjectChildList* children = virtualChildren()) { | 2638 if (const RenderObjectChildList* children = virtualChildren()) { |
2667 for (RenderObject* child = children->firstChild(); child; child = child-
>nextSibling()) | 2639 for (RenderObject* child = children->firstChild(); child; child = child-
>nextSibling()) |
2668 child->removeFromRenderFlowThreadRecursive(renderFlowThread); | 2640 child->removeFromRenderFlowThreadRecursive(renderFlowThread); |
2669 } | 2641 } |
2670 | 2642 |
2671 RenderFlowThread* localFlowThread = renderFlowThread; | |
2672 if (flowThreadState() == InsideInFlowThread) | |
2673 localFlowThread = flowThreadContainingBlock(); // We have to ask. We can
't just assume we are in the same flow thread. | |
2674 if (localFlowThread) | |
2675 localFlowThread->removeFlowChildInfo(this); | |
2676 setFlowThreadState(NotInsideFlowThread); | 2643 setFlowThreadState(NotInsideFlowThread); |
2677 } | 2644 } |
2678 | 2645 |
2679 void RenderObject::destroyAndCleanupAnonymousWrappers() | 2646 void RenderObject::destroyAndCleanupAnonymousWrappers() |
2680 { | 2647 { |
2681 // If the tree is destroyed, there is no need for a clean-up phase. | 2648 // If the tree is destroyed, there is no need for a clean-up phase. |
2682 if (documentBeingDestroyed()) { | 2649 if (documentBeingDestroyed()) { |
2683 destroy(); | 2650 destroy(); |
2684 return; | 2651 return; |
2685 } | 2652 } |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3127 while (!renderer->node()) | 3094 while (!renderer->node()) |
3128 renderer = renderer->parent(); | 3095 renderer = renderer->parent(); |
3129 return renderer->node()->isInert(); | 3096 return renderer->node()->isInert(); |
3130 } | 3097 } |
3131 | 3098 |
3132 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect) | 3099 void RenderObject::imageChanged(ImageResource* image, const IntRect* rect) |
3133 { | 3100 { |
3134 imageChanged(static_cast<WrappedImagePtr>(image), rect); | 3101 imageChanged(static_cast<WrappedImagePtr>(image), rect); |
3135 } | 3102 } |
3136 | 3103 |
3137 RenderObject* RenderObject::hoverAncestor() const | |
3138 { | |
3139 // When searching for the hover ancestor and encountering a named flow threa
d, | |
3140 // the search will continue with the DOM ancestor of the top-most element | |
3141 // in the named flow thread. | |
3142 // See https://code.google.com/p/chromium/issues/detail?id=243278 | |
3143 RenderObject* hoverAncestor = parent(); | |
3144 | |
3145 // Skip anonymous blocks directly flowed into flow threads as it would | |
3146 // prevent us from continuing the search on the DOM tree when reaching the n
amed flow thread. | |
3147 if (hoverAncestor && hoverAncestor->isAnonymousBlock() && hoverAncestor->par
ent() && hoverAncestor->parent()->isRenderNamedFlowThread()) | |
3148 hoverAncestor = hoverAncestor->parent(); | |
3149 | |
3150 if (hoverAncestor && hoverAncestor->isRenderNamedFlowThread()) { | |
3151 hoverAncestor = 0; | |
3152 | |
3153 Node* node = this->node(); | |
3154 if (node) { | |
3155 Node* domAncestorNode = node->parentNode(); | |
3156 if (domAncestorNode) | |
3157 hoverAncestor = domAncestorNode->renderer(); | |
3158 } | |
3159 } | |
3160 | |
3161 return hoverAncestor; | |
3162 } | |
3163 | |
3164 Element* RenderObject::offsetParent() const | 3104 Element* RenderObject::offsetParent() const |
3165 { | 3105 { |
3166 if (isRoot() || isBody()) | 3106 if (isRoot() || isBody()) |
3167 return 0; | 3107 return 0; |
3168 | 3108 |
3169 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) | 3109 if (isOutOfFlowPositioned() && style()->position() == FixedPosition) |
3170 return 0; | 3110 return 0; |
3171 | 3111 |
3172 // If A is an area HTML element which has a map HTML element somewhere in th
e ancestor | 3112 // If A is an area HTML element which has a map HTML element somewhere in th
e ancestor |
3173 // chain return the nearest ancestor map HTML element and stop this algorith
m. | 3113 // chain return the nearest ancestor map HTML element and stop this algorith
m. |
3174 // FIXME: Implement! | 3114 // FIXME: Implement! |
3175 | 3115 |
3176 float effectiveZoom = style()->effectiveZoom(); | 3116 float effectiveZoom = style()->effectiveZoom(); |
3177 Node* node = 0; | 3117 Node* node = 0; |
3178 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren
t()) { | 3118 for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->paren
t()) { |
3179 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes | 3119 // Spec: http://www.w3.org/TR/cssom-view/#offset-attributes |
3180 | 3120 |
3181 // CSS regions specification says that region flows should return the bo
dy element as their offsetParent. | |
3182 if (ancestor->isRenderNamedFlowThread()) | |
3183 return document().body(); | |
3184 | |
3185 node = ancestor->node(); | 3121 node = ancestor->node(); |
3186 | 3122 |
3187 if (!node) | 3123 if (!node) |
3188 continue; | 3124 continue; |
3189 | 3125 |
3190 if (ancestor->isPositioned()) | 3126 if (ancestor->isPositioned()) |
3191 break; | 3127 break; |
3192 | 3128 |
3193 if (node->hasTagName(bodyTag)) | 3129 if (node->hasTagName(bodyTag)) |
3194 break; | 3130 break; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3332 { | 3268 { |
3333 ASSERT_NOT_REACHED(); | 3269 ASSERT_NOT_REACHED(); |
3334 return false; | 3270 return false; |
3335 } | 3271 } |
3336 | 3272 |
3337 bool RenderObject::isRelayoutBoundaryForInspector() const | 3273 bool RenderObject::isRelayoutBoundaryForInspector() const |
3338 { | 3274 { |
3339 return objectIsRelayoutBoundary(this); | 3275 return objectIsRelayoutBoundary(this); |
3340 } | 3276 } |
3341 | 3277 |
3342 bool RenderObject::isRenderNamedFlowFragmentContainer() const | |
3343 { | |
3344 return isRenderBlockFlow() && toRenderBlockFlow(this)->renderNamedFlowFragme
nt(); | |
3345 } | |
3346 | |
3347 } // namespace WebCore | 3278 } // namespace WebCore |
3348 | 3279 |
3349 #ifndef NDEBUG | 3280 #ifndef NDEBUG |
3350 | 3281 |
3351 void showTree(const WebCore::RenderObject* object) | 3282 void showTree(const WebCore::RenderObject* object) |
3352 { | 3283 { |
3353 if (object) | 3284 if (object) |
3354 object->showTreeForThis(); | 3285 object->showTreeForThis(); |
3355 } | 3286 } |
3356 | 3287 |
(...skipping 12 matching lines...) Expand all Loading... |
3369 { | 3300 { |
3370 if (object1) { | 3301 if (object1) { |
3371 const WebCore::RenderObject* root = object1; | 3302 const WebCore::RenderObject* root = object1; |
3372 while (root->parent()) | 3303 while (root->parent()) |
3373 root = root->parent(); | 3304 root = root->parent(); |
3374 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3305 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3375 } | 3306 } |
3376 } | 3307 } |
3377 | 3308 |
3378 #endif | 3309 #endif |
OLD | NEW |