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. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool hadStyle = (oldStyle != 0); | 74 bool hadStyle = (oldStyle != 0); |
75 float oldZoom = hadStyle ? oldStyle->effectiveZoom() : RenderStyle::initialZ
oom(); | 75 float oldZoom = hadStyle ? oldStyle->effectiveZoom() : RenderStyle::initialZ
oom(); |
76 if (style() && style()->effectiveZoom() != oldZoom) | 76 if (style() && style()->effectiveZoom() != oldZoom) |
77 intrinsicSizeChanged(); | 77 intrinsicSizeChanged(); |
78 } | 78 } |
79 | 79 |
80 void RenderReplaced::layout() | 80 void RenderReplaced::layout() |
81 { | 81 { |
82 ASSERT(needsLayout()); | 82 ASSERT(needsLayout()); |
83 | 83 |
84 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); | 84 LayoutRepainter repainter(*this, checkForPaintInvalidationDuringLayout()); |
85 | 85 |
86 setHeight(minimumReplacedHeight()); | 86 setHeight(minimumReplacedHeight()); |
87 | 87 |
88 updateLogicalWidth(); | 88 updateLogicalWidth(); |
89 updateLogicalHeight(); | 89 updateLogicalHeight(); |
90 | 90 |
91 m_overflow.clear(); | 91 m_overflow.clear(); |
92 addVisualEffectOverflow(); | 92 addVisualEffectOverflow(); |
93 updateLayerTransform(); | 93 updateLayerTransform(); |
94 invalidateBackgroundObscurationStatus(); | 94 invalidateBackgroundObscurationStatus(); |
95 | 95 |
96 repainter.repaintAfterLayout(); | 96 repainter.repaintAfterLayout(); |
97 clearNeedsLayout(); | 97 clearNeedsLayout(); |
98 } | 98 } |
99 | 99 |
100 void RenderReplaced::intrinsicSizeChanged() | 100 void RenderReplaced::intrinsicSizeChanged() |
101 { | 101 { |
102 int scaledWidth = static_cast<int>(cDefaultWidth * style()->effectiveZoom())
; | 102 int scaledWidth = static_cast<int>(cDefaultWidth * style()->effectiveZoom())
; |
103 int scaledHeight = static_cast<int>(cDefaultHeight * style()->effectiveZoom(
)); | 103 int scaledHeight = static_cast<int>(cDefaultHeight * style()->effectiveZoom(
)); |
104 m_intrinsicSize = IntSize(scaledWidth, scaledHeight); | 104 m_intrinsicSize = IntSize(scaledWidth, scaledHeight); |
105 setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); | 105 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
106 } | 106 } |
107 | 107 |
108 void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 108 void RenderReplaced::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
109 { | 109 { |
110 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 110 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
111 | 111 |
112 if (!shouldPaint(paintInfo, paintOffset)) | 112 if (!shouldPaint(paintInfo, paintOffset)) |
113 return; | 113 return; |
114 | 114 |
115 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 115 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 if (node()) { | 532 if (node()) { |
533 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) | 533 if (lineDirectionPosition <= logicalLeft() + (logicalWidth() / 2)) |
534 return createPositionWithAffinity(0, DOWNSTREAM); | 534 return createPositionWithAffinity(0, DOWNSTREAM); |
535 return createPositionWithAffinity(1, DOWNSTREAM); | 535 return createPositionWithAffinity(1, DOWNSTREAM); |
536 } | 536 } |
537 | 537 |
538 return RenderBox::positionForPoint(point); | 538 return RenderBox::positionForPoint(point); |
539 } | 539 } |
540 | 540 |
541 LayoutRect RenderReplaced::selectionRectForRepaint(const RenderLayerModelObject*
repaintContainer, bool clipToVisibleContent) | 541 LayoutRect RenderReplaced::selectionRectForPaintInvalidation(const RenderLayerMo
delObject* paintInvalidationContainer, bool clipToVisibleContent) |
542 { | 542 { |
543 ASSERT(!needsLayout()); | 543 ASSERT(!needsLayout()); |
544 | 544 |
545 if (!isSelected()) | 545 if (!isSelected()) |
546 return LayoutRect(); | 546 return LayoutRect(); |
547 | 547 |
548 LayoutRect rect = localSelectionRect(); | 548 LayoutRect rect = localSelectionRect(); |
549 if (clipToVisibleContent) | 549 if (clipToVisibleContent) |
550 mapRectToRepaintBacking(repaintContainer, rect); | 550 mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect); |
551 else | 551 else |
552 rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosing
BoundingBox(); | 552 rect = localToContainerQuad(FloatRect(rect), paintInvalidationContainer)
.enclosingBoundingBox(); |
553 | 553 |
554 return rect; | 554 return rect; |
555 } | 555 } |
556 | 556 |
557 LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const | 557 LayoutRect RenderReplaced::localSelectionRect(bool checkWhetherSelected) const |
558 { | 558 { |
559 if (checkWhetherSelected && !isSelected()) | 559 if (checkWhetherSelected && !isSelected()) |
560 return LayoutRect(); | 560 return LayoutRect(); |
561 | 561 |
562 if (!inlineBoxWrapper()) | 562 if (!inlineBoxWrapper()) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 602 |
603 int end = node()->hasChildren() ? node()->countChildren() : 1; | 603 int end = node()->hasChildren() ? node()->countChildren() : 1; |
604 if (s == SelectionEnd) | 604 if (s == SelectionEnd) |
605 return selectionEnd == end; | 605 return selectionEnd == end; |
606 if (s == SelectionBoth) | 606 if (s == SelectionBoth) |
607 return selectionStart == 0 && selectionEnd == end; | 607 return selectionStart == 0 && selectionEnd == end; |
608 | 608 |
609 ASSERT(0); | 609 ASSERT(0); |
610 return false; | 610 return false; |
611 } | 611 } |
612 LayoutRect RenderReplaced::clippedOverflowRectForRepaint(const RenderLayerModelO
bject* repaintContainer) const | 612 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer) const |
613 { | 613 { |
614 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) | 614 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent
()) |
615 return LayoutRect(); | 615 return LayoutRect(); |
616 | 616 |
617 // The selectionRect can project outside of the overflowRect, so take their
union | 617 // The selectionRect can project outside of the overflowRect, so take their
union |
618 // for repainting to avoid selection painting glitches. | 618 // for repainting to avoid selection painting glitches. |
619 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | 619 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); |
620 | 620 |
621 RenderView* v = view(); | 621 RenderView* v = view(); |
622 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { | 622 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { |
623 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and | 623 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and |
624 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 624 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 |
625 r.move(v->layoutDelta()); | 625 r.move(v->layoutDelta()); |
626 } | 626 } |
627 | 627 |
628 mapRectToRepaintBacking(repaintContainer, r); | 628 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r); |
629 return r; | 629 return r; |
630 } | 630 } |
631 | 631 |
632 } | 632 } |
OLD | NEW |