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; |