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 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 } | 1399 } |
1400 | 1400 |
1401 if (repaintContainer->hasFilter() && repaintContainer->layer() && repaintCon
tainer->layer()->requiresFullLayerImageForFilters()) { | 1401 if (repaintContainer->hasFilter() && repaintContainer->layer() && repaintCon
tainer->layer()->requiresFullLayerImageForFilters()) { |
1402 repaintContainer->layer()->setFilterBackendNeedsRepaintingInRect(r); | 1402 repaintContainer->layer()->setFilterBackendNeedsRepaintingInRect(r); |
1403 return; | 1403 return; |
1404 } | 1404 } |
1405 | 1405 |
1406 RenderView* v = view(); | 1406 RenderView* v = view(); |
1407 if (repaintContainer->isRenderView()) { | 1407 if (repaintContainer->isRenderView()) { |
1408 ASSERT(repaintContainer == v); | 1408 ASSERT(repaintContainer == v); |
1409 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->compositingSt
ate() == PaintsIntoOwnBacking; | 1409 bool viewHasCompositedLayer = v->hasLayer() && v->layer()->isComposited(
); |
1410 if (!viewHasCompositedLayer) { | 1410 if (!viewHasCompositedLayer) { |
1411 IntRect repaintRectangle = r; | 1411 IntRect repaintRectangle = r; |
1412 if (viewHasCompositedLayer && v->layer()->transform()) | 1412 if (viewHasCompositedLayer && v->layer()->transform()) |
1413 repaintRectangle = v->layer()->transform()->mapRect(r); | 1413 repaintRectangle = v->layer()->transform()->mapRect(r); |
1414 v->repaintViewRectangle(repaintRectangle); | 1414 v->repaintViewRectangle(repaintRectangle); |
1415 return; | 1415 return; |
1416 } | 1416 } |
1417 } | 1417 } |
1418 | 1418 |
1419 if (v->usesCompositing()) { | 1419 if (v->usesCompositing()) { |
1420 ASSERT(repaintContainer->hasLayer() && repaintContainer->layer()->compos
itingState() == PaintsIntoOwnBacking); | 1420 ASSERT(repaintContainer->hasLayer() && repaintContainer->layer()->isComp
osited()); |
1421 repaintContainer->layer()->setBackingNeedsRepaintInRect(r); | 1421 repaintContainer->layer()->setBackingNeedsRepaintInRect(r); |
1422 } | 1422 } |
1423 } | 1423 } |
1424 | 1424 |
1425 void RenderObject::repaint() const | 1425 void RenderObject::repaint() const |
1426 { | 1426 { |
1427 // Don't repaint if we're unrooted (note that view() still returns the view
when unrooted) | 1427 // Don't repaint if we're unrooted (note that view() still returns the view
when unrooted) |
1428 RenderView* view; | 1428 RenderView* view; |
1429 if (!isRooted(&view)) | 1429 if (!isRooted(&view)) |
1430 return; | 1430 return; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 { | 1775 { |
1776 if (!isText() && style && !RuntimeEnabledFeatures::webAnimationsCSSEnabled()
) { | 1776 if (!isText() && style && !RuntimeEnabledFeatures::webAnimationsCSSEnabled()
) { |
1777 setStyle(animation()->updateAnimations(this, style.get())); | 1777 setStyle(animation()->updateAnimations(this, style.get())); |
1778 return; | 1778 return; |
1779 } | 1779 } |
1780 setStyle(style); | 1780 setStyle(style); |
1781 } | 1781 } |
1782 | 1782 |
1783 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
ed contextSensitiveProperties) const | 1783 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign
ed contextSensitiveProperties) const |
1784 { | 1784 { |
1785 // If transform changed, and the layer does not paint into its own separate
backing, then we need to do a layout. | 1785 // If transform changed, and we are not composited, need to do a layout. |
1786 // FIXME: The comment above is what the code does, but it is technically not
following spec. This means we will | |
1787 // not to layout for 3d transforms, but we should be invoking a simplified r
elayout. Is it possible we are avoiding | |
1788 // doing this for some performance reason at this time? | |
1789 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { | 1786 if (contextSensitiveProperties & ContextSensitivePropertyTransform) { |
1790 // Text nodes share style with their parents but transforms don't apply
to them, | 1787 // Text nodes share style with their parents but transforms don't apply
to them, |
1791 // hence the !isText() check. | 1788 // hence the !isText() check. |
1792 // FIXME: when transforms are taken into account for overflow, we will n
eed to do a layout. | 1789 // FIXME: when transforms are taken into account for overflow, we will n
eed to do a layout. |
1793 if (!isText() && (!hasLayer() || toRenderLayerModelObject(this)->layer()
->compositingState() != PaintsIntoOwnBacking)) { | 1790 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->isComposited())) { |
1794 // We need to set at least SimplifiedLayout, but if PositionedMoveme
ntOnly is already set | 1791 // We need to set at least SimplifiedLayout, but if PositionedMoveme
ntOnly is already set |
1795 // then we actually need SimplifiedLayoutAndPositionedMovement. | 1792 // then we actually need SimplifiedLayoutAndPositionedMovement. |
1796 if (!hasLayer()) | 1793 if (!hasLayer()) |
1797 diff = StyleDifferenceLayout; // FIXME: Do this for now since Si
mplifiedLayout cannot handle updating floating objects lists. | 1794 diff = StyleDifferenceLayout; // FIXME: Do this for now since Si
mplifiedLayout cannot handle updating floating objects lists. |
1798 else if (diff < StyleDifferenceLayoutPositionedMovementOnly) | 1795 else if (diff < StyleDifferenceLayoutPositionedMovementOnly) |
1799 diff = StyleDifferenceSimplifiedLayout; | 1796 diff = StyleDifferenceSimplifiedLayout; |
1800 else if (diff < StyleDifferenceSimplifiedLayout) | 1797 else if (diff < StyleDifferenceSimplifiedLayout) |
1801 diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement; | 1798 diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement; |
1802 } else if (diff < StyleDifferenceRecompositeLayer) | 1799 } else if (diff < StyleDifferenceRecompositeLayer) |
1803 diff = StyleDifferenceRecompositeLayer; | 1800 diff = StyleDifferenceRecompositeLayer; |
1804 } | 1801 } |
1805 | 1802 |
1806 // If opacity or filters changed, and the layer does not paint into its own
separate backing, then we need to repaint (also | 1803 // If opacity changed, and we are not composited, need to repaint (also |
1807 // ignoring text nodes) | 1804 // ignoring text nodes) |
1808 if (contextSensitiveProperties & ContextSensitivePropertyOpacity) { | 1805 if (contextSensitiveProperties & ContextSensitivePropertyOpacity) { |
1809 if (!isText() && (!hasLayer() || toRenderLayerModelObject(this)->layer()
->compositingState() != PaintsIntoOwnBacking)) | 1806 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer(
)->isComposited())) |
1810 diff = StyleDifferenceRepaintLayer; | 1807 diff = StyleDifferenceRepaintLayer; |
1811 else if (diff < StyleDifferenceRecompositeLayer) | 1808 else if (diff < StyleDifferenceRecompositeLayer) |
1812 diff = StyleDifferenceRecompositeLayer; | 1809 diff = StyleDifferenceRecompositeLayer; |
1813 } | 1810 } |
| 1811 |
1814 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye
r()) { | 1812 if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLaye
r()) { |
1815 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); | 1813 RenderLayer* layer = toRenderLayerModelObject(this)->layer(); |
1816 if (layer->compositingState() != PaintsIntoOwnBacking || layer->paintsWi
thFilters()) | 1814 if (!layer->isComposited() || layer->paintsWithFilters()) |
1817 diff = StyleDifferenceRepaintLayer; | 1815 diff = StyleDifferenceRepaintLayer; |
1818 else if (diff < StyleDifferenceRecompositeLayer) | 1816 else if (diff < StyleDifferenceRecompositeLayer) |
1819 diff = StyleDifferenceRecompositeLayer; | 1817 diff = StyleDifferenceRecompositeLayer; |
1820 } | 1818 } |
1821 | 1819 |
1822 // The answer to requiresLayer() for plugins, iframes, and canvas can change
without the actual | 1820 // The answer to requiresLayer() for plugins, iframes, and canvas can change
without the actual |
1823 // style changing, since it depends on whether we decide to composite these
elements. When the | 1821 // style changing, since it depends on whether we decide to composite these
elements. When the |
1824 // layer status of one of these elements changes, we need to force a layout. | 1822 // layer status of one of these elements changes, we need to force a layout. |
1825 if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) { | 1823 if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) { |
1826 if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer()) | 1824 if (hasLayer() != toRenderLayerModelObject(this)->requiresLayer()) |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2768 void RenderObject::updateDragState(bool dragOn) | 2766 void RenderObject::updateDragState(bool dragOn) |
2769 { | 2767 { |
2770 bool valueChanged = (dragOn != isDragging()); | 2768 bool valueChanged = (dragOn != isDragging()); |
2771 setIsDragging(dragOn); | 2769 setIsDragging(dragOn); |
2772 if (valueChanged && node() && (style()->affectedByDrag() || (node()->isEleme
ntNode() && toElement(node())->childrenAffectedByDrag()))) | 2770 if (valueChanged && node() && (style()->affectedByDrag() || (node()->isEleme
ntNode() && toElement(node())->childrenAffectedByDrag()))) |
2773 node()->setNeedsStyleRecalc(); | 2771 node()->setNeedsStyleRecalc(); |
2774 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) | 2772 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling()) |
2775 curr->updateDragState(dragOn); | 2773 curr->updateDragState(dragOn); |
2776 } | 2774 } |
2777 | 2775 |
2778 CompositingState RenderObject::compositingState() const | 2776 bool RenderObject::isComposited() const |
2779 { | 2777 { |
2780 return hasLayer() ? toRenderLayerModelObject(this)->layer()->compositingStat
e() : NotComposited; | 2778 return hasLayer() && toRenderLayerModelObject(this)->layer()->isComposited()
; |
2781 } | 2779 } |
2782 | 2780 |
2783 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result,
const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse
t, HitTestFilter hitTestFilter) | 2781 bool RenderObject::hitTest(const HitTestRequest& request, HitTestResult& result,
const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffse
t, HitTestFilter hitTestFilter) |
2784 { | 2782 { |
2785 bool inside = false; | 2783 bool inside = false; |
2786 if (hitTestFilter != HitTestSelf) { | 2784 if (hitTestFilter != HitTestSelf) { |
2787 // First test the foreground layer (lines and inlines). | 2785 // First test the foreground layer (lines and inlines). |
2788 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf
fset, HitTestForeground); | 2786 inside = nodeAtPoint(request, result, locationInContainer, accumulatedOf
fset, HitTestForeground); |
2789 | 2787 |
2790 // Test floats next. | 2788 // Test floats next. |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3397 { | 3395 { |
3398 if (object1) { | 3396 if (object1) { |
3399 const WebCore::RenderObject* root = object1; | 3397 const WebCore::RenderObject* root = object1; |
3400 while (root->parent()) | 3398 while (root->parent()) |
3401 root = root->parent(); | 3399 root = root->parent(); |
3402 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3400 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3403 } | 3401 } |
3404 } | 3402 } |
3405 | 3403 |
3406 #endif | 3404 #endif |
OLD | NEW |