summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp')
-rw-r--r--Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp79
1 files changed, 40 insertions, 39 deletions
diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
index 4ab82952b..b31f0211c 100644
--- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
+++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006 Apple Inc.
* Copyright (C) 2009 Google, Inc.
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
*
@@ -20,8 +20,6 @@
*/
#include "config.h"
-
-#if ENABLE(SVG)
#include "RenderSVGForeignObject.h"
#include "GraphicsContext.h"
@@ -33,14 +31,13 @@
#include "SVGForeignObjectElement.h"
#include "SVGRenderingContext.h"
#include "SVGResourcesCache.h"
-#include "SVGSVGElement.h"
#include "TransformState.h"
#include <wtf/StackStats.h>
namespace WebCore {
-RenderSVGForeignObject::RenderSVGForeignObject(SVGForeignObjectElement& element, PassRef<RenderStyle> style)
- : RenderSVGBlock(element, std::move(style))
+RenderSVGForeignObject::RenderSVGForeignObject(SVGForeignObjectElement& element, RenderStyle&& style)
+ : RenderSVGBlock(element, WTFMove(style))
, m_needsTransformUpdate(true)
{
}
@@ -51,47 +48,49 @@ RenderSVGForeignObject::~RenderSVGForeignObject()
SVGForeignObjectElement& RenderSVGForeignObject::foreignObjectElement() const
{
- return toSVGForeignObjectElement(RenderSVGBlock::graphicsElement());
+ return downcast<SVGForeignObjectElement>(RenderSVGBlock::graphicsElement());
}
void RenderSVGForeignObject::paint(PaintInfo& paintInfo, const LayoutPoint&)
{
- if (paintInfo.context->paintingDisabled()
- || (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection))
+ if (paintInfo.context().paintingDisabled())
+ return;
+
+ if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection)
return;
PaintInfo childPaintInfo(paintInfo);
- GraphicsContextStateSaver stateSaver(*childPaintInfo.context);
+ GraphicsContextStateSaver stateSaver(childPaintInfo.context());
childPaintInfo.applyTransform(localTransform());
if (SVGRenderSupport::isOverflowHidden(*this))
- childPaintInfo.context->clip(m_viewport);
+ childPaintInfo.context().clip(m_viewport);
SVGRenderingContext renderingContext;
- bool continueRendering = true;
if (paintInfo.phase == PaintPhaseForeground) {
renderingContext.prepareToRenderSVGContent(*this, childPaintInfo);
- continueRendering = renderingContext.isRenderingPrepared();
+ if (!renderingContext.isRenderingPrepared())
+ return;
}
- if (continueRendering) {
- // Paint all phases of FO elements atomically, as though the FO element established its
- // own stacking context.
- bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.phase == PaintPhaseTextClip;
- LayoutPoint childPoint = IntPoint();
- childPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
- RenderBlock::paint(childPaintInfo, IntPoint());
- if (!preservePhase) {
- childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
- RenderBlock::paint(childPaintInfo, childPoint);
- childPaintInfo.phase = PaintPhaseFloat;
- RenderBlock::paint(childPaintInfo, childPoint);
- childPaintInfo.phase = PaintPhaseForeground;
- RenderBlock::paint(childPaintInfo, childPoint);
- childPaintInfo.phase = PaintPhaseOutline;
- RenderBlock::paint(childPaintInfo, childPoint);
- }
+ LayoutPoint childPoint = IntPoint();
+ if (paintInfo.phase == PaintPhaseSelection) {
+ RenderBlock::paint(childPaintInfo, childPoint);
+ return;
}
+
+ // Paint all phases of FO elements atomically, as though the FO element established its
+ // own stacking context.
+ childPaintInfo.phase = PaintPhaseBlockBackground;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseChildBlockBackgrounds;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseFloat;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseForeground;
+ RenderBlock::paint(childPaintInfo, childPoint);
+ childPaintInfo.phase = PaintPhaseOutline;
+ RenderBlock::paint(childPaintInfo, childPoint);
}
LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const
@@ -99,9 +98,14 @@ LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(const RenderLay
return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
}
-void RenderSVGForeignObject::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
+FloatRect RenderSVGForeignObject::computeFloatRectForRepaint(const FloatRect& repaintRect, const RenderLayerModelObject* repaintContainer, bool fixed) const
{
- SVGRenderSupport::computeFloatRectForRepaint(*this, repaintContainer, repaintRect, fixed);
+ return SVGRenderSupport::computeFloatRectForRepaint(*this, repaintRect, repaintContainer, fixed);
+}
+
+LayoutRect RenderSVGForeignObject::computeRectForRepaint(const LayoutRect& repaintRect, const RenderLayerModelObject* repaintContainer, RepaintContext context) const
+{
+ return enclosingLayoutRect(computeFloatRectForRepaint(repaintRect, repaintContainer, context.m_hasPositionFixedDescendant));
}
const AffineTransform& RenderSVGForeignObject::localToParentTransform() const
@@ -118,13 +122,12 @@ void RenderSVGForeignObject::updateLogicalWidth()
setWidth(static_cast<int>(roundf(m_viewport.width())));
}
-void RenderSVGForeignObject::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
+RenderBox::LogicalExtentComputedValues RenderSVGForeignObject::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop) const
{
// FIXME: Investigate in size rounding issues
// FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656
// FIXME: Is this correct for vertical writing mode?
- computedValues.m_extent = static_cast<int>(roundf(m_viewport.height()));
- computedValues.m_position = logicalTop;
+ return { static_cast<int>(roundf(m_viewport.height())), logicalTop, ComputedMarginValues() };
}
void RenderSVGForeignObject::layout()
@@ -179,14 +182,14 @@ bool RenderSVGForeignObject::nodeAtFloatPoint(const HitTestRequest& request, Hit
if (hitTestAction != HitTestForeground)
return false;
- FloatPoint localPoint = localTransform().inverse().mapPoint(pointInParent);
+ FloatPoint localPoint = localTransform().inverse().value_or(AffineTransform()).mapPoint(pointInParent);
// Early exit if local point is not contained in clipped viewport area
if (SVGRenderSupport::isOverflowHidden(*this) && !m_viewport.contains(localPoint))
return false;
// FOs establish a stacking context, so we need to hit-test all layers.
- HitTestLocation hitTestLocation(roundedLayoutPoint(localPoint));
+ HitTestLocation hitTestLocation(localPoint);
return RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestForeground)
|| RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestFloat)
|| RenderBlock::nodeAtPoint(request, result, hitTestLocation, LayoutPoint(), HitTestChildBlockBackgrounds);
@@ -209,5 +212,3 @@ const RenderObject* RenderSVGForeignObject::pushMappingToContainer(const RenderL
}
}
-
-#endif