Title: [186630] branches/safari-600.8-branch

Diff

Modified: branches/safari-600.8-branch/LayoutTests/ChangeLog (186629 => 186630)


--- branches/safari-600.8-branch/LayoutTests/ChangeLog	2015-07-09 21:03:25 UTC (rev 186629)
+++ branches/safari-600.8-branch/LayoutTests/ChangeLog	2015-07-09 21:03:29 UTC (rev 186630)
@@ -1,5 +1,25 @@
 2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186571. rdar://problem/21716420
+
+    2015-07-08  Lucas Forschler  <lforsch...@apple.com>
+
+            Merge r185392
+
+        2015-06-09  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+                feComposite filter does not clip the paint rect to its effect rect when the operator is 'in' or 'atop'
+                https://bugs.webkit.org/show_bug.cgi?id=137856
+
+                Reviewed by Darin Adler.
+
+                * svg/filters/feComposite-background-rect-control-operators-expected.svg: Added.
+                * svg/filters/feComposite-background-rect-control-operators.svg: Added.
+                Ensure the painting rect of the feComposite filter with operator 'in' or
+                'atop' is clipped to its bounding rectangle
+
+2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r186560. rdar://problem/21716387
 
     2015-07-08  Matthew Hanson  <matthew_han...@apple.com>

Added: branches/safari-600.8-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg (0 => 186630)


--- branches/safari-600.8-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg	                        (rev 0)
+++ branches/safari-600.8-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators-expected.svg	2015-07-09 21:03:29 UTC (rev 186630)
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="100">
+  <rect x="20" y="20" width="60" height="60" fill="green"/>
+  <rect x="120" y="20" width="60" height="60" fill="green"/>
+</svg>
\ No newline at end of file

Added: branches/safari-600.8-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg (0 => 186630)


--- branches/safari-600.8-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg	                        (rev 0)
+++ branches/safari-600.8-branch/LayoutTests/svg/filters/feComposite-background-rect-control-operators.svg	2015-07-09 21:03:29 UTC (rev 186630)
@@ -0,0 +1,14 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="100">
+  <filter id="filter-in" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox" x="0" y="0" width="1" height="1">
+    <feFlood flood-color="orange" x="0" y="0" width="0.9" height="0.9" result="flood-orange"/>
+    <feFlood flood-color="green" x="0.1" y="0.1" width="0.9" height="0.9" result="flood-green"/>
+    <feComposite x="0.2" y="0.2" width="0.6" height="0.6" operator="in" in="flood-green" in2="flood-orange"/>
+  </filter>
+  <filter id="filter-atop" filterUnits="objectBoundingBox" primitiveUnits="objectBoundingBox" x="0" y="0" width="1" height="1">
+    <feFlood flood-color="orange" x="0" y="0" width="0.8" height="0.8" result="flood-orange"/>
+    <feFlood flood-color="green" x="0.2" y="0.2" width="0.8" height="0.8" result="flood-green"/>
+    <feComposite x="0.2" y="0.2" width="0.8" height="0.8" operator="atop" in="flood-green" in2="flood-orange"/>
+  </filter>
+  <rect x=  "0" y="0" width="100" height="100" fill="red" filter="url(#filter-in)"/>
+  <rect x="100" y="0" width="100" height="100" fill="red" filter="url(#filter-atop)"/>
+</svg>
\ No newline at end of file

Modified: branches/safari-600.8-branch/Source/WebCore/ChangeLog (186629 => 186630)


--- branches/safari-600.8-branch/Source/WebCore/ChangeLog	2015-07-09 21:03:25 UTC (rev 186629)
+++ branches/safari-600.8-branch/Source/WebCore/ChangeLog	2015-07-09 21:03:29 UTC (rev 186630)
@@ -1,5 +1,47 @@
 2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r186571. rdar://problem/21716420
+
+    2015-07-08  Lucas Forschler  <lforsch...@apple.com>
+
+            Merge r185392
+
+        2015-06-09  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+                feComposite filter does not clip the paint rect to its effect rect when the operator is 'in' or 'atop'
+                https://bugs.webkit.org/show_bug.cgi?id=137856
+
+                Reviewed by Darin Adler.
+
+                There was bug in calculating the absolutePaintRect of the feComposite filter
+                when the operator is equal to 'in' or 'atop'. The absolutePaintRect was set
+                to the absolutePaintRect of the background FilterEffect which is correct.
+                What was missing is clipping this rectangle to the maxEffectRect of the
+                filter which we do for other operators.
+
+                Tests: svg/filters/feComposite-background-rect-control-operators.svg
+
+                * platform/graphics/IntRect.h:
+                (WebCore::operator-=):
+                (WebCore::operator-): Add new operators to IntRect.
+
+                * platform/graphics/filters/FEComposite.cpp:
+                (WebCore::FEComposite::determineAbsolutePaintRect): Make sure the filter
+                absolutePaintRect is clipped to maxEffectRect for all operators.
+
+                (WebCore::FEComposite::platformApplySoftware): Code clean-up.
+
+                * platform/graphics/filters/FilterEffect.cpp:
+                (WebCore::FilterEffect::determineAbsolutePaintRect): Move the clipping
+                part to a separate function.
+
+                (WebCore::FilterEffect::clipAbsolutePaintRect): Clip the absolutePaintRect
+                to the maxEffectRect of the filter.
+
+                * platform/graphics/filters/FilterEffect.h:
+
+2015-07-09  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r186567. rdar://problem/21716428
 
     2015-07-08  Lucas Forschler  <lforsch...@apple.com>

Modified: branches/safari-600.8-branch/Source/WebCore/platform/graphics/IntRect.h (186629 => 186630)


--- branches/safari-600.8-branch/Source/WebCore/platform/graphics/IntRect.h	2015-07-09 21:03:25 UTC (rev 186629)
+++ branches/safari-600.8-branch/Source/WebCore/platform/graphics/IntRect.h	2015-07-09 21:03:29 UTC (rev 186630)
@@ -225,6 +225,18 @@
     return a.location() != b.location() || a.size() != b.size();
 }
 
+inline IntRect& operator-=(IntRect& r, const IntPoint& offset)
+{
+    r.move(-offset.x(), -offset.y());
+    return r;
+}
+
+inline IntRect operator-(const IntRect& r, const IntPoint& offset)
+{
+    IntRect t = r;
+    return t -= offset;
+}
+
 #if USE(CG)
 IntRect enclosingIntRect(const CGRect&);
 #endif

Modified: branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp (186629 => 186630)


--- branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp	2015-07-09 21:03:25 UTC (rev 186629)
+++ branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FEComposite.cpp	2015-07-09 21:03:29 UTC (rev 186630)
@@ -237,6 +237,7 @@
         // For In and Atop the first effect just influences the result of
         // the second effect. So just use the absolute paint rect of the second effect here.
         setAbsolutePaintRect(inputEffect(1)->absolutePaintRect());
+        clipAbsolutePaintRect();
         return;
     case FECOMPOSITE_OPERATOR_ARITHMETIC:
         // Arithmetic may influnce the compele filter primitive region. So we can't
@@ -292,13 +293,11 @@
         destinationRect.intersect(absolutePaintRect());
         if (destinationRect.isEmpty())
             break;
-        IntPoint destinationPoint(destinationRect.x() - absolutePaintRect().x(), destinationRect.y() - absolutePaintRect().y());
-        IntRect sourceRect(IntPoint(destinationRect.x() - in->absolutePaintRect().x(),
-                                    destinationRect.y() - in->absolutePaintRect().y()), destinationRect.size());
-        IntRect source2Rect(IntPoint(destinationRect.x() - in2->absolutePaintRect().x(),
-                                     destinationRect.y() - in2->absolutePaintRect().y()), destinationRect.size());
-        filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, IntRect(destinationPoint, source2Rect.size()), source2Rect);
-        filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, IntRect(destinationPoint, sourceRect.size()), sourceRect, CompositeSourceIn);
+        IntRect adjustedDestinationRect = destinationRect - absolutePaintRect().location();
+        IntRect sourceRect = destinationRect - in->absolutePaintRect().location();
+        IntRect source2Rect = destinationRect - in2->absolutePaintRect().location();
+        filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, adjustedDestinationRect, source2Rect);
+        filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, adjustedDestinationRect, sourceRect, CompositeSourceIn);
         break;
     }
     case FECOMPOSITE_OPERATOR_OUT:

Modified: branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (186629 => 186630)


--- branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2015-07-09 21:03:25 UTC (rev 186629)
+++ branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2015-07-09 21:03:29 UTC (rev 186630)
@@ -74,16 +74,18 @@
 void FilterEffect::determineAbsolutePaintRect()
 {
     m_absolutePaintRect = IntRect();
-    unsigned size = m_inputEffects.size();
-    for (unsigned i = 0; i < size; ++i)
-        m_absolutePaintRect.unite(m_inputEffects.at(i)->absolutePaintRect());
-    
+    for (auto& effect : m_inputEffects)
+        m_absolutePaintRect.unite(effect->absolutePaintRect());
+    clipAbsolutePaintRect();
+}
+
+void FilterEffect::clipAbsolutePaintRect()
+{
     // Filters in SVG clip to primitive subregion, while CSS doesn't.
     if (m_clipsToBounds)
         m_absolutePaintRect.intersect(enclosingIntRect(m_maxEffectRect));
     else
         m_absolutePaintRect.unite(enclosingIntRect(m_maxEffectRect));
-    
 }
 
 IntRect FilterEffect::requestedRegionOfInputImageData(const IntRect& effectRect) const

Modified: branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h (186629 => 186630)


--- branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h	2015-07-09 21:03:25 UTC (rev 186629)
+++ branches/safari-600.8-branch/Source/WebCore/platform/graphics/filters/FilterEffect.h	2015-07-09 21:03:29 UTC (rev 186630)
@@ -179,6 +179,8 @@
     // If a pre-multiplied image, check every pixel for validity and correct if necessary.
     void forceValidPreMultipliedPixels();
 
+    void clipAbsolutePaintRect();
+
 private:
     std::unique_ptr<ImageBuffer> m_imageBufferResult;
     RefPtr<Uint8ClampedArray> m_unmultipliedImageResult;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to