| 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) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 * | 21 * |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/rendering/RenderReplaced.h" | 25 #include "core/rendering/RenderReplaced.h" |
| 26 | 26 |
| 27 #include "core/editing/PositionWithAffinity.h" | 27 #include "core/editing/PositionWithAffinity.h" |
| 28 #include "core/layout/Layer.h" |
| 28 #include "core/paint/ReplacedPainter.h" | 29 #include "core/paint/ReplacedPainter.h" |
| 29 #include "core/rendering/RenderBlock.h" | 30 #include "core/rendering/RenderBlock.h" |
| 30 #include "core/rendering/RenderImage.h" | 31 #include "core/rendering/RenderImage.h" |
| 31 #include "core/rendering/RenderLayer.h" | |
| 32 #include "core/rendering/RenderView.h" | 32 #include "core/rendering/RenderView.h" |
| 33 #include "platform/LengthFunctions.h" | 33 #include "platform/LengthFunctions.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 const int RenderReplaced::defaultWidth = 300; | 37 const int RenderReplaced::defaultWidth = 300; |
| 38 const int RenderReplaced::defaultHeight = 150; | 38 const int RenderReplaced::defaultHeight = 150; |
| 39 | 39 |
| 40 RenderReplaced::RenderReplaced(Element* element) | 40 RenderReplaced::RenderReplaced(Element* element) |
| 41 : RenderBox(element) | 41 : RenderBox(element) |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 if (node()) { | 420 if (node()) { |
| 421 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) | 421 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) |
| 422 return createPositionWithAffinity(0, DOWNSTREAM); | 422 return createPositionWithAffinity(0, DOWNSTREAM); |
| 423 return createPositionWithAffinity(1, DOWNSTREAM); | 423 return createPositionWithAffinity(1, DOWNSTREAM); |
| 424 } | 424 } |
| 425 | 425 |
| 426 return RenderBox::positionForPoint(point); | 426 return RenderBox::positionForPoint(point); |
| 427 } | 427 } |
| 428 | 428 |
| 429 LayoutRect RenderReplaced::selectionRectForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer) const | 429 LayoutRect RenderReplaced::selectionRectForPaintInvalidation(const LayoutLayerMo
delObject* paintInvalidationContainer) const |
| 430 { | 430 { |
| 431 ASSERT(!needsLayout()); | 431 ASSERT(!needsLayout()); |
| 432 | 432 |
| 433 if (!isSelected()) | 433 if (!isSelected()) |
| 434 return LayoutRect(); | 434 return LayoutRect(); |
| 435 | 435 |
| 436 LayoutRect rect = localSelectionRect(); | 436 LayoutRect rect = localSelectionRect(); |
| 437 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); | 437 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0); |
| 438 // FIXME: groupedMapping() leaks the squashing abstraction. | 438 // FIXME: groupedMapping() leaks the squashing abstraction. |
| 439 if (paintInvalidationContainer->layer()->groupedMapping()) | 439 if (paintInvalidationContainer->layer()->groupedMapping()) |
| 440 RenderLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer
, rect); | 440 Layer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect
); |
| 441 return rect; | 441 return rect; |
| 442 } | 442 } |
| 443 | 443 |
| 444 LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const | 444 LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const |
| 445 { | 445 { |
| 446 if (checkWhetherSelected && !isSelected()) | 446 if (checkWhetherSelected && !isSelected()) |
| 447 return LayoutRect(); | 447 return LayoutRect(); |
| 448 | 448 |
| 449 if (!inlineBoxWrapper()) | 449 if (!inlineBoxWrapper()) |
| 450 // We're a block-level replaced element. Just return our own dimensions
. | 450 // We're a block-level replaced element. Just return our own dimensions
. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 int end = node()->hasChildren() ? node()->countChildren() : 1; | 490 int end = node()->hasChildren() ? node()->countChildren() : 1; |
| 491 if (s == SelectionEnd) | 491 if (s == SelectionEnd) |
| 492 return selectionEnd == end; | 492 return selectionEnd == end; |
| 493 if (s == SelectionBoth) | 493 if (s == SelectionBoth) |
| 494 return selectionStart == 0 && selectionEnd == end; | 494 return selectionStart == 0 && selectionEnd == end; |
| 495 | 495 |
| 496 ASSERT(0); | 496 ASSERT(0); |
| 497 return false; | 497 return false; |
| 498 } | 498 } |
| 499 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const | 499 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const LayoutL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const |
| 500 { | 500 { |
| 501 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 501 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
| 502 return LayoutRect(); | 502 return LayoutRect(); |
| 503 | 503 |
| 504 // The selectionRect can project outside of the overflowRect, so take their
union | 504 // The selectionRect can project outside of the overflowRect, so take their
union |
| 505 // for paint invalidation to avoid selection painting glitches. | 505 // for paint invalidation to avoid selection painting glitches. |
| 506 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | 506 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); |
| 507 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 507 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
| 508 return r; | 508 return r; |
| 509 } | 509 } |
| 510 | 510 |
| 511 } | 511 } |
| OLD | NEW |