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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } else { | 331 } else { |
332 table = LayoutTable::createAnonymousWithParentRenderer(this); | 332 table = LayoutTable::createAnonymousWithParentRenderer(this); |
333 addChild(table, beforeChild); | 333 addChild(table, beforeChild); |
334 } | 334 } |
335 table->addChild(newChild); | 335 table->addChild(newChild); |
336 } else { | 336 } else { |
337 children->insertChildNode(this, newChild, beforeChild); | 337 children->insertChildNode(this, newChild, beforeChild); |
338 } | 338 } |
339 | 339 |
340 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE) | 340 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE) |
341 toRenderText(newChild)->transformText(); | 341 toLayoutText(newChild)->transformText(); |
342 | 342 |
343 // SVG creates renderers for <g display="none">, as SVG requires children of
hidden | 343 // SVG creates renderers for <g display="none">, as SVG requires children of
hidden |
344 // <g>s to have renderers - at least that's how our implementation works. Co
nsider: | 344 // <g>s to have renderers - at least that's how our implementation works. Co
nsider: |
345 // <g display="none"><foreignObject><body style="position: relative">FOO... | 345 // <g display="none"><foreignObject><body style="position: relative">FOO... |
346 // - layerTypeRequired() would return true for the <body>, creating a new La
yer | 346 // - layerTypeRequired() would return true for the <body>, creating a new La
yer |
347 // - when the document is painted, both layers are painted. The <body> layer
doesn't | 347 // - when the document is painted, both layers are painted. The <body> layer
doesn't |
348 // know that it's inside a "hidden SVG subtree", and thus paints, even if
it shouldn't. | 348 // know that it's inside a "hidden SVG subtree", and thus paints, even if
it shouldn't. |
349 // To avoid the problem alltogether, detect early if we're inside a hidden S
VG subtree | 349 // To avoid the problem alltogether, detect early if we're inside a hidden S
VG subtree |
350 // and stop creating layers at all for these cases - they're not used anyway
s. | 350 // and stop creating layers at all for these cases - they're not used anyway
s. |
351 if (newChild->hasLayer() && !layerCreationAllowedForSubtree()) | 351 if (newChild->hasLayer() && !layerCreationAllowedForSubtree()) |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 | 1427 |
1428 void LayoutObject::showLayoutObject() const | 1428 void LayoutObject::showLayoutObject() const |
1429 { | 1429 { |
1430 showLayoutObject(0); | 1430 showLayoutObject(0); |
1431 } | 1431 } |
1432 | 1432 |
1433 void LayoutObject::showLayoutObject(int printedCharacters) const | 1433 void LayoutObject::showLayoutObject(int printedCharacters) const |
1434 { | 1434 { |
1435 printedCharacters += fprintf(stderr, "%s %p", renderName(), this); | 1435 printedCharacters += fprintf(stderr, "%s %p", renderName(), this); |
1436 | 1436 |
1437 if (isText() && toRenderText(this)->isTextFragment()) | 1437 if (isText() && toLayoutText(this)->isTextFragment()) |
1438 printedCharacters += fprintf(stderr, " \"%s\" ", toRenderText(this)->tex
t().ascii().data()); | 1438 printedCharacters += fprintf(stderr, " \"%s\" ", toLayoutText(this)->tex
t().ascii().data()); |
1439 | 1439 |
1440 if (node()) { | 1440 if (node()) { |
1441 if (printedCharacters) | 1441 if (printedCharacters) |
1442 for (; printedCharacters < showTreeCharacterOffset; printedCharacter
s++) | 1442 for (; printedCharacters < showTreeCharacterOffset; printedCharacter
s++) |
1443 fputc(' ', stderr); | 1443 fputc(' ', stderr); |
1444 fputc('\t', stderr); | 1444 fputc('\t', stderr); |
1445 node()->showNode(); | 1445 node()->showNode(); |
1446 } else { | 1446 } else { |
1447 fputc('\n', stderr); | 1447 fputc('\n', stderr); |
1448 } | 1448 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 | 1555 |
1556 // If filter changed, and the layer does not paint into its own separate bac
king or it paints with filters, then we need to invalidate paints. | 1556 // If filter changed, and the layer does not paint into its own separate bac
king or it paints with filters, then we need to invalidate paints. |
1557 if (diff.filterChanged() && hasLayer()) { | 1557 if (diff.filterChanged() && hasLayer()) { |
1558 Layer* layer = toLayoutBoxModelObject(this)->layer(); | 1558 Layer* layer = toLayoutBoxModelObject(this)->layer(); |
1559 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint
sWithFilters()) | 1559 if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paint
sWithFilters()) |
1560 diff.setNeedsPaintInvalidationLayer(); | 1560 diff.setNeedsPaintInvalidationLayer(); |
1561 } | 1561 } |
1562 | 1562 |
1563 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation()) { | 1563 if (diff.textOrColorChanged() && !diff.needsPaintInvalidation()) { |
1564 if (style()->hasBorder() || style()->hasOutline() | 1564 if (style()->hasBorder() || style()->hasOutline() |
1565 || (isText() && !toRenderText(this)->isAllCollapsibleWhitespace())) | 1565 || (isText() && !toLayoutText(this)->isAllCollapsibleWhitespace())) |
1566 diff.setNeedsPaintInvalidationObject(); | 1566 diff.setNeedsPaintInvalidationObject(); |
1567 } | 1567 } |
1568 | 1568 |
1569 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch
ange without the actual | 1569 // The answer to layerTypeRequired() for plugins, iframes, and canvas can ch
ange without the actual |
1570 // style changing, since it depends on whether we decide to composite these
elements. When the | 1570 // style changing, since it depends on whether we decide to composite these
elements. When the |
1571 // layer status of one of these elements changes, we need to force a layout. | 1571 // layer status of one of these elements changes, we need to force a layout. |
1572 if (!diff.needsFullLayout() && style() && isLayoutBoxModelObject()) { | 1572 if (!diff.needsFullLayout() && style() && isLayoutBoxModelObject()) { |
1573 bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() !
= NoLayer; | 1573 bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() !
= NoLayer; |
1574 if (hasLayer() != requiresLayer) | 1574 if (hasLayer() != requiresLayer) |
1575 diff.setNeedsFullLayout(); | 1575 diff.setNeedsFullLayout(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 | 1648 |
1649 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderI
mage().image()); | 1649 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style->borderI
mage().image()); |
1650 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBo
xImage().image()); | 1650 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style->maskBo
xImage().image()); |
1651 | 1651 |
1652 updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOuts
ide()); | 1652 updateShapeImage(oldStyle ? oldStyle->shapeOutside() : 0, m_style->shapeOuts
ide()); |
1653 | 1653 |
1654 bool doesNotNeedLayoutOrPaintInvalidation = !m_parent; | 1654 bool doesNotNeedLayoutOrPaintInvalidation = !m_parent; |
1655 | 1655 |
1656 styleDidChange(diff, oldStyle.get()); | 1656 styleDidChange(diff, oldStyle.get()); |
1657 | 1657 |
1658 // FIXME: |this| might be destroyed here. This can currently happen for a Re
nderTextFragment when | 1658 // FIXME: |this| might be destroyed here. This can currently happen for a La
youtTextFragment when |
1659 // its first-letter block gets an update in RenderTextFragment::styleDidChan
ge. For RenderTextFragment(s), | 1659 // its first-letter block gets an update in LayoutTextFragment::styleDidChan
ge. For LayoutTextFragment(s), |
1660 // we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation fla
g. We might want to broaden | 1660 // we will safely bail out with the doesNotNeedLayoutOrPaintInvalidation fla
g. We might want to broaden |
1661 // this condition in the future as we move renderer changes out of layout an
d into style changes. | 1661 // this condition in the future as we move renderer changes out of layout an
d into style changes. |
1662 if (doesNotNeedLayoutOrPaintInvalidation) | 1662 if (doesNotNeedLayoutOrPaintInvalidation) |
1663 return; | 1663 return; |
1664 | 1664 |
1665 // Now that the layer (if any) has been updated, we need to adjust the diff
again, | 1665 // Now that the layer (if any) has been updated, we need to adjust the diff
again, |
1666 // check whether we should layout now, and decide if we need to invalidate p
aints. | 1666 // check whether we should layout now, and decide if we need to invalidate p
aints. |
1667 StyleDifference updatedDiff = adjustStyleDifference(diff); | 1667 StyleDifference updatedDiff = adjustStyleDifference(diff); |
1668 | 1668 |
1669 if (!diff.needsFullLayout()) { | 1669 if (!diff.needsFullLayout()) { |
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3189 { | 3189 { |
3190 if (object1) { | 3190 if (object1) { |
3191 const blink::LayoutObject* root = object1; | 3191 const blink::LayoutObject* root = object1; |
3192 while (root->parent()) | 3192 while (root->parent()) |
3193 root = root->parent(); | 3193 root = root->parent(); |
3194 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3194 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3195 } | 3195 } |
3196 } | 3196 } |
3197 | 3197 |
3198 #endif | 3198 #endif |
OLD | NEW |