Changeset 294385 in webkit
- Timestamp:
- May 18, 2022, 1:47:17 AM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
-
rendering/RenderElement.cpp (modified) (1 diff)
-
rendering/RenderLayerModelObject.cpp (modified) (2 diffs)
-
rendering/RenderObject.cpp (modified) (1 diff)
-
rendering/svg/RenderSVGBlock.cpp (modified) (9 diffs)
-
rendering/svg/RenderSVGBlock.h (modified) (2 diffs)
-
rendering/svg/RenderSVGText.cpp (modified) (12 diffs)
-
rendering/svg/RenderSVGText.h (modified) (4 diffs)
-
rendering/svg/SVGRootInlineBox.cpp (modified) (5 diffs)
-
rendering/svg/SVGRootInlineBox.h (modified) (2 diffs)
-
svg/SVGElement.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderElement.cpp
r294195 r294385 1188 1188 return false; 1189 1189 1190 LayoutUnit deltaLeft = newBounds.x() - oldBounds.x(); 1191 if (deltaLeft > 0) 1192 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height())); 1193 else if (deltaLeft < 0) 1194 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height())); 1195 1196 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1197 if (deltaRight > 0) 1198 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height())); 1199 else if (deltaRight < 0) 1200 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height())); 1201 1202 LayoutUnit deltaTop = newBounds.y() - oldBounds.y(); 1203 if (deltaTop > 0) 1204 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop)); 1205 else if (deltaTop < 0) 1206 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop)); 1207 1208 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1209 if (deltaBottom > 0) 1210 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom)); 1211 else if (deltaBottom < 0) 1212 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom)); 1190 if (newBounds.isEmpty() && !oldBounds.isEmpty()) 1191 repaintUsingContainer(repaintContainer, oldBounds); 1192 else if (!newBounds.isEmpty() && oldBounds.isEmpty()) 1193 repaintUsingContainer(repaintContainer, newBounds); 1194 else { 1195 LayoutUnit deltaLeft = newBounds.x() - oldBounds.x(); 1196 if (deltaLeft > 0) 1197 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), deltaLeft, oldBounds.height())); 1198 else if (deltaLeft < 0) 1199 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), -deltaLeft, newBounds.height())); 1200 1201 LayoutUnit deltaRight = newBounds.maxX() - oldBounds.maxX(); 1202 if (deltaRight > 0) 1203 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.maxX(), newBounds.y(), deltaRight, newBounds.height())); 1204 else if (deltaRight < 0) 1205 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.maxX(), oldBounds.y(), -deltaRight, oldBounds.height())); 1206 1207 LayoutUnit deltaTop = newBounds.y() - oldBounds.y(); 1208 if (deltaTop > 0) 1209 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), oldBounds.y(), oldBounds.width(), deltaTop)); 1210 else if (deltaTop < 0) 1211 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), newBounds.y(), newBounds.width(), -deltaTop)); 1212 1213 LayoutUnit deltaBottom = newBounds.maxY() - oldBounds.maxY(); 1214 if (deltaBottom > 0) 1215 repaintUsingContainer(repaintContainer, LayoutRect(newBounds.x(), oldBounds.maxY(), newBounds.width(), deltaBottom)); 1216 else if (deltaBottom < 0) 1217 repaintUsingContainer(repaintContainer, LayoutRect(oldBounds.x(), newBounds.maxY(), oldBounds.width(), -deltaBottom)); 1218 } 1213 1219 1214 1220 if (newOutlineBox == oldOutlineBox) -
trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp
r293504 r294385 30 30 #include "RenderLayerCompositor.h" 31 31 #include "RenderLayerScrollableArea.h" 32 #include "RenderSVGBlock.h" 32 33 #include "RenderSVGModelObject.h" 33 34 #include "RenderView.h" … … 246 247 std::optional<LayoutRect> RenderLayerModelObject::computeVisibleRectInSVGContainer(const LayoutRect& rect, const RenderLayerModelObject* container, RenderObject::VisibleRectContext context) const 247 248 { 248 // FIXME: [LBSE] Upstream RenderSVGBlock changes 249 // ASSERT(is<RenderSVGModelObject>(this) || is<RenderSVGBlock>(this)); 250 ASSERT(is<RenderSVGModelObject>(this)); 251 249 ASSERT(is<RenderSVGModelObject>(this) || is<RenderSVGBlock>(this)); 252 250 ASSERT(!style().hasInFlowPosition()); 253 251 ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled()); -
trunk/Source/WebCore/rendering/RenderObject.cpp
r293900 r294385 522 522 return false; 523 523 524 #if ENABLE(LAYER_BASED_SVG_ENGINE) 525 if (object->document().settings().layerBasedSVGEngineEnabled() && object->isSVGLayerAwareRenderer()) 526 return false; 527 #endif 528 524 529 if (object->style().width().isIntrinsicOrAuto() || object->style().height().isIntrinsicOrAuto() || object->style().height().isPercentOrCalculated()) 525 530 return false; -
trunk/Source/WebCore/rendering/svg/RenderSVGBlock.cpp
r287877 r294385 23 23 #include "RenderSVGBlock.h" 24 24 25 #include "RenderSVGBlockInlines.h" 25 26 #include "RenderSVGResource.h" 26 27 #include "SVGGraphicsElement.h" … … 43 44 RenderBlockFlow::updateFromStyle(); 44 45 46 #if ENABLE(LAYER_BASED_SVG_ENGINE) 47 if (document().settings().layerBasedSVGEngineEnabled()) { 48 updateHasSVGTransformFlags(graphicsElement()); 49 return; 50 } 51 #endif 52 45 53 // RenderSVGlock, used by Render(SVGText|ForeignObject), is not allowed to call setHasNonVisibleOverflow(true). 46 54 // RenderBlock assumes a layer to be present when the overflow clip functionality is requested. Both … … 58 66 } 59 67 60 void RenderSVGBlock::absoluteRects(Vector<IntRect>& , const LayoutPoint&) const68 void RenderSVGBlock::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const 61 69 { 70 #if ENABLE(LAYER_BASED_SVG_ENGINE) 71 if (document().settings().layerBasedSVGEngineEnabled()) { 72 rects.append(snappedIntRect(LayoutRect(accumulatedOffset + location(), size()))); 73 return; 74 } 75 #else 76 UNUSED_PARAM(rects); 77 UNUSED_PARAM(accumulatedOffset); 78 #endif 79 62 80 // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used. 63 81 ASSERT_NOT_REACHED(); 82 } 83 84 void RenderSVGBlock::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const 85 { 86 quads.append(localToAbsoluteQuad(strokeBoundingBox(), UseTransforms, wasFixed)); 64 87 } 65 88 … … 72 95 void RenderSVGBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 73 96 { 97 #if ENABLE(LAYER_BASED_SVG_ENGINE) 98 if (diff == StyleDifference::Layout && !document().settings().layerBasedSVGEngineEnabled()) 99 #else 74 100 if (diff == StyleDifference::Layout) 101 #endif 75 102 setNeedsBoundariesUpdate(); 76 103 RenderBlockFlow::styleDidChange(diff, oldStyle); … … 81 108 { 82 109 RenderBlockFlow::computeOverflow(oldClientAfterEdge, recomputeFloats); 110 111 #if ENABLE(LAYER_BASED_SVG_ENGINE) 112 if (document().settings().layerBasedSVGEngineEnabled()) 113 return; 114 #endif 83 115 84 116 const auto* textShadow = style().textShadow(); … … 91 123 } 92 124 93 LayoutRect RenderSVGBlock::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext ) const125 LayoutRect RenderSVGBlock::clippedOverflowRect(const RenderLayerModelObject* repaintContainer, VisibleRectContext context) const 94 126 { 127 #if ENABLE(LAYER_BASED_SVG_ENGINE) 128 if (document().settings().layerBasedSVGEngineEnabled()) { 129 if (isInsideEntirelyHiddenLayer()) 130 return { }; 131 132 ASSERT(!view().frameView().layoutContext().isPaintOffsetCacheEnabled()); 133 return computeRect(visualOverflowRect(), repaintContainer, context); 134 } 135 #else 136 UNUSED_PARAM(context); 137 #endif 138 95 139 return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer); 96 140 } … … 98 142 std::optional<LayoutRect> RenderSVGBlock::computeVisibleRectInContainer(const LayoutRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const 99 143 { 144 #if ENABLE(LAYER_BASED_SVG_ENGINE) 145 if (document().settings().layerBasedSVGEngineEnabled()) 146 return computeVisibleRectInSVGContainer(rect, container, context); 147 #endif 148 100 149 std::optional<FloatRect> adjustedRect = computeFloatVisibleRectInContainer(rect, container, context); 101 150 if (adjustedRect) … … 106 155 std::optional<FloatRect> RenderSVGBlock::computeFloatVisibleRectInContainer(const FloatRect& rect, const RenderLayerModelObject* container, VisibleRectContext context) const 107 156 { 157 #if ENABLE(LAYER_BASED_SVG_ENGINE) 158 ASSERT(!document().settings().layerBasedSVGEngineEnabled()); 159 #endif 108 160 return SVGRenderSupport::computeFloatVisibleRectInContainer(*this, rect, container, context); 109 161 } … … 116 168 const RenderObject* RenderSVGBlock::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const 117 169 { 170 #if ENABLE(LAYER_BASED_SVG_ENGINE) 171 if (document().settings().layerBasedSVGEngineEnabled()) 172 return RenderBox::pushMappingToContainer(ancestorToStopAt, geometryMap); 173 #endif 174 118 175 return SVGRenderSupport::pushMappingToContainer(*this, ancestorToStopAt, geometryMap); 119 176 } 120 177 121 bool RenderSVGBlock::nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) 178 #if ENABLE(LAYER_BASED_SVG_ENGINE) 179 LayoutSize RenderSVGBlock::offsetFromContainer(RenderElement& container, const LayoutPoint&, bool*) const 122 180 { 123 ASSERT_NOT_REACHED(); 124 return false; 181 ASSERT_UNUSED(container, &container == this->container()); 182 ASSERT(!isInFlowPositioned()); 183 ASSERT(!isAbsolutelyPositioned()); 184 ASSERT(!isInline()); 185 return LayoutSize(); 125 186 } 187 #endif 126 188 127 189 } -
trunk/Source/WebCore/rendering/svg/RenderSVGBlock.h
r293504 r294385 46 46 47 47 void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override; 48 48 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; 49 49 void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final; 50 50 … … 60 60 void mapLocalToContainer(const RenderLayerModelObject* ancestorContainer, TransformState&, OptionSet<MapCoordinatesMode>, bool* wasFixed) const final; 61 61 const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const final; 62 63 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final; 62 #if ENABLE(LAYER_BASED_SVG_ENGINE) 63 LayoutSize offsetFromContainer(RenderElement&, const LayoutPoint&, bool* offsetDependsOnPoint = nullptr) const override; 64 #endif 64 65 }; 65 66 -
trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp
r290867 r294385 41 41 #include "RenderSVGInlineText.h" 42 42 #include "RenderSVGResource.h" 43 #include "RenderSVGRoot.h" 43 44 #include "SVGElementTypeHelpers.h" 44 45 #include "SVGLengthList.h" … … 58 59 RenderSVGText::RenderSVGText(SVGTextElement& element, RenderStyle&& style) 59 60 : RenderSVGBlock(element, WTFMove(style)) 60 , m_needsReordering(false)61 , m_needsPositioningValuesUpdate(false)62 , m_needsTransformUpdate(true)63 , m_needsTextMetricsUpdate(false)64 61 { 65 62 } … … 312 309 void RenderSVGText::layout() 313 310 { 311 auto isLayerBasedSVGEngineEnabled = [&]() { 312 #if ENABLE(LAYER_BASED_SVG_ENGINE) 313 return document().settings().layerBasedSVGEngineEnabled(); 314 #else 315 return false; 316 #endif 317 }; 318 314 319 StackStats::LayoutCheckPoint layoutCheckPoint; 315 320 ASSERT(needsLayout()); 316 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(*this)); 321 LayoutRepainter repainter(*this, isLayerBasedSVGEngineEnabled() ? checkForRepaintDuringLayout() : SVGRenderSupport::checkForSVGRepaintDuringLayout(*this)); 322 323 // FIXME: [LBSE] Upstream SVGLengthContext changes 324 // textElement().updateLengthContext(); 317 325 318 326 bool updateCachedBoundariesInParents = false; 319 if (m_needsTransformUpdate) { 320 m_localTransform = textElement().animatedLocalTransform(); 321 m_needsTransformUpdate = false; 322 updateCachedBoundariesInParents = true; 327 if (!isLayerBasedSVGEngineEnabled()) { 328 if (m_needsTransformUpdate) { 329 m_localTransform = textElement().animatedLocalTransform(); 330 m_needsTransformUpdate = false; 331 updateCachedBoundariesInParents = true; 332 } 323 333 } 324 334 … … 348 358 updateCachedBoundariesInParents = true; 349 359 } else { 350 LegacyRenderSVGRoot* rootObj = SVGRenderSupport::findTreeRootObject(*this); 351 if (m_needsTextMetricsUpdate || (rootObj && rootObj->isLayoutSizeChanged())) { 360 bool isLayoutSizeChanged = false; 361 if (auto* legacyRootObject = lineageOfType<LegacyRenderSVGRoot>(*this).first()) 362 isLayoutSizeChanged = legacyRootObject->isLayoutSizeChanged(); 363 #if ENABLE(LAYER_BASED_SVG_ENGINE) 364 else if (auto* rootObject = lineageOfType<RenderSVGRoot>(*this).first()) 365 isLayoutSizeChanged = rootObject->isLayoutSizeChanged(); 366 #endif 367 368 if (m_needsTextMetricsUpdate || isLayoutSizeChanged) { 352 369 // If the root layout size changed (eg. window size changes) or the transform to the root 353 370 // context has changed then recompute the on-screen font size. … … 366 383 // All if branches that could cause early exit in RenderBlocks layoutBlock() method are turned into assertions. 367 384 ASSERT(!isInline()); 368 ASSERT(!simplifiedLayout());369 385 ASSERT(!scrollsOverflow()); 370 386 ASSERT(!hasControlClip()); 371 387 ASSERT(!multiColumnFlow()); 372 388 ASSERT(!positionedObjects()); 373 ASSERT(!m_overflow);374 389 ASSERT(!isAnonymousBlock()); 375 376 if (!firstChild()) 390 if (!isLayerBasedSVGEngineEnabled()) { 391 ASSERT(!simplifiedLayout()); 392 ASSERT(!m_overflow); 393 } 394 395 // FIXME: We need to find a way to only layout the child boxes, if needed. 396 auto layoutChanged = everHadLayout() && selfNeedsLayout(); 397 auto oldBoundaries = objectBoundingBox(); 398 399 if (!firstChild()) { 400 updatePositionAndOverflow({ }); 377 401 setChildrenInline(true); 378 379 // FIXME: We need to find a way to only layout the child boxes, if needed. 380 FloatRect oldBoundaries = objectBoundingBox(); 402 } 403 381 404 ASSERT(childrenInline()); 405 382 406 LayoutUnit repaintLogicalTop; 383 407 LayoutUnit repaintLogicalBottom; … … 385 409 layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom); 386 410 411 // updatePositionAndOverflow() is called by SVGRootInlineBox, after forceLayoutInlineChildren() ran, before this point is reached. 387 412 if (m_needsReordering) 388 413 m_needsReordering = false; 389 414 390 if (!updateCachedBoundariesInParents) 415 if (isLayerBasedSVGEngineEnabled()) { 416 updateLayerTransform(); 417 updateCachedBoundariesInParents = false; // No longer needed for LBSE. 418 } else if (!updateCachedBoundariesInParents) 391 419 updateCachedBoundariesInParents = oldBoundaries != objectBoundingBox(); 392 420 393 421 // Invalidate all resources of this client if our layout changed. 394 if ( everHadLayout() && selfNeedsLayout())422 if (layoutChanged) 395 423 SVGResourcesCache::clientLayoutChanged(*this); 396 424 … … 405 433 bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) 406 434 { 435 #if ENABLE(LAYER_BASED_SVG_ENGINE) 436 ASSERT(!document().settings().layerBasedSVGEngineEnabled()); 437 #endif 407 438 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, request, style().effectivePointerEvents()); 408 439 bool isVisible = (style().visibility() == Visibility::Visible); … … 413 444 414 445 if (!SVGRenderSupport::pointInClippingArea(*this, localPoint)) 415 return false; 446 return false; 416 447 417 448 SVGHitTestCycleDetectionScope hitTestScope(*this); … … 424 455 return false; 425 456 } 457 458 #if ENABLE(LAYER_BASED_SVG_ENGINE) 459 bool RenderSVGText::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) 460 { 461 ASSERT(document().settings().layerBasedSVGEngineEnabled()); 462 auto adjustedLocation = accumulatedOffset + location(); 463 464 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_TEXT_HITTESTING, request, style().pointerEvents()); 465 bool isVisible = (style().visibility() == Visibility::Visible); 466 if (isVisible || !hitRules.requireVisible) { 467 if ((hitRules.canHitStroke && (style().svgStyle().hasStroke() || !hitRules.requireStroke)) 468 || (hitRules.canHitFill && (style().svgStyle().hasFill() || !hitRules.requireFill))) { 469 auto localPoint = locationInContainer.point(); 470 auto coordinateSystemOriginTranslation = nominalSVGLayoutLocation() - adjustedLocation; 471 localPoint.move(coordinateSystemOriginTranslation); 472 473 if (!SVGRenderSupport::pointInClippingArea(*this, localPoint)) 474 return false; 475 476 SVGHitTestCycleDetectionScope hitTestScope(*this); 477 return RenderBlock::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction); 478 } 479 } 480 481 return false; 482 } 483 #endif 426 484 427 485 VisiblePosition RenderSVGText::positionForPoint(const LayoutPoint& pointInContents, const RenderFragmentContainer* fragment) … … 441 499 } 442 500 443 void RenderSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const 444 { 445 quads.append(localToAbsoluteQuad(strokeBoundingBox(), UseTransforms, wasFixed)); 446 } 447 448 void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint&) 501 void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 449 502 { 450 503 if (paintInfo.context().paintingDisabled()) 451 504 return; 452 505 453 if (paintInfo.phase != PaintPhase::Foreground && paintInfo.phase != PaintPhase::Selection) 454 return; 506 if (paintInfo.phase != PaintPhase::ClippingMask && paintInfo.phase != PaintPhase::Mask && paintInfo.phase != PaintPhase::Foreground && paintInfo.phase != PaintPhase::Outline && paintInfo.phase != PaintPhase::SelfOutline) 507 return; 508 509 if (!paintInfo.shouldPaintWithinRoot(*this)) 510 return; 511 512 #if ENABLE(LAYER_BASED_SVG_ENGINE) 513 if (document().settings().layerBasedSVGEngineEnabled()) { 514 if (style().visibility() == Visibility::Hidden || style().display() == DisplayType::None) 515 return; 516 517 // FIXME: [LBSE] Upstream SVGRenderSupport changes 518 // if (!SVGRenderSupport::shouldPaintHiddenRenderer(*this)) 519 // return; 520 521 if (paintInfo.phase == PaintPhase::ClippingMask) { 522 // FIXME: [LBSE] Upstream SVGRenderSupport changes 523 // SVGRenderSupport::paintSVGClippingMask(*this, paintInfo); 524 return; 525 } 526 527 auto adjustedPaintOffset = paintOffset + location(); 528 if (paintInfo.phase == PaintPhase::Mask) { 529 // FIXME: [LBSE] Upstream SVGRenderSupport changes 530 // SVGRenderSupport::paintSVGMask(*this, paintInfo, adjustedPaintOffset); 531 return; 532 } 533 534 if (paintInfo.phase == PaintPhase::Outline || paintInfo.phase == PaintPhase::SelfOutline) { 535 RenderBlock::paint(paintInfo, paintOffset); 536 return; 537 } 538 539 GraphicsContextStateSaver stateSaver(paintInfo.context()); 540 541 auto coordinateSystemOriginTranslation = adjustedPaintOffset - nominalSVGLayoutLocation(); 542 paintInfo.context().translate(coordinateSystemOriginTranslation.width(), coordinateSystemOriginTranslation.height()); 543 544 RenderBlock::paint(paintInfo, paintOffset); 545 return; 546 } 547 #else 548 UNUSED_PARAM(paintOffset); 549 #endif 455 550 456 551 PaintInfo blockInfo(paintInfo); … … 480 575 FloatRect RenderSVGText::repaintRectInLocalCoordinates() const 481 576 { 577 #if ENABLE(LAYER_BASED_SVG_ENGINE) 578 if (document().settings().layerBasedSVGEngineEnabled()) 579 return SVGBoundingBoxComputation::computeRepaintBoundingBox(*this); 580 #endif 581 482 582 FloatRect repaintRect = strokeBoundingBox(); 483 583 SVGRenderSupport::intersectRepaintRectWithResources(*this, repaintRect); … … 489 589 } 490 590 491 } 591 void RenderSVGText::updatePositionAndOverflow(const FloatRect& boundaries) 592 { 593 #if ENABLE(LAYER_BASED_SVG_ENGINE) 594 if (document().settings().layerBasedSVGEngineEnabled()) { 595 clearOverflow(); 596 597 m_objectBoundingBox = boundaries; 598 599 auto boundingRect = enclosingLayoutRect(m_objectBoundingBox); 600 setLocation(boundingRect.location()); 601 setSize(boundingRect.size()); 602 603 auto overflowRect = visualOverflowRectEquivalent(); 604 if (const auto* textShadow = style().textShadow()) 605 textShadow->adjustRectForShadow(overflowRect); 606 607 addVisualOverflow(overflowRect); 608 return; 609 } 610 #endif 611 612 auto boundingRect = enclosingLayoutRect(boundaries); 613 setLocation(boundingRect.location()); 614 setSize(boundingRect.size()); 615 m_objectBoundingBox = boundingRect; 616 ASSERT(m_objectBoundingBox == frameRect()); 617 } 618 619 } -
trunk/Source/WebCore/rendering/svg/RenderSVGText.h
r291992 r294385 24 24 #include "AffineTransform.h" 25 25 #include "RenderSVGBlock.h" 26 #include "SVGBoundingBoxComputation.h" 26 27 #include "SVGTextLayoutAttributesBuilder.h" 27 28 … … 43 44 44 45 void setNeedsPositioningValuesUpdate() { m_needsPositioningValuesUpdate = true; } 46 void setNeedsTextMetricsUpdate() { m_needsTextMetricsUpdate = true; } 47 48 // FIXME: [LBSE] Only needed for legacy SVG engine. 45 49 void setNeedsTransformUpdate() override { m_needsTransformUpdate = true; } 46 void setNeedsTextMetricsUpdate() { m_needsTextMetricsUpdate = true; }47 FloatRect repaintRectInLocalCoordinates() const override;48 50 49 51 static RenderSVGText* locateRenderSVGTextAncestor(RenderObject&); … … 59 61 void subtreeTextDidChange(RenderSVGInlineText*); 60 62 61 FloatRect objectBoundingBox() const override { return frameRect(); } 62 FloatRect strokeBoundingBox() const override; 63 FloatRect objectBoundingBox() const final { return m_objectBoundingBox; } 64 FloatRect strokeBoundingBox() const final; 65 FloatRect repaintRectInLocalCoordinates() const final; 66 67 #if ENABLE(LAYER_BASED_SVG_ENGINE) 68 LayoutRect visualOverflowRectEquivalent() const { return SVGBoundingBoxComputation::computeVisualOverflowRect(*this); } 69 #endif 70 void updatePositionAndOverflow(const FloatRect&); 63 71 64 72 private: … … 69 77 70 78 void paint(PaintInfo&, const LayoutPoint&) override; 71 bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override; 79 #if ENABLE(LAYER_BASED_SVG_ENGINE) 80 bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override; 81 #endif 72 82 VisiblePosition positionForPoint(const LayoutPoint&, const RenderFragmentContainer*) override; 73 83 74 bool requiresLayer() const override { return false; } 84 bool requiresLayer() const override 85 { 86 #if ENABLE(LAYER_BASED_SVG_ENGINE) 87 if (document().settings().layerBasedSVGEngineEnabled()) 88 return true; 89 #endif 90 return false; 91 } 92 75 93 void layout() override; 76 77 void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;78 94 79 95 void willBeDestroyed() override; 80 96 97 // FIXME: [LBSE] Begin code only needed for legacy SVG engine. 98 bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction) override; 81 99 const AffineTransform& localToParentTransform() const override { return m_localTransform; } 82 100 AffineTransform localTransform() const override { return m_localTransform; } 101 // FIXME: [LBSE] End code only needed for legacy SVG engine. 83 102 84 103 bool shouldHandleSubtreeMutations() const; 85 104 86 bool m_needsReordering : 1 ;87 bool m_needsPositioningValuesUpdate : 1 ;88 bool m_needsTransformUpdate : 1 ;89 bool m_needsTextMetricsUpdate : 1 ;90 AffineTransform m_localTransform; 105 bool m_needsReordering : 1 { false }; 106 bool m_needsPositioningValuesUpdate : 1 { false }; 107 bool m_needsTransformUpdate : 1 { true }; // FIXME: [LBSE] Only needed for legacy SVG engine. 108 bool m_needsTextMetricsUpdate : 1 { false }; 109 AffineTransform m_localTransform; // FIXME: [LBSE] Only needed for legacy SVG engine. 91 110 SVGTextLayoutAttributesBuilder m_layoutAttributesBuilder; 92 111 Vector<SVGTextLayoutAttributes*> m_layoutAttributes; 112 FloatRect m_objectBoundingBox; 93 113 }; 94 114 -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
r291548 r294385 47 47 } 48 48 49 RenderSVGText& SVGRootInlineBox::renderSVGText() 49 RenderSVGText& SVGRootInlineBox::renderSVGText() const 50 50 { 51 51 return downcast<RenderSVGText>(blockFlow()); 52 52 } 53 53 54 void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit , LayoutUnit)54 void SVGRootInlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) 55 55 { 56 56 ASSERT(paintInfo.phase == PaintPhase::Foreground || paintInfo.phase == PaintPhase::Selection); 57 57 ASSERT(!paintInfo.context().paintingDisabled()); 58 59 #if ENABLE(LAYER_BASED_SVG_ENGINE) 60 if (renderer().document().settings().layerBasedSVGEngineEnabled()) { 61 auto overflowRect(visualOverflowRect(lineTop, lineBottom)); 62 flipForWritingMode(overflowRect); 63 overflowRect.moveBy(paintOffset); 64 65 if (!paintInfo.rect.intersects(overflowRect)) 66 return; 67 } 68 #else 69 UNUSED_PARAM(lineTop); 70 UNUSED_PARAM(lineBottom); 71 #endif 58 72 59 73 bool isPrinting = renderSVGText().document().printing(); … … 62 76 63 77 PaintInfo childPaintInfo(paintInfo); 78 childPaintInfo.updateSubtreePaintRootForChildren(&renderer()); 79 64 80 if (hasSelection && shouldPaintSelectionHighlight) { 65 81 for (auto* child = firstChild(); child; child = child->nextOnLine()) { … … 70 86 } 71 87 } 88 89 #if ENABLE(LAYER_BASED_SVG_ENGINE) 90 if (renderer().document().settings().layerBasedSVGEngineEnabled()) { 91 for (auto* child = firstChild(); child; child = child->nextOnLine()) { 92 if (child->renderer().isText() || !child->boxModelObject()->hasSelfPaintingLayer()) 93 child->paint(childPaintInfo, paintOffset, lineTop, lineBottom); 94 } 95 96 return; 97 } 98 #endif 72 99 73 100 SVGRenderingContext renderingContext(renderSVGText(), paintInfo, SVGRenderingContext::SaveGraphicsContext); … … 171 198 172 199 // Finally, assign the root block position, now that all content is laid out. 173 LayoutRect boundingRect = enclosingLayoutRect(childRect); 174 parentBlock.setLocation(boundingRect.location()); 175 parentBlock.setSize(boundingRect.size()); 200 parentBlock.updatePositionAndOverflow(childRect); 176 201 177 202 // Position all children relative to the parent block. … … 188 213 setLogicalWidth(childRect.width()); 189 214 setLogicalHeight(childRect.height()); 215 216 auto boundingRect = enclosingLayoutRect(childRect); 190 217 setLineTopBottomPositions(0, boundingRect.height(), 0, boundingRect.height()); 191 218 } -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.h
r284315 r294385 36 36 explicit SVGRootInlineBox(RenderSVGText&); 37 37 38 RenderSVGText& renderSVGText();39 40 38 float virtualLogicalHeight() const override { return m_logicalHeight; } 41 39 void setLogicalHeight(float height) { m_logicalHeight = height; } … … 50 48 51 49 private: 50 RenderSVGText& renderSVGText() const; 51 52 52 bool isSVGRootInlineBox() const override { return true; } 53 53 void reorderValueListsToLogicalOrder(Vector<SVGTextLayoutAttributes*>&); -
trunk/Source/WebCore/svg/SVGElement.cpp
r294067 r294385 532 532 using namespace SVGNames; 533 533 MemoryCompactLookupOnlyRobinHoodHashSet<AtomString> set; 534 for (auto& tag : { gTag.get(), rectTag.get() })534 for (auto& tag : { gTag.get(), rectTag.get(), textTag.get() }) 535 535 set.add(tag.localName()); 536 536 return set;
Note:
See TracChangeset
for help on using the changeset viewer.