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