| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 CompositeOperator previousOperator = paintInfo.context->compositeOpe
ration(); | 241 CompositeOperator previousOperator = paintInfo.context->compositeOpe
ration(); |
| 242 paintInfo.context->setCompositeOperation(CompositeCopy); | 242 paintInfo.context->setCompositeOperation(CompositeCopy); |
| 243 paintInfo.context->fillRect(paintInfo.rect, baseColor); | 243 paintInfo.context->fillRect(paintInfo.rect, baseColor); |
| 244 paintInfo.context->setCompositeOperation(previousOperator); | 244 paintInfo.context->setCompositeOperation(previousOperator); |
| 245 } else { | 245 } else { |
| 246 paintInfo.context->clearRect(paintInfo.rect); | 246 paintInfo.context->clearRect(paintInfo.rect); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 void RenderView::mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* sta
te) const | |
| 252 { | |
| 253 // Apply our transform if we have one (because of full page zooming). | |
| 254 if (!paintInvalidationContainer && layer() && layer()->transform()) | |
| 255 rect = layer()->transform()->mapRect(rect); | |
| 256 } | |
| 257 | |
| 258 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu
latedOffset) const | 251 void RenderView::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumu
latedOffset) const |
| 259 { | 252 { |
| 260 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); | 253 rects.append(pixelSnappedIntRect(accumulatedOffset, layer()->size())); |
| 261 } | 254 } |
| 262 | 255 |
| 263 void RenderView::absoluteQuads(Vector<FloatQuad>& quads) const | 256 void RenderView::absoluteQuads(Vector<FloatQuad>& quads) const |
| 264 { | 257 { |
| 265 quads.append(FloatRect(FloatPoint(), layer()->size())); | 258 quads.append(FloatRect(FloatPoint(), layer()->size())); |
| 266 } | 259 } |
| 267 | 260 |
| 268 static RenderObject* rendererAfterPosition(RenderObject* object, unsigned offset
) | 261 static RenderObject* rendererAfterPosition(RenderObject* object, unsigned offset
) |
| 269 { | 262 { |
| 270 if (!object) | 263 if (!object) |
| 271 return 0; | 264 return 0; |
| 272 | 265 |
| 273 RenderObject* child = object->childAt(offset); | 266 RenderObject* child = object->childAt(offset); |
| 274 return child ? child : object->nextInPreOrderAfterChildren(); | 267 return child ? child : object->nextInPreOrderAfterChildren(); |
| 275 } | 268 } |
| 276 | 269 |
| 277 IntRect RenderView::selectionBounds() const | |
| 278 { | |
| 279 HashSet<RenderObject*> selectedObjects; | |
| 280 | |
| 281 RenderObject* os = m_selectionStart; | |
| 282 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); | |
| 283 while (os && os != stop) { | |
| 284 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selec
tionEnd) && os->selectionState() != SelectionNone) { | |
| 285 // Blocks are responsible for painting line gaps and margin gaps. Th
ey must be examined as well. | |
| 286 selectedObjects.add(os); | |
| 287 RenderBlock* cb = os->containingBlock(); | |
| 288 while (cb && !cb->isRenderView()) { | |
| 289 if (!selectedObjects.add(cb).isNewEntry) | |
| 290 break; | |
| 291 cb = cb->containingBlock(); | |
| 292 } | |
| 293 } | |
| 294 | |
| 295 os = os->nextInPreOrder(); | |
| 296 } | |
| 297 | |
| 298 // Now create a single bounding box rect that encloses the whole selection. | |
| 299 LayoutRect selRect; | |
| 300 | |
| 301 for (auto& renderer : selectedObjects) { | |
| 302 const RenderLayerModelObject* paintInvalidationContainer = renderer->con
tainerForPaintInvalidation(); | |
| 303 ASSERT(paintInvalidationContainer); | |
| 304 // selectionRectForPaintInvalidation is in the coordinates of the paintI
nvalidationContainer, so map to page coordinates. | |
| 305 bool clipToVisibleContent = false; | |
| 306 LayoutRect rect = renderer->selectionRectForPaintInvalidation(paintInval
idationContainer, clipToVisibleContent); | |
| 307 FloatQuad absQuad = paintInvalidationContainer->localToAbsoluteQuad(Floa
tRect(rect)); | |
| 308 selRect.unite(absQuad.enclosingBoundingBox()); | |
| 309 } | |
| 310 return pixelSnappedIntRect(selRect); | |
| 311 } | |
| 312 | |
| 313 // When exploring the RenderTree looking for the nodes involved in the Selection
, sometimes it's | 270 // When exploring the RenderTree looking for the nodes involved in the Selection
, sometimes it's |
| 314 // required to change the traversing direction because the "start" position is b
elow the "end" one. | 271 // required to change the traversing direction because the "start" position is b
elow the "end" one. |
| 315 static inline RenderObject* getNextOrPrevRenderObjectBasedOnDirection(const Rend
erObject* o, const RenderObject* stop, bool& continueExploring, bool& exploringB
ackwards) | 272 static inline RenderObject* getNextOrPrevRenderObjectBasedOnDirection(const Rend
erObject* o, const RenderObject* stop, bool& continueExploring, bool& exploringB
ackwards) |
| 316 { | 273 { |
| 317 RenderObject* next; | 274 RenderObject* next; |
| 318 if (exploringBackwards) { | 275 if (exploringBackwards) { |
| 319 next = o->previousInPreOrder(); | 276 next = o->previousInPreOrder(); |
| 320 continueExploring = next && !(next)->isRenderView(); | 277 continueExploring = next && !(next)->isRenderView(); |
| 321 } else { | 278 } else { |
| 322 next = o->nextInPreOrder(); | 279 next = o->nextInPreOrder(); |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 m_iframes.remove(iframe); | 481 m_iframes.remove(iframe); |
| 525 } | 482 } |
| 526 | 483 |
| 527 void RenderView::updateIFramesAfterLayout() | 484 void RenderView::updateIFramesAfterLayout() |
| 528 { | 485 { |
| 529 for (auto& iframe: m_iframes) | 486 for (auto& iframe: m_iframes) |
| 530 iframe->updateWidgetBounds(); | 487 iframe->updateWidgetBounds(); |
| 531 } | 488 } |
| 532 | 489 |
| 533 } // namespace blink | 490 } // namespace blink |
| OLD | NEW |