Chromium Code Reviews| Index: Source/core/editing/RenderedPosition.cpp |
| diff --git a/Source/core/editing/RenderedPosition.cpp b/Source/core/editing/RenderedPosition.cpp |
| index f350387d5fbcf04f916dbf4edf91106410d482d4..fead19ae0fdd1a87332d435d2a09bfac3a5711e4 100644 |
| --- a/Source/core/editing/RenderedPosition.cpp |
| +++ b/Source/core/editing/RenderedPosition.cpp |
| @@ -33,6 +33,7 @@ |
| #include "core/dom/Position.h" |
| #include "core/editing/VisiblePosition.h" |
| +#include "core/rendering/RenderLayer.h" |
| namespace blink { |
| @@ -231,6 +232,34 @@ IntRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const |
| return localRect == IntRect() ? IntRect() : m_renderer->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoundingBox(); |
| } |
| +void RenderedPosition::layerPoints(GraphicsLayer*& layerBacking, FloatPoint& edgeTop, FloatPoint& edgeBottom) const |
|
chrishtr
2014/09/05 22:14:56
Instead of this method, I suggest you add a method
trchen
2014/09/06 00:06:26
Actually, getting pixel-snapped bounding box isn't
|
| +{ |
| + layerBacking = nullptr; |
| + edgeTop = edgeBottom = FloatPoint(); |
| + |
| + if (isNull()) |
| + return; |
| + |
| + LayoutRect rect = m_renderer->localCaretRect(m_inlineBox, m_offset); |
| + if (rect == LayoutRect()) |
| + return; |
| + |
| + const RenderLayerModelObject* paintInvalidationContainer = m_renderer->containerForPaintInvalidation(); |
| + ASSERT(paintInvalidationContainer); |
| + const RenderLayer* layer = paintInvalidationContainer->layer(); |
| + ASSERT(layer); |
| + |
| + layerBacking = layer->graphicsLayerBacking(); |
| + if (!layerBacking) // This can happen for RenderFlowThread. |
| + return; |
| + |
| + edgeTop = m_renderer->localToContainerPoint(rect.minXMinYCorner(), paintInvalidationContainer, TraverseDocumentBoundaries); |
| + edgeBottom = m_renderer->localToContainerPoint(rect.minXMaxYCorner(), paintInvalidationContainer, TraverseDocumentBoundaries); |
| + |
| + RenderLayer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, edgeTop); |
| + RenderLayer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, edgeBottom); |
| +} |
| + |
| bool renderObjectContainsPosition(RenderObject* target, const Position& position) |
| { |
| for (RenderObject* renderer = rendererFromPosition(position); renderer && renderer->node(); renderer = renderer->parent()) { |