| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| 11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
| 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
| 15 * | 15 * |
| 16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
| 17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
| 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #include "core/svg/SVGFEImageElement.h" | 22 #include "core/svg/SVGFEImageElement.h" |
| 23 | 23 |
| 24 #include "core/SVGNames.h" | 24 #include "core/SVGNames.h" |
| 25 #include "core/dom/Document.h" | 25 #include "core/dom/Document.h" |
| 26 #include "core/dom/IdTargetObserver.h" | 26 #include "core/dom/IdTargetObserver.h" |
| 27 #include "core/dom/TaskRunnerHelper.h" |
| 27 #include "core/loader/resource/ImageResourceContent.h" | 28 #include "core/loader/resource/ImageResourceContent.h" |
| 28 #include "core/svg/SVGPreserveAspectRatio.h" | 29 #include "core/svg/SVGPreserveAspectRatio.h" |
| 29 #include "core/svg/graphics/filters/SVGFEImage.h" | 30 #include "core/svg/graphics/filters/SVGFEImage.h" |
| 30 #include "platform/graphics/Image.h" | 31 #include "platform/graphics/Image.h" |
| 31 #include "platform/loader/fetch/FetchParameters.h" | 32 #include "platform/loader/fetch/FetchParameters.h" |
| 32 #include "platform/loader/fetch/ResourceFetcher.h" | 33 #include "platform/loader/fetch/ResourceFetcher.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 inline SVGFEImageElement::SVGFEImageElement(Document& document) | 37 inline SVGFEImageElement::SVGFEImageElement(Document& document) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 | 66 |
| 66 void SVGFEImageElement::ClearResourceReferences() { | 67 void SVGFEImageElement::ClearResourceReferences() { |
| 67 ClearImageResource(); | 68 ClearImageResource(); |
| 68 UnobserveTarget(target_id_observer_); | 69 UnobserveTarget(target_id_observer_); |
| 69 RemoveAllOutgoingReferences(); | 70 RemoveAllOutgoingReferences(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 void SVGFEImageElement::FetchImageResource() { | 73 void SVGFEImageElement::FetchImageResource() { |
| 73 FetchParameters params( | 74 FetchParameters params( |
| 74 ResourceRequest(GetDocument().CompleteURL(HrefString())), localName()); | 75 ResourceRequest(GetDocument().CompleteURL(HrefString())), localName()); |
| 75 cached_image_ = ImageResourceContent::Fetch(params, GetDocument().Fetcher()); | 76 RefPtr<WebTaskRunner> task_runner = |
| 77 TaskRunnerHelper::Get(TaskType::kAnimationTimer, &GetDocument()); |
| 78 |
| 79 cached_image_ = |
| 80 ImageResourceContent::Fetch(task_runner, params, GetDocument().Fetcher()); |
| 76 | 81 |
| 77 if (cached_image_) | 82 if (cached_image_) |
| 78 cached_image_->AddObserver(this); | 83 cached_image_->AddObserver(this); |
| 79 } | 84 } |
| 80 | 85 |
| 81 void SVGFEImageElement::ClearImageResource() { | 86 void SVGFEImageElement::ClearImageResource() { |
| 82 if (!cached_image_) | 87 if (!cached_image_) |
| 83 return; | 88 return; |
| 84 cached_image_->RemoveObserver(this); | 89 cached_image_->RemoveObserver(this); |
| 85 cached_image_ = nullptr; | 90 cached_image_ = nullptr; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return FEImage::CreateWithImage(filter, image, | 158 return FEImage::CreateWithImage(filter, image, |
| 154 preserve_aspect_ratio_->CurrentValue()); | 159 preserve_aspect_ratio_->CurrentValue()); |
| 155 } | 160 } |
| 156 | 161 |
| 157 return FEImage::CreateWithIRIReference( | 162 return FEImage::CreateWithIRIReference( |
| 158 filter, GetTreeScope(), HrefString(), | 163 filter, GetTreeScope(), HrefString(), |
| 159 preserve_aspect_ratio_->CurrentValue()); | 164 preserve_aspect_ratio_->CurrentValue()); |
| 160 } | 165 } |
| 161 | 166 |
| 162 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |