LEFT | RIGHT |
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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005-2010, 2015 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005-2010, 2015 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 Color bgColor = style().visitedDependentColorWithColorFilter(CSSProperty
BackgroundColor); | 1496 Color bgColor = style().visitedDependentColorWithColorFilter(CSSProperty
BackgroundColor); |
1497 if (bgColor.isOpaque()) | 1497 if (bgColor.isOpaque()) |
1498 return true; | 1498 return true; |
1499 } | 1499 } |
1500 | 1500 |
1501 return false; | 1501 return false; |
1502 } | 1502 } |
1503 | 1503 |
1504 void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 1504 void RenderBox::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
1505 { | 1505 { |
1506 if (!paintInfo.shouldPaintWithinRoot(*this) || style().visibility() != Visib
ility::Visible || paintInfo.phase != PaintPhaseMask || paintInfo.context().paint
ingDisabled()) | 1506 if (!paintInfo.shouldPaintWithinRoot(*this) || style().visibility() != Visib
ility::Visible || paintInfo.phase != PaintPhase::Mask || paintInfo.context().pai
ntingDisabled()) |
1507 return; | 1507 return; |
1508 | 1508 |
1509 LayoutRect paintRect = LayoutRect(paintOffset, size()); | 1509 LayoutRect paintRect = LayoutRect(paintOffset, size()); |
1510 adjustBorderBoxRectForPainting(paintRect); | 1510 adjustBorderBoxRectForPainting(paintRect); |
1511 paintMaskImages(paintInfo, paintRect); | 1511 paintMaskImages(paintInfo, paintRect); |
1512 } | 1512 } |
1513 | 1513 |
1514 void RenderBox::paintClippingMask(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) | 1514 void RenderBox::paintClippingMask(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) |
1515 { | 1515 { |
1516 if (!paintInfo.shouldPaintWithinRoot(*this) || style().visibility() != Visib
ility::Visible || paintInfo.phase != PaintPhaseClippingMask || paintInfo.context
().paintingDisabled()) | 1516 if (!paintInfo.shouldPaintWithinRoot(*this) || style().visibility() != Visib
ility::Visible || paintInfo.phase != PaintPhase::ClippingMask || paintInfo.conte
xt().paintingDisabled()) |
1517 return; | 1517 return; |
1518 | 1518 |
1519 LayoutRect paintRect = LayoutRect(paintOffset, size()); | 1519 LayoutRect paintRect = LayoutRect(paintOffset, size()); |
1520 paintInfo.context().fillRect(snappedIntRect(paintRect), Color::black); | 1520 paintInfo.context().fillRect(snappedIntRect(paintRect), Color::black); |
1521 } | 1521 } |
1522 | 1522 |
1523 void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& pa
intRect) | 1523 void RenderBox::paintMaskImages(const PaintInfo& paintInfo, const LayoutRect& pa
intRect) |
1524 { | 1524 { |
1525 // Figure out if we need to push a transparency layer to render our mask. | 1525 // Figure out if we need to push a transparency layer to render our mask. |
1526 bool pushTransparencyLayer = false; | 1526 bool pushTransparencyLayer = false; |
1527 bool compositedMask = hasLayer() && layer()->hasCompositedMask(); | 1527 bool compositedMask = hasLayer() && layer()->hasCompositedMask(); |
1528 bool flattenCompositingLayers = paintInfo.paintBehavior & PaintBehaviorFlatt
enCompositingLayers; | 1528 bool flattenCompositingLayers = paintInfo.paintBehavior.contains(PaintBehavi
or::FlattenCompositingLayers); |
1529 CompositeOperator compositeOp = CompositeSourceOver; | 1529 CompositeOperator compositeOp = CompositeSourceOver; |
1530 | 1530 |
1531 bool allMaskImagesLoaded = true; | 1531 bool allMaskImagesLoaded = true; |
1532 ···· | 1532 ···· |
1533 if (!compositedMask || flattenCompositingLayers) { | 1533 if (!compositedMask || flattenCompositingLayers) { |
1534 pushTransparencyLayer = true; | 1534 pushTransparencyLayer = true; |
1535 | 1535 |
1536 // Don't render a masked element until all the mask images have loaded,
to prevent a flash of unmasked content. | 1536 // Don't render a masked element until all the mask images have loaded,
to prevent a flash of unmasked content. |
1537 if (auto* maskBoxImage = style().maskBoxImage().image()) | 1537 if (auto* maskBoxImage = style().maskBoxImage().image()) |
1538 allMaskImagesLoaded &= maskBoxImage->isLoaded(); | 1538 allMaskImagesLoaded &= maskBoxImage->isLoaded(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 | 1577 |
1578 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& color,
const FillLayer& fillLayer, const LayoutRect& rect, | 1578 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& color,
const FillLayer& fillLayer, const LayoutRect& rect, |
1579 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderElement
* backgroundObject) | 1579 BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderElement
* backgroundObject) |
1580 { | 1580 { |
1581 Vector<const FillLayer*, 8> layers; | 1581 Vector<const FillLayer*, 8> layers; |
1582 bool shouldDrawBackgroundInSeparateBuffer = false; | 1582 bool shouldDrawBackgroundInSeparateBuffer = false; |
1583 | 1583 |
1584 for (auto* layer = &fillLayer; layer; layer = layer->next()) { | 1584 for (auto* layer = &fillLayer; layer; layer = layer->next()) { |
1585 layers.append(layer); | 1585 layers.append(layer); |
1586 | 1586 |
1587 if (layer->blendMode() != BlendModeNormal) | 1587 if (layer->blendMode() != BlendMode::Normal) |
1588 shouldDrawBackgroundInSeparateBuffer = true; | 1588 shouldDrawBackgroundInSeparateBuffer = true; |
1589 | 1589 |
1590 // Stop traversal when an opaque layer is encountered. | 1590 // Stop traversal when an opaque layer is encountered. |
1591 // FIXME: It would be possible for the following occlusion culling test
to be more aggressive | 1591 // FIXME: It would be possible for the following occlusion culling test
to be more aggressive |
1592 // on layers with no repeat by testing whether the image covers the layo
ut rect. | 1592 // on layers with no repeat by testing whether the image covers the layo
ut rect. |
1593 // Testing that here would imply duplicating a lot of calculations that
are currently done in | 1593 // Testing that here would imply duplicating a lot of calculations that
are currently done in |
1594 // RenderBoxModelObject::paintFillLayerExtended. A more efficient soluti
on might be to move | 1594 // RenderBoxModelObject::paintFillLayerExtended. A more efficient soluti
on might be to move |
1595 // the layer recursion into paintFillLayerExtended, or to compute the la
yer geometry here | 1595 // the layer recursion into paintFillLayerExtended, or to compute the la
yer geometry here |
1596 // and pass it down. | 1596 // and pass it down. |
1597 | 1597 |
1598 // The clipOccludesNextLayers condition must be evaluated first to avoid
short-circuiting. | 1598 // The clipOccludesNextLayers condition must be evaluated first to avoid
short-circuiting. |
1599 if (layer->clipOccludesNextLayers(layer == &fillLayer) && layer->hasOpaq
ueImage(*this) && layer->image()->canRender(this, style().effectiveZoom()) && la
yer->hasRepeatXY() && layer->blendMode() == BlendModeNormal) | 1599 if (layer->clipOccludesNextLayers(layer == &fillLayer) && layer->hasOpaq
ueImage(*this) && layer->image()->canRender(this, style().effectiveZoom()) && la
yer->hasRepeatXY() && layer->blendMode() == BlendMode::Normal) |
1600 break; | 1600 break; |
1601 } | 1601 } |
1602 | 1602 |
1603 auto& context = paintInfo.context(); | 1603 auto& context = paintInfo.context(); |
1604 auto baseBgColorUsage = BaseBackgroundColorUse; | 1604 auto baseBgColorUsage = BaseBackgroundColorUse; |
1605 | 1605 |
1606 if (shouldDrawBackgroundInSeparateBuffer) { | 1606 if (shouldDrawBackgroundInSeparateBuffer) { |
1607 paintFillLayer(paintInfo, color, *layers.last(), rect, bleedAvoidance, o
p, backgroundObject, BaseBackgroundColorOnly); | 1607 paintFillLayer(paintInfo, color, *layers.last(), rect, bleedAvoidance, o
p, backgroundObject, BaseBackgroundColorOnly); |
1608 baseBgColorUsage = BaseBackgroundColorSkip; | 1608 baseBgColorUsage = BaseBackgroundColorSkip; |
1609 context.beginTransparencyLayer(1); | 1609 context.beginTransparencyLayer(1); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 layerRenderer->repaintRectangle(rectToRepaint, shouldClipToLayer); | 1718 layerRenderer->repaintRectangle(rectToRepaint, shouldClipToLayer); |
1719 if (geometry.destRect() == rendererRect) | 1719 if (geometry.destRect() == rendererRect) |
1720 return true; | 1720 return true; |
1721 } | 1721 } |
1722 } | 1722 } |
1723 return false; | 1723 return false; |
1724 } | 1724 } |
1725 | 1725 |
1726 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
latedOffset) | 1726 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
latedOffset) |
1727 { | 1727 { |
1728 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint
PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) | 1728 if (paintInfo.phase == PaintPhase::BlockBackground || paintInfo.phase == Pai
ntPhase::SelfOutline || paintInfo.phase == PaintPhase::Mask) |
1729 return false; | 1729 return false; |
1730 | 1730 |
1731 bool isControlClip = hasControlClip(); | 1731 bool isControlClip = hasControlClip(); |
1732 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); | 1732 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); |
1733 ···· | 1733 ···· |
1734 if (!isControlClip && !isOverflowClip) | 1734 if (!isControlClip && !isOverflowClip) |
1735 return false; | 1735 return false; |
1736 ···· | 1736 ···· |
1737 if (paintInfo.phase == PaintPhaseOutline) | 1737 if (paintInfo.phase == PaintPhase::Outline) |
1738 paintInfo.phase = PaintPhaseChildOutlines; | 1738 paintInfo.phase = PaintPhase::ChildOutlines; |
1739 else if (paintInfo.phase == PaintPhaseChildBlockBackground) { | 1739 else if (paintInfo.phase == PaintPhase::ChildBlockBackground) { |
1740 paintInfo.phase = PaintPhaseBlockBackground; | 1740 paintInfo.phase = PaintPhase::BlockBackground; |
1741 paintObject(paintInfo, accumulatedOffset); | 1741 paintObject(paintInfo, accumulatedOffset); |
1742 paintInfo.phase = PaintPhaseChildBlockBackgrounds; | 1742 paintInfo.phase = PaintPhase::ChildBlockBackgrounds; |
1743 } | 1743 } |
1744 float deviceScaleFactor = document().deviceScaleFactor(); | 1744 float deviceScaleFactor = document().deviceScaleFactor(); |
1745 FloatRect clipRect = snapRectToDevicePixels((isControlClip ? controlClipRect
(accumulatedOffset) : overflowClipRect(accumulatedOffset, nullptr, IgnoreOverlay
ScrollbarSize, paintInfo.phase)), deviceScaleFactor); | 1745 FloatRect clipRect = snapRectToDevicePixels((isControlClip ? controlClipRect
(accumulatedOffset) : overflowClipRect(accumulatedOffset, nullptr, IgnoreOverlay
ScrollbarSize, paintInfo.phase)), deviceScaleFactor); |
1746 paintInfo.context().save(); | 1746 paintInfo.context().save(); |
1747 if (style().hasBorderRadius()) | 1747 if (style().hasBorderRadius()) |
1748 paintInfo.context().clipRoundedRect(style().getRoundedInnerBorderFor(Lay
outRect(accumulatedOffset, size())).pixelSnappedRoundedRectForPainting(deviceSca
leFactor)); | 1748 paintInfo.context().clipRoundedRect(style().getRoundedInnerBorderFor(Lay
outRect(accumulatedOffset, size())).pixelSnappedRoundedRectForPainting(deviceSca
leFactor)); |
1749 paintInfo.context().clip(clipRect); | 1749 paintInfo.context().clip(clipRect); |
1750 return true; | 1750 return true; |
1751 } | 1751 } |
1752 | 1752 |
1753 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
const LayoutPoint& accumulatedOffset) | 1753 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
const LayoutPoint& accumulatedOffset) |
1754 { | 1754 { |
1755 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay
er())); | 1755 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay
er())); |
1756 | 1756 |
1757 paintInfo.context().restore(); | 1757 paintInfo.context().restore(); |
1758 if (originalPhase == PaintPhaseOutline) { | 1758 if (originalPhase == PaintPhase::Outline) { |
1759 paintInfo.phase = PaintPhaseSelfOutline; | 1759 paintInfo.phase = PaintPhase::SelfOutline; |
1760 paintObject(paintInfo, accumulatedOffset); | 1760 paintObject(paintInfo, accumulatedOffset); |
1761 paintInfo.phase = originalPhase; | 1761 paintInfo.phase = originalPhase; |
1762 } else if (originalPhase == PaintPhaseChildBlockBackground) | 1762 } else if (originalPhase == PaintPhase::ChildBlockBackground) |
1763 paintInfo.phase = originalPhase; | 1763 paintInfo.phase = originalPhase; |
1764 } | 1764 } |
1765 | 1765 |
1766 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderFragme
ntContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase) | 1766 LayoutRect RenderBox::overflowClipRect(const LayoutPoint& location, RenderFragme
ntContainer* fragment, OverlayScrollbarSizeRelevancy relevancy, PaintPhase) |
1767 { | 1767 { |
1768 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert
y | 1768 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert
y |
1769 // here. | 1769 // here. |
1770 LayoutRect clipRect = borderBoxRectInFragment(fragment); | 1770 LayoutRect clipRect = borderBoxRectInFragment(fragment); |
1771 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); | 1771 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); |
1772 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); | 1772 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); |
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4940 return &candidate; | 4940 return &candidate; |
4941 } | 4941 } |
4942 // If all parent elements are not overflow scrollable, check the body. | 4942 // If all parent elements are not overflow scrollable, check the body. |
4943 if (document().body() && frame().mainFrame().view() && frame().mainFrame().v
iew()->isScrollable()) | 4943 if (document().body() && frame().mainFrame().view() && frame().mainFrame().v
iew()->isScrollable()) |
4944 return document().body()->renderBox(); | 4944 return document().body()->renderBox(); |
4945 ···· | 4945 ···· |
4946 return nullptr; | 4946 return nullptr; |
4947 } | 4947 } |
4948 | 4948 |
4949 } // namespace WebCore | 4949 } // namespace WebCore |
LEFT | RIGHT |