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. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 9 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
10 * (http://www.torchmobile.com/) | 10 * (http://www.torchmobile.com/) |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } else { | 319 } else { |
320 table = LayoutTable::createAnonymousWithParent(this); | 320 table = LayoutTable::createAnonymousWithParent(this); |
321 children->insertChildNode(this, table, beforeChild); | 321 children->insertChildNode(this, table, beforeChild); |
322 } | 322 } |
323 table->addChild(newChild); | 323 table->addChild(newChild); |
324 } else { | 324 } else { |
325 children->insertChildNode(this, newChild, beforeChild); | 325 children->insertChildNode(this, newChild, beforeChild); |
326 } | 326 } |
327 | 327 |
328 if (newChild->isText() && | 328 if (newChild->isText() && |
329 newChild->style()->textTransform() == ETextTransform::Capitalize) | 329 newChild->style()->textTransform() == ETextTransform::kCapitalize) |
330 toLayoutText(newChild)->transformText(); | 330 toLayoutText(newChild)->transformText(); |
331 | 331 |
332 // SVG creates layoutObjects for <g display="none">, as SVG requires children | 332 // SVG creates layoutObjects for <g display="none">, as SVG requires children |
333 // of hidden <g>s to have layoutObjects - at least that's how our | 333 // of hidden <g>s to have layoutObjects - at least that's how our |
334 // implementation works. | 334 // implementation works. |
335 // Consider: | 335 // Consider: |
336 // <g display="none"><foreignObject><body style="position: relative">FOO... | 336 // <g display="none"><foreignObject><body style="position: relative">FOO... |
337 // - layerTypeRequired() would return true for the <body>, creating a new | 337 // - layerTypeRequired() would return true for the <body>, creating a new |
338 // Layer | 338 // Layer |
339 // - when the document is painted, both layers are painted. The <body> layer | 339 // - when the document is painted, both layers are painted. The <body> layer |
(...skipping 2312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2652 // don't have any children and don't have a layer attached to ourselves. | 2652 // don't have any children and don't have a layer attached to ourselves. |
2653 PaintLayer* layer = nullptr; | 2653 PaintLayer* layer = nullptr; |
2654 if (slowFirstChild() || hasLayer()) { | 2654 if (slowFirstChild() || hasLayer()) { |
2655 layer = parent()->enclosingLayer(); | 2655 layer = parent()->enclosingLayer(); |
2656 addLayers(layer); | 2656 addLayers(layer); |
2657 } | 2657 } |
2658 | 2658 |
2659 // If |this| is visible but this object was not, tell the layer it has some | 2659 // If |this| is visible but this object was not, tell the layer it has some |
2660 // visible content that needs to be drawn and layer visibility optimization | 2660 // visible content that needs to be drawn and layer visibility optimization |
2661 // can't be used | 2661 // can't be used |
2662 if (parent()->style()->visibility() != EVisibility::Visible && | 2662 if (parent()->style()->visibility() != EVisibility::kVisible && |
2663 style()->visibility() == EVisibility::Visible && !hasLayer()) { | 2663 style()->visibility() == EVisibility::kVisible && !hasLayer()) { |
2664 if (!layer) | 2664 if (!layer) |
2665 layer = parent()->enclosingLayer(); | 2665 layer = parent()->enclosingLayer(); |
2666 if (layer) | 2666 if (layer) |
2667 layer->dirtyVisibleContentStatus(); | 2667 layer->dirtyVisibleContentStatus(); |
2668 } | 2668 } |
2669 | 2669 |
2670 if (parent()->childrenInline()) | 2670 if (parent()->childrenInline()) |
2671 parent()->dirtyLinesFromChangedChild(this); | 2671 parent()->dirtyLinesFromChangedChild(this); |
2672 | 2672 |
2673 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) | 2673 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2711 return found; | 2711 return found; |
2712 } | 2712 } |
2713 | 2713 |
2714 void LayoutObject::willBeRemovedFromTree() { | 2714 void LayoutObject::willBeRemovedFromTree() { |
2715 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removals | 2715 // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removals |
2716 // which would need to be fixed first. | 2716 // which would need to be fixed first. |
2717 | 2717 |
2718 // If we remove a visible child from an invisible parent, we don't know the | 2718 // If we remove a visible child from an invisible parent, we don't know the |
2719 // layer visibility any more. | 2719 // layer visibility any more. |
2720 PaintLayer* layer = nullptr; | 2720 PaintLayer* layer = nullptr; |
2721 if (parent()->style()->visibility() != EVisibility::Visible && | 2721 if (parent()->style()->visibility() != EVisibility::kVisible && |
2722 style()->visibility() == EVisibility::Visible && !hasLayer()) { | 2722 style()->visibility() == EVisibility::kVisible && !hasLayer()) { |
2723 layer = parent()->enclosingLayer(); | 2723 layer = parent()->enclosingLayer(); |
2724 if (layer) | 2724 if (layer) |
2725 layer->dirtyVisibleContentStatus(); | 2725 layer->dirtyVisibleContentStatus(); |
2726 } | 2726 } |
2727 | 2727 |
2728 // Keep our layer hierarchy updated. | 2728 // Keep our layer hierarchy updated. |
2729 if (slowFirstChild() || hasLayer()) { | 2729 if (slowFirstChild() || hasLayer()) { |
2730 if (!layer) | 2730 if (!layer) |
2731 layer = parent()->enclosingLayer(); | 2731 layer = parent()->enclosingLayer(); |
2732 removeLayers(layer); | 2732 removeLayers(layer); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 PseudoStyleRequest(PseudoIdSelection)); | 3092 PseudoStyleRequest(PseudoIdSelection)); |
3093 } | 3093 } |
3094 } | 3094 } |
3095 } | 3095 } |
3096 | 3096 |
3097 return getUncachedPseudoStyle(PseudoStyleRequest(PseudoIdSelection)); | 3097 return getUncachedPseudoStyle(PseudoStyleRequest(PseudoIdSelection)); |
3098 } | 3098 } |
3099 | 3099 |
3100 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) { | 3100 void LayoutObject::addAnnotatedRegions(Vector<AnnotatedRegionValue>& regions) { |
3101 // Convert the style regions to absolute coordinates. | 3101 // Convert the style regions to absolute coordinates. |
3102 if (style()->visibility() != EVisibility::Visible || !isBox()) | 3102 if (style()->visibility() != EVisibility::kVisible || !isBox()) |
3103 return; | 3103 return; |
3104 | 3104 |
3105 if (style()->getDraggableRegionMode() == DraggableRegionNone) | 3105 if (style()->getDraggableRegionMode() == DraggableRegionNone) |
3106 return; | 3106 return; |
3107 | 3107 |
3108 LayoutBox* box = toLayoutBox(this); | 3108 LayoutBox* box = toLayoutBox(this); |
3109 FloatRect localBounds(FloatPoint(), FloatSize(box->size())); | 3109 FloatRect localBounds(FloatPoint(), FloatSize(box->size())); |
3110 FloatRect absBounds = localToAbsoluteQuad(localBounds).boundingBox(); | 3110 FloatRect absBounds = localToAbsoluteQuad(localBounds).boundingBox(); |
3111 | 3111 |
3112 AnnotatedRegionValue region; | 3112 AnnotatedRegionValue region; |
3113 region.draggable = style()->getDraggableRegionMode() == DraggableRegionDrag; | 3113 region.draggable = style()->getDraggableRegionMode() == DraggableRegionDrag; |
3114 region.bounds = LayoutRect(absBounds); | 3114 region.bounds = LayoutRect(absBounds); |
3115 regions.append(region); | 3115 regions.append(region); |
3116 } | 3116 } |
3117 | 3117 |
3118 bool LayoutObject::willRenderImage() { | 3118 bool LayoutObject::willRenderImage() { |
3119 // Without visibility we won't render (and therefore don't care about | 3119 // Without visibility we won't render (and therefore don't care about |
3120 // animation). | 3120 // animation). |
3121 if (style()->visibility() != EVisibility::Visible) | 3121 if (style()->visibility() != EVisibility::kVisible) |
3122 return false; | 3122 return false; |
3123 | 3123 |
3124 // We will not render a new image when SuspendableObjects is suspended | 3124 // We will not render a new image when SuspendableObjects is suspended |
3125 if (document().isContextSuspended()) | 3125 if (document().isContextSuspended()) |
3126 return false; | 3126 return false; |
3127 | 3127 |
3128 // If we're not in a window (i.e., we're dormant from being in a background | 3128 // If we're not in a window (i.e., we're dormant from being in a background |
3129 // tab) then we don't want to render either. | 3129 // tab) then we don't want to render either. |
3130 return document().view()->isVisible(); | 3130 return document().view()->isVisible(); |
3131 } | 3131 } |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3519 const blink::LayoutObject* root = object1; | 3519 const blink::LayoutObject* root = object1; |
3520 while (root->parent()) | 3520 while (root->parent()) |
3521 root = root->parent(); | 3521 root = root->parent(); |
3522 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); | 3522 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); |
3523 } else { | 3523 } else { |
3524 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); | 3524 WTFLogAlways("%s", "Cannot showLayoutTree. Root is (nil)"); |
3525 } | 3525 } |
3526 } | 3526 } |
3527 | 3527 |
3528 #endif | 3528 #endif |
OLD | NEW |