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 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1360 } | 1360 } |
1361 | 1361 |
1362 if (repaintContainer->hasFilter() && repaintContainer->layer() && repaintCon
tainer->layer()->requiresFullLayerImageForFilters()) { | 1362 if (repaintContainer->hasFilter() && repaintContainer->layer() && repaintCon
tainer->layer()->requiresFullLayerImageForFilters()) { |
1363 repaintContainer->layer()->setFilterBackendNeedsRepaintingInRect(r); | 1363 repaintContainer->layer()->setFilterBackendNeedsRepaintingInRect(r); |
1364 return; | 1364 return; |
1365 } | 1365 } |
1366 | 1366 |
1367 RenderView* v = view(); | 1367 RenderView* v = view(); |
1368 if (repaintContainer->isRenderView()) { | 1368 if (repaintContainer->isRenderView()) { |
1369 ASSERT(repaintContainer == v); | 1369 ASSERT(repaintContainer == v); |
1370 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->isComposited(
); | 1370 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->compositingSt
ate() == PaintsIntoOwnBacking; |
1371 if (!viewHasCompositedLayer) { | 1371 if (!viewHasCompositedLayer) { |
1372 IntRect repaintRectangle = r; | 1372 IntRect repaintRectangle = r; |
1373 if (viewHasCompositedLayer && v->layer()->transform()) | 1373 if (viewHasCompositedLayer && v->layer()->transform()) |
1374 repaintRectangle = v->layer()->transform()->mapRect(r); | 1374 repaintRectangle = v->layer()->transform()->mapRect(r); |
1375 v->repaintViewRectangle(repaintRectangle); | 1375 v->repaintViewRectangle(repaintRectangle); |
1376 return; | 1376 return; |
1377 } | 1377 } |
1378 } | 1378 } |
1379 | 1379 |
1380 if (v->usesCompositing()) { | 1380 if (v->usesCompositing()) { |
1381 ASSERT(repaintContainer->hasLayer() && repaintContainer->layer()->isComp
osited()); | 1381 ASSERT(repaintContainer->hasLayer() && repaintContainer->layer()->compos
itingState() == PaintsIntoOwnBacking); |
1382 repaintContainer->layer()->setBackingNeedsRepaintInRect(r); | 1382 repaintContainer->layer()->setBackingNeedsRepaintInRect(r); |
1383 } | 1383 } |
1384 } | 1384 } |
1385 | 1385 |
1386 void RenderObject::repaint() const | 1386 void RenderObject::repaint() const |
1387 { | 1387 { |
1388 // Don't repaint if we're unrooted (note that view() still returns the view
when unrooted) | 1388 // Don't repaint if we're unrooted (note that view() still returns the view
when unrooted) |
1389 RenderView* view; | 1389 RenderView* view; |
1390 if (!isRooted(&view)) | 1390 if (!isRooted(&view)) |
1391 return; | 1391 return; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1736 { | 1736 { |
1737 if (!isText() && style && !RuntimeEnabledFeatures::webAnimationsCSSEnabled()
) { | 1737 if (!isText() && style && !RuntimeEnabledFeatures::webAnimationsCSSEnabled()
) { |
1738 setStyle(animation()->updateAnimations(this, style.get())); | 1738 setStyle(animation()->updateAnimations(this, style.get())); |
1739 return; | 1739 return; |
1740 } | 1740 } |
1741 setStyle(style); | 1741 setStyle(style); |
1742 } | 1742 } |
1743 | 1743 |
1744 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
ed contextSensitiveProperties) const | 1744 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
ed contextSensitiveProperties) const |
1745 { | 1745 { |
1746 // If transform changed, and we are not composited, need to do a layout. | 1746 // If transform changed, and the layer does not paint into its own separate
backing, then we need to do a layout. |
| 1747 // FIXME: The comment above is what the code does, but it is technically not
following spec. This means we will |
| 1748 // not to layout for 3d transforms, but we should be invoking a simplified r
elayout. Is it possible we are avoiding |
| 1749 // doing this for some performance reason at this time? |
1747 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { | 1750 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { |
1748 // Text nodes share style with their parents but transforms don't apply
to them, | 1751 // Text nodes share style with their parents but transforms don't apply
to them, |
1749 // hence the !isText() check. | 1752 // hence the !isText() check. |
1750 // FIXME: when transforms are taken into account for overflow, we will n
eed to do a layout. | 1753 // FIXME: when transforms are taken into account for overflow, we will n
eed to do a layout. |
1751 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->isComposited())) { | 1754 if (!isText() && (!hasLayer() || toRenderLayerModelObject(this)->layer()
->compositingState() != PaintsIntoOwnBacking)) { |
1752 // We need to set at least SimplifiedLayout, but if PositionedMoveme
ntOnly is already set | 1755 // We need to set at least SimplifiedLayout, but if PositionedMoveme
ntOnly is already set |
1753 // then we actually need SimplifiedLayoutAndPositionedMovement. | 1756 // then we actually need SimplifiedLayoutAndPositionedMovement. |
1754 if (!hasLayer()) | 1757 if (!hasLayer()) |
1755 diff = StyleDifferenceLayout; // FIXME: Do this for now since Si
mplifiedLayout cannot handle updating floating objects lists. | 1758 diff = StyleDifferenceLayout; // FIXME: Do this for now since Si
mplifiedLayout cannot handle updating floating objects lists. |
1756 else if (diff < StyleDifferenceLayoutPositionedMovementOnly) | 1759 else if (diff < StyleDifferenceLayoutPositionedMovementOnly) |
1757 diff = StyleDifferenceSimplifiedLayout; | 1760 diff = StyleDifferenceSimplifiedLayout; |
1758 else if (diff < StyleDifferenceSimplifiedLayout) | 1761 else if (diff < StyleDifferenceSimplifiedLayout) |
1759 diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement; | 1762 diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement; |
1760 } else if (diff < StyleDifferenceRecompositeLayer) | 1763 } else if (diff < StyleDifferenceRecompositeLayer) |
1761 diff = StyleDifferenceRecompositeLayer; | 1764 diff = StyleDifferenceRecompositeLayer; |
1762 } | 1765 } |
1763 | 1766 |
1764 // If opacity changed, and we are not composited, need to repaint (also | 1767 // If opacity or filters changed, and the layer does not paint into its own
separate backing, then we need to repaint (also |
1765 // ignoring text nodes) | 1768 // ignoring text nodes) |
1766 if (contextSensitiveProperties & ContextSensitivePropertyOpacity) { | 1769 if (contextSensitiveProperties & ContextSensitivePropertyOpacity) { |
1767 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->isComposited())) | 1770 if (!isText() && (!hasLayer() || toRenderLayerModelObject(this)->layer()
->compositingState() != PaintsIntoOwnBacking)) |
1768 diff = StyleDifferenceRepaintLayer; | 1771 diff = StyleDifferenceRepaintLayer; |
1769 else if (diff < StyleDifferenceRecompositeLayer) | 1772 else if (diff < StyleDifferenceRecompositeLayer) |
1770 diff = StyleDifferenceRecompositeLayer; | 1773 diff = StyleDifferenceRecompositeLayer; |
1771 } | 1774 } |
1772 | |
1773 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye
r()) { | 1775 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye
r()) { |
1774 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); | 1776 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); |
1775 if (!layer->isComposited() || layer->paintsWithFilters()) | 1777 if (layer->compositingState() != PaintsIntoOwnBacking || layer->paintsWi
thFilters()) |
1776 diff = StyleDifferenceRepaintLayer; | 1778 diff = StyleDifferenceRepaintLayer; |
1777 else if (diff < StyleDifferenceRecompositeLayer) | 1779 else if (diff < StyleDifferenceRecompositeLayer) |
1778 diff = StyleDifferenceRecompositeLayer; | 1780 diff = StyleDifferenceRecompositeLayer; |
1779 } | 1781 } |
1780 | 1782 |
1781 // The answer to requiresLayer() for plugins, iframes, and canvas can change
without the actual | 1783 // The answer to requiresLayer() for plugins, iframes, and canvas can change
without the actual |
1782 // style changing, since it depends on whether we decide to composite these
elements. When the | 1784 // style changing, since it depends on whether we decide to composite these
elements. When the |
1783 // layer status of one of these elements changes, we need to force a layout. | 1785 // layer status of one of these elements changes, we need to force a layout. |
1784 if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) { | 1786 if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) { |
1785 if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer()) | 1787 if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer()) |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2726 void RenderObject::updateDragState(bool dragOn) | 2728 void RenderObject::updateDragState(bool dragOn) |
2727 { | 2729 { |
2728 bool valueChanged = (dragOn != isDragging()); | 2730 bool valueChanged = (dragOn != isDragging()); |
2729 setIsDragging(dragOn); | 2731 setIsDragging(dragOn); |
2730 if (valueChanged && node() && (style()->affectedByDrag() || (node()->isEleme
ntNode() && toElement(node())->childrenAffectedByDrag()))) | 2732 if (valueChanged && node() && (style()->affectedByDrag() || (node()->isEleme
ntNode() && toElement(node())->childrenAffectedByDrag()))) |
2731 node()->setNeedsStyleRecalc(); | 2733 node()->setNeedsStyleRecalc(); |
2732 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) | 2734 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) |
2733 curr->updateDragState(dragOn); | 2735 curr->updateDragState(dragOn); |
2734 } | 2736 } |
2735 | 2737 |
2736 bool RenderObject::isComposited() const | 2738 CompositingState RenderObject::compositingState() const |
2737 { | 2739 { |
2738 return hasLayer() && toRenderLayerModelObject(this)->layer()->isComposited()
; | 2740 return hasLayer() ? toRenderLayerModelObject(this)->layer()->compositingStat
e() : NotComposited; |
2739 } | 2741 } |
2740 | 2742 |
2741 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result,
const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse
t, HitTestFilter hitTestFilter) | 2743 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result,
const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse
t, HitTestFilter hitTestFilter) |
2742 { | 2744 { |
2743 bool inside = false; | 2745 bool inside = false; |
2744 if (hitTestFilter != HitTestSelf) { | 2746 if (hitTestFilter != HitTestSelf) { |
2745 // First test the foreground layer (lines and inlines). | 2747 // First test the foreground layer (lines and inlines). |
2746 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf
fset, HitTestForeground); | 2748 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf
fset, HitTestForeground); |
2747 | 2749 |
2748 // Test floats next. | 2750 // Test floats next. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3355 { | 3357 { |
3356 if (object1) { | 3358 if (object1) { |
3357 const WebCore::RenderObject* root = object1; | 3359 const WebCore::RenderObject* root = object1; |
3358 while (root->parent()) | 3360 while (root->parent()) |
3359 root = root->parent(); | 3361 root = root->parent(); |
3360 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3362 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3361 } | 3363 } |
3362 } | 3364 } |
3363 | 3365 |
3364 #endif | 3366 #endif |
OLD | NEW |