<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285321] branches/safari-612-branch</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285321">285321</a></dd>
<dt>Author</dt> <dd>repstein@apple.com</dd>
<dt>Date</dt> <dd>2021-11-04 16:48:11 -0700 (Thu, 04 Nov 2021)</dd>
</dl>
<h3>Log Message</h3>
<pre>Cherry-pick <a href="http://trac.webkit.org/projects/webkit/changeset/282379">r282379</a>. rdar://problem/85039227
Fix computed style for transform-origin on SVG boxes
https://bugs.webkit.org/show_bug.cgi?id=230172
Reviewed by Alan Bujtas.
LayoutTests/imported/w3c:
* web-platform-tests/css/css-transforms/transform-origin-014-expected.txt:
Source/WebCore:
When getting the computed value for transform-origin on SVG boxes, we need to get
the appropriate "reference box" from the renderer. Do minor refactoring to share
code between rendering and computed style for SVG and non-SVG boxes.
Tested by imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014.html
* css/CSSComputedStyleDeclaration.cpp:
(WebCore::transformReferenceBox):
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* rendering/RenderLayer.cpp:
(WebCore::transformBoxToCSSBoxType): Deleted.
* rendering/style/RenderStyleConstants.cpp:
(WebCore::transformBoxToCSSBoxType):
* rendering/style/RenderStyleConstants.h:
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::transformReferenceBox):
* rendering/svg/SVGRenderSupport.h:
* svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::animatedLocalTransform const):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282379 268f45cc-cd09-0410-ab3c-d52691b4dbfc</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari612branchLayoutTestsimportedw3cChangeLog">branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebCoreChangeLog">branches/safari-612-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari612branchSourceWebCorecssCSSComputedStyleDeclarationcpp">branches/safari-612-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorerenderingRenderLayercpp">branches/safari-612-branch/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorerenderingstyleRenderStyleConstantscpp">branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorerenderingstyleRenderStyleConstantsh">branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.h</a></li>
<li><a href="#branchessafari612branchSourceWebCorerenderingsvgSVGRenderSupportcpp">branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.cpp</a></li>
<li><a href="#branchessafari612branchSourceWebCorerenderingsvgSVGRenderSupporth">branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.h</a></li>
<li><a href="#branchessafari612branchSourceWebCoresvgSVGGraphicsElementcpp">branches/safari-612-branch/Source/WebCore/svg/SVGGraphicsElement.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari612branchLayoutTestsimportedw3cwebplatformtestscsscsstransformstransformorigin014expectedtxt">branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014-expected.txt</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari612branchLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/ChangeLog 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -1,5 +1,51 @@
</span><span class="cx"> 2021-11-04 Russell Epstein <repstein@apple.com>
</span><span class="cx">
</span><ins>+ Cherry-pick r282379. rdar://problem/85039227
+
+ Fix computed style for transform-origin on SVG boxes
+ https://bugs.webkit.org/show_bug.cgi?id=230172
+
+ Reviewed by Alan Bujtas.
+
+ LayoutTests/imported/w3c:
+
+ * web-platform-tests/css/css-transforms/transform-origin-014-expected.txt:
+
+ Source/WebCore:
+
+ When getting the computed value for transform-origin on SVG boxes, we need to get
+ the appropriate "reference box" from the renderer. Do minor refactoring to share
+ code between rendering and computed style for SVG and non-SVG boxes.
+
+ Tested by imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::transformReferenceBox):
+ (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+ * rendering/RenderLayer.cpp:
+ (WebCore::transformBoxToCSSBoxType): Deleted.
+ * rendering/style/RenderStyleConstants.cpp:
+ (WebCore::transformBoxToCSSBoxType):
+ * rendering/style/RenderStyleConstants.h:
+ * rendering/svg/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderSupport::transformReferenceBox):
+ * rendering/svg/SVGRenderSupport.h:
+ * svg/SVGGraphicsElement.cpp:
+ (WebCore::SVGGraphicsElement::animatedLocalTransform const):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-13 Simon Fraser <simon.fraser@apple.com>
+
+ Fix computed style for transform-origin on SVG boxes
+ https://bugs.webkit.org/show_bug.cgi?id=230172
+
+ Reviewed by Alan Bujtas.
+
+ * web-platform-tests/css/css-transforms/transform-origin-014-expected.txt:
+
+2021-11-04 Russell Epstein <repstein@apple.com>
+
</ins><span class="cx"> Cherry-pick r284853. rdar://problem/84516016
</span><span class="cx">
</span><span class="cx"> Fix issue for transform-origin in SVG
</span></span></pre></div>
<a id="branchessafari612branchLayoutTestsimportedw3cwebplatformtestscsscsstransformstransformorigin014expectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014-expected.txt (0 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014-expected.txt (rev 0)
+++ branches/safari-612-branch/LayoutTests/imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014-expected.txt 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS Percentage 'transform-origin' with 'fill-box' transform-box
+PASS Percentage 'transform-origin' with 'view-box' transform-box
+PASS Percentage 'transform-origin' with 'view-box' transform-box in nested <svg> with 'viewBox'
+PASS Percentage 'transform-origin' with 'view-box' transform-box in nested <svg> without 'viewBox'
+
</ins></span></pre></div>
<a id="branchessafari612branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -1,5 +1,69 @@
</span><span class="cx"> 2021-11-04 Russell Epstein <repstein@apple.com>
</span><span class="cx">
</span><ins>+ Cherry-pick r282379. rdar://problem/85039227
+
+ Fix computed style for transform-origin on SVG boxes
+ https://bugs.webkit.org/show_bug.cgi?id=230172
+
+ Reviewed by Alan Bujtas.
+
+ LayoutTests/imported/w3c:
+
+ * web-platform-tests/css/css-transforms/transform-origin-014-expected.txt:
+
+ Source/WebCore:
+
+ When getting the computed value for transform-origin on SVG boxes, we need to get
+ the appropriate "reference box" from the renderer. Do minor refactoring to share
+ code between rendering and computed style for SVG and non-SVG boxes.
+
+ Tested by imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::transformReferenceBox):
+ (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+ * rendering/RenderLayer.cpp:
+ (WebCore::transformBoxToCSSBoxType): Deleted.
+ * rendering/style/RenderStyleConstants.cpp:
+ (WebCore::transformBoxToCSSBoxType):
+ * rendering/style/RenderStyleConstants.h:
+ * rendering/svg/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderSupport::transformReferenceBox):
+ * rendering/svg/SVGRenderSupport.h:
+ * svg/SVGGraphicsElement.cpp:
+ (WebCore::SVGGraphicsElement::animatedLocalTransform const):
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@282379 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-09-13 Simon Fraser <simon.fraser@apple.com>
+
+ Fix computed style for transform-origin on SVG boxes
+ https://bugs.webkit.org/show_bug.cgi?id=230172
+
+ Reviewed by Alan Bujtas.
+
+ When getting the computed value for transform-origin on SVG boxes, we need to get
+ the appropriate "reference box" from the renderer. Do minor refactoring to share
+ code between rendering and computed style for SVG and non-SVG boxes.
+
+ Tested by imported/w3c/web-platform-tests/css/css-transforms/transform-origin-014.html
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::transformReferenceBox):
+ (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+ * rendering/RenderLayer.cpp:
+ (WebCore::transformBoxToCSSBoxType): Deleted.
+ * rendering/style/RenderStyleConstants.cpp:
+ (WebCore::transformBoxToCSSBoxType):
+ * rendering/style/RenderStyleConstants.h:
+ * rendering/svg/SVGRenderSupport.cpp:
+ (WebCore::SVGRenderSupport::transformReferenceBox):
+ * rendering/svg/SVGRenderSupport.h:
+ * svg/SVGGraphicsElement.cpp:
+ (WebCore::SVGGraphicsElement::animatedLocalTransform const):
+
+2021-11-04 Russell Epstein <repstein@apple.com>
+
</ins><span class="cx"> Apply patch. rdar://problem/80991209
</span><span class="cx">
</span><span class="cx"> 2021-11-04 Kate Cheney <katherine_cheney@apple.com>
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include "RenderInline.h"
</span><span class="cx"> #include "RenderStyle.h"
</span><span class="cx"> #include "SVGElement.h"
</span><ins>+#include "SVGRenderSupport.h"
</ins><span class="cx"> #include "Settings.h"
</span><span class="cx"> #include "ShapeValue.h"
</span><span class="cx"> #include "StyleProperties.h"
</span><span class="lines">@@ -537,6 +538,17 @@
</span><span class="cx"> return box.style().boxSizing() == BoxSizing::BorderBox ? box.borderBoxRect() : box.computedCSSContentBoxRect();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static FloatRect transformReferenceBox(const RenderStyle& style, const RenderElement& renderer)
+{
+ if (is<RenderBox>(renderer))
+ return downcast<RenderBox>(renderer).referenceBox(transformBoxToCSSBoxType(style.transformBox()));
+
+ if (is<SVGElement>(renderer.element()))
+ return SVGRenderSupport::transformReferenceBox(renderer, downcast<SVGElement>(*renderer.element()), style);
+
+ return { };
+}
+
</ins><span class="cx"> static Ref<CSSFunctionValue> matrixTransformValue(const TransformationMatrix& transform, const RenderStyle& style)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<CSSFunctionValue> transformValue;
</span><span class="lines">@@ -3540,10 +3552,7 @@
</span><span class="cx"> case CSSPropertyPerspectiveOrigin: {
</span><span class="cx"> auto list = CSSValueList::createSpaceSeparated();
</span><span class="cx"> if (renderer) {
</span><del>- LayoutRect box;
- if (is<RenderBox>(*renderer))
- box = downcast<RenderBox>(*renderer).borderBoxRect();
-
</del><ins>+ auto box = transformReferenceBox(style, *renderer);
</ins><span class="cx"> list->append(zoomAdjustedPixelValue(minimumValueForLength(style.perspectiveOriginX(), box.width()), style));
</span><span class="cx"> list->append(zoomAdjustedPixelValue(minimumValueForLength(style.perspectiveOriginY(), box.height()), style));
</span><span class="cx"> } else {
</span><span class="lines">@@ -3599,10 +3608,7 @@
</span><span class="cx"> case CSSPropertyTransformOrigin: {
</span><span class="cx"> auto list = CSSValueList::createSpaceSeparated();
</span><span class="cx"> if (renderer) {
</span><del>- LayoutRect box;
- if (is<RenderBox>(*renderer))
- box = downcast<RenderBox>(*renderer).borderBoxRect();
-
</del><ins>+ auto box = transformReferenceBox(style, *renderer);
</ins><span class="cx"> list->append(zoomAdjustedPixelValue(minimumValueForLength(style.transformOriginX(), box.width()), style));
</span><span class="cx"> list->append(zoomAdjustedPixelValue(minimumValueForLength(style.transformOriginY(), box.height()), style));
</span><span class="cx"> if (style.transformOriginZ())
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/rendering/RenderLayer.cpp (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/rendering/RenderLayer.cpp 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/rendering/RenderLayer.cpp 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -1230,25 +1230,6 @@
</span><span class="cx"> return computeReferenceRectFromBox(downcast<RenderBox>(renderer), boxType, offsetFromRoot);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static inline CSSBoxType transformBoxToCSSBoxType(TransformBox transformBox)
-{
- switch (transformBox) {
- case TransformBox::StrokeBox:
- return CSSBoxType::StrokeBox;
- case TransformBox::ContentBox:
- return CSSBoxType::ContentBox;
- case TransformBox::BorderBox:
- return CSSBoxType::BorderBox;
- case TransformBox::FillBox:
- return CSSBoxType::FillBox;
- case TransformBox::ViewBox:
- return CSSBoxType::ViewBox;
- default:
- ASSERT_NOT_REACHED();
- return CSSBoxType::BorderBox;
- }
-}
-
</del><span class="cx"> void RenderLayer::updateTransform()
</span><span class="cx"> {
</span><span class="cx"> bool hasTransform = renderer().hasTransform();
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorerenderingstyleRenderStyleConstantscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.cpp (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.cpp 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.cpp 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -1305,6 +1305,25 @@
</span><span class="cx"> return between >= BreakBetween::Page;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CSSBoxType transformBoxToCSSBoxType(TransformBox transformBox)
+{
+ switch (transformBox) {
+ case TransformBox::StrokeBox:
+ return CSSBoxType::StrokeBox;
+ case TransformBox::ContentBox:
+ return CSSBoxType::ContentBox;
+ case TransformBox::BorderBox:
+ return CSSBoxType::BorderBox;
+ case TransformBox::FillBox:
+ return CSSBoxType::FillBox;
+ case TransformBox::ViewBox:
+ return CSSBoxType::ViewBox;
+ default:
+ ASSERT_NOT_REACHED();
+ return CSSBoxType::BorderBox;
+ }
+}
+
</ins><span class="cx"> const float defaultMiterLimit = 4;
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorerenderingstyleRenderStyleConstantsh"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.h (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.h 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/rendering/style/RenderStyleConstants.h 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -1238,6 +1238,8 @@
</span><span class="cx"> Size = 1 << 2,
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+CSSBoxType transformBoxToCSSBoxType(TransformBox);
+
</ins><span class="cx"> extern const float defaultMiterLimit;
</span><span class="cx">
</span><span class="cx"> WTF::TextStream& operator<<(WTF::TextStream&, AnimationFillMode);
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorerenderingsvgSVGRenderSupportcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.cpp (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.cpp 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -335,6 +335,26 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+FloatRect SVGRenderSupport::transformReferenceBox(const RenderElement& renderer, const SVGElement& element, const RenderStyle& style)
+{
+ switch (style.transformBox()) {
+ case TransformBox::BorderBox:
+ // For SVG elements without an associated CSS layout box, the used value for border-box is stroke-box.
+ case TransformBox::StrokeBox:
+ return renderer.strokeBoundingBox();
+ case TransformBox::ContentBox:
+ // For SVG elements without an associated CSS layout box, the used value for content-box is fill-box.
+ case TransformBox::FillBox:
+ return renderer.objectBoundingBox();
+ case TransformBox::ViewBox: {
+ FloatSize viewportSize;
+ SVGLengthContext(&element).determineViewport(viewportSize);
+ return FloatRect { { }, viewportSize };
+ }
+ }
+ return { };
+}
+
</ins><span class="cx"> inline FloatRect clipPathReferenceBox(const RenderElement& renderer, CSSBoxType boxType)
</span><span class="cx"> {
</span><span class="cx"> FloatRect referenceBox;
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCorerenderingsvgSVGRenderSupporth"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.h (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.h 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/rendering/svg/SVGRenderSupport.h 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> class RenderLayerModelObject;
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class RenderSVGRoot;
</span><ins>+class SVGElement;
</ins><span class="cx"> class TransformState;
</span><span class="cx">
</span><span class="cx"> // SVGRendererSupport is a helper class sharing code between all SVG renderers.
</span><span class="lines">@@ -80,6 +81,8 @@
</span><span class="cx"> static void clipContextToCSSClippingArea(GraphicsContext&, const RenderElement& renderer);
</span><span class="cx">
</span><span class="cx"> static void styleChanged(RenderElement&, const RenderStyle*);
</span><ins>+
+ static FloatRect transformReferenceBox(const RenderElement&, const SVGElement&, const RenderStyle&);
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx"> static bool isolatesBlending(const RenderStyle&);
</span></span></pre></div>
<a id="branchessafari612branchSourceWebCoresvgSVGGraphicsElementcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-612-branch/Source/WebCore/svg/SVGGraphicsElement.cpp (285320 => 285321)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-612-branch/Source/WebCore/svg/SVGGraphicsElement.cpp 2021-11-04 23:46:28 UTC (rev 285320)
+++ branches/safari-612-branch/Source/WebCore/svg/SVGGraphicsElement.cpp 2021-11-04 23:48:11 UTC (rev 285321)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "SVGPathData.h"
</span><span class="cx"> #include "SVGRect.h"
</span><ins>+#include "SVGRenderSupport.h"
</ins><span class="cx"> #include "SVGSVGElement.h"
</span><span class="cx"> #include "SVGStringList.h"
</span><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="lines">@@ -79,26 +80,7 @@
</span><span class="cx">
</span><span class="cx"> // Honor any of the transform-related CSS properties if set.
</span><span class="cx"> if (hasSpecifiedTransform || (style && (style->translate() || style->scale() || style->rotate()))) {
</span><del>-
- FloatRect boundingBox;
- switch (style->transformBox()) {
- case TransformBox::BorderBox:
- // For SVG elements without an associated CSS layout box, the used value for border-box is stroke-box.
- case TransformBox::StrokeBox:
- boundingBox = renderer()->strokeBoundingBox();
- break;
- case TransformBox::ContentBox:
- // For SVG elements without an associated CSS layout box, the used value for content-box is fill-box.
- case TransformBox::FillBox:
- boundingBox = renderer()->objectBoundingBox();
- break;
- case TransformBox::ViewBox: {
- FloatSize viewportSize;
- SVGLengthContext(this).determineViewport(viewportSize);
- boundingBox.setSize(viewportSize);
- break;
- }
- }
</del><ins>+ auto boundingBox = SVGRenderSupport::transformReferenceBox(*renderer(), *this, *style);
</ins><span class="cx">
</span><span class="cx"> // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
</span><span class="cx"> // See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
</span><span class="lines">@@ -114,7 +96,6 @@
</span><span class="cx"> matrix.setE(matrix.e() / zoom);
</span><span class="cx"> matrix.setF(matrix.f() / zoom);
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // If we didn't have the CSS "transform" property set, we must account for the "transform" attribute.
</span></span></pre>
</div>
</div>
</body>
</html>