Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(720)

Unified Diff: third_party/WebKit/Source/core/observer/ResizeObservation.cpp

Issue 2305893002: Fix svg contentrect location (Closed)
Patch Set: forgot to fix c++ tests Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/observer/ResizeObservation.cpp
diff --git a/third_party/WebKit/Source/core/observer/ResizeObservation.cpp b/third_party/WebKit/Source/core/observer/ResizeObservation.cpp
index 4fd08d5414b06eb3011cf6aa97d8267d2f94506b..66fde7536db8d309d6679776ad75b055b61e5f3c 100644
--- a/third_party/WebKit/Source/core/observer/ResizeObservation.cpp
+++ b/third_party/WebKit/Source/core/observer/ResizeObservation.cpp
@@ -21,17 +21,17 @@ ResizeObservation::ResizeObservation(Element* target, ResizeObserver* observer)
m_observer->elementSizeChanged();
}
-void ResizeObservation::setObservationSize(const LayoutSize& size)
+bool ResizeObservation::observationSizeOutOfSync()
{
- m_observationSize = size;
+ return m_elementSizeChanged && m_observationSize != computeTargetSize();
+}
+
+void ResizeObservation::setObservationSize(const LayoutSize& observationSize)
+{
+ m_observationSize = observationSize;
m_elementSizeChanged = false;
}
-bool ResizeObservation::observationSizeOutOfSync() const
-{
- return m_elementSizeChanged && m_observationSize != ResizeObservation::getTargetSize(m_target);
-}
-
size_t ResizeObservation::targetDepth()
{
unsigned depth = 0;
@@ -40,20 +40,29 @@ size_t ResizeObservation::targetDepth()
return depth;
}
-LayoutSize ResizeObservation::getTargetSize(Element* target) // static
+LayoutSize ResizeObservation::computeTargetSize() const
{
- if (target) {
- if (target->isSVGElement() && toSVGElement(target)->isSVGGraphicsElement()) {
- SVGGraphicsElement& svg = toSVGGraphicsElement(*target);
+ if (m_target) {
+ if (m_target->isSVGElement() && toSVGElement(m_target)->isSVGGraphicsElement()) {
+ SVGGraphicsElement& svg = toSVGGraphicsElement(*m_target);
return LayoutSize(svg.getBBox().size());
}
- LayoutBox* layout = target->layoutBox();
+ LayoutBox* layout = m_target->layoutBox();
if (layout)
return layout->contentSize();
}
return LayoutSize();
}
+LayoutPoint ResizeObservation::computeTargetLocation() const
+{
+ if (m_target && !m_target->isSVGElement()) {
+ if (LayoutBox* layout = m_target->layoutBox())
+ return LayoutPoint(layout->paddingLeft(), layout->paddingTop());
+ }
+ return LayoutPoint();
+}
+
void ResizeObservation::elementSizeChanged()
{
m_elementSizeChanged = true;

Powered by Google App Engine
This is Rietveld 408576698