| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 cullSaver.cull(overflowBox); | 605 cullSaver.cull(overflowBox); |
| 606 | 606 |
| 607 paintObject(paintInfo, adjustedPaintOffset); | 607 paintObject(paintInfo, adjustedPaintOffset); |
| 608 } | 608 } |
| 609 if (pushedClip) | 609 if (pushedClip) |
| 610 popContentsClip(paintInfo, phase, adjustedPaintOffset); | 610 popContentsClip(paintInfo, phase, adjustedPaintOffset); |
| 611 | 611 |
| 612 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | 612 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with |
| 613 // z-index. We paint after we painted the background/border, so that the sc
rollbars will | 613 // z-index. We paint after we painted the background/border, so that the sc
rollbars will |
| 614 // sit above the background/border. | 614 // sit above the background/border. |
| 615 if (hasOverflowClip() && (phase == PaintPhaseBlockBackground || phase == Pai
ntPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(this) && !paintI
nfo.paintRootBackgroundOnly()) | 615 if (hasOverflowClip() && (phase == PaintPhaseBlockBackground || phase == Pai
ntPhaseChildBlockBackground) && paintInfo.shouldPaintWithinRoot(this)) |
| 616 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun
dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro
ls */); | 616 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun
dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro
ls */); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 619 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 620 { | 620 { |
| 621 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPh
aseOutline : paintInfo.phase; | 621 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPh
aseOutline : paintInfo.phase; |
| 622 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChildBl
ockBackground : newPhase; | 622 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChildBl
ockBackground : newPhase; |
| 623 | 623 |
| 624 // We don't paint our own background, but we do let the kids paint their bac
kgrounds. | 624 // We don't paint our own background, but we do let the kids paint their bac
kgrounds. |
| 625 PaintInfo paintInfoForChild(paintInfo); | 625 PaintInfo paintInfoForChild(paintInfo); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 DragCaretController& dragCaretController = frame()->page()->dragCaretControl
ler(); | 695 DragCaretController& dragCaretController = frame()->page()->dragCaretControl
ler(); |
| 696 if (hasDragCaret(dragCaretController, this)) { | 696 if (hasDragCaret(dragCaretController, this)) { |
| 697 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs
et, paintInfo.rect); | 697 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs
et, paintInfo.rect); |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 | 700 |
| 701 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 701 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
| 702 { | 702 { |
| 703 PaintPhase paintPhase = paintInfo.phase; | 703 PaintPhase paintPhase = paintInfo.phase; |
| 704 | 704 |
| 705 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div). | |
| 706 LayoutPoint scrolledOffset = paintOffset; | 705 LayoutPoint scrolledOffset = paintOffset; |
| 707 if (hasOverflowClip()) | 706 if (hasOverflowClip()) |
| 708 scrolledOffset.move(-scrolledContentOffset()); | 707 scrolledOffset.move(-scrolledContentOffset()); |
| 709 | 708 |
| 710 // 1. paint background, borders etc | |
| 711 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild
BlockBackground) { | 709 if (paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChild
BlockBackground) { |
| 712 if (hasBoxDecorationBackground()) | 710 if (hasBoxDecorationBackground()) |
| 713 paintBoxDecorationBackground(paintInfo, paintOffset); | 711 paintBoxDecorationBackground(paintInfo, paintOffset); |
| 714 } | 712 } |
| 715 | 713 |
| 716 if (paintPhase == PaintPhaseMask) { | 714 if (paintPhase == PaintPhaseMask) { |
| 717 paintMask(paintInfo, paintOffset); | 715 paintMask(paintInfo, paintOffset); |
| 718 return; | 716 return; |
| 719 } | 717 } |
| 720 | 718 |
| 721 if (paintPhase == PaintPhaseClippingMask) { | 719 if (paintPhase == PaintPhaseClippingMask) { |
| 722 paintClippingMask(paintInfo, paintOffset); | 720 paintClippingMask(paintInfo, paintOffset); |
| 723 return; | 721 return; |
| 724 } | 722 } |
| 725 | 723 |
| 726 // We're done. We don't bother painting any children. | 724 // We're done. We don't bother painting any children. |
| 727 if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackground
Only()) | 725 if (paintPhase == PaintPhaseBlockBackground) |
| 728 return; | 726 return; |
| 729 | 727 |
| 730 // 2. paint contents | |
| 731 if (paintPhase != PaintPhaseSelfOutline) { | 728 if (paintPhase != PaintPhaseSelfOutline) { |
| 732 // Avoid painting descendants of the root element when stylesheets haven
't loaded. This eliminates FOUC. | 729 // Avoid painting descendants of the root element when stylesheets haven
't loaded. This eliminates FOUC. |
| 733 // It's ok not to draw, because later on, when all the stylesheets do lo
ad, styleResolverChanged() on the Document | 730 // It's ok not to draw, because later on, when all the stylesheets do lo
ad, styleResolverChanged() on the Document |
| 734 // will do a full paint invalidation. | 731 // will do a full paint invalidation. |
| 735 if (!document().didLayoutWithPendingStylesheets() || isRenderView()) | 732 if (!document().didLayoutWithPendingStylesheets() || isRenderView()) |
| 736 paintContents(paintInfo, scrolledOffset); | 733 paintContents(paintInfo, scrolledOffset); |
| 737 } | 734 } |
| 738 | 735 |
| 739 // 3. paint selection | |
| 740 // FIXME: Make this work with multi column layouts. For now don't fill gaps
. | |
| 741 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l
ines and between blocks. | 736 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l
ines and between blocks. |
| 742 | 737 |
| 743 // 5. paint outline. | |
| 744 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) | 738 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) |
| 745 && style()->hasOutline() && !style()->outlineStyleIsAuto()) { | 739 && style()->hasOutline() && !style()->outlineStyleIsAuto()) { |
| 746 paintOutline(paintInfo, LayoutRect(paintOffset, size())); | 740 paintOutline(paintInfo, LayoutRect(paintOffset, size())); |
| 747 } | 741 } |
| 748 | 742 |
| 749 // 7. paint caret. | |
| 750 // If the caret's node's render object's containing block is this block, and
the paint action is PaintPhaseForeground, | 743 // If the caret's node's render object's containing block is this block, and
the paint action is PaintPhaseForeground, |
| 751 // then paint the caret. | 744 // then paint the caret. |
| 752 if (paintPhase == PaintPhaseForeground) | 745 if (paintPhase == PaintPhaseForeground) |
| 753 paintCarets(paintInfo, paintOffset); | 746 paintCarets(paintInfo, paintOffset); |
| 754 } | 747 } |
| 755 | 748 |
| 756 bool RenderBlock::shouldPaintSelectionGaps() const | 749 bool RenderBlock::shouldPaintSelectionGaps() const |
| 757 { | 750 { |
| 758 return selectionState() != SelectionNone && isSelectionRoot(); | 751 return selectionState() != SelectionNone && isSelectionRoot(); |
| 759 } | 752 } |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 2049 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 2057 { | 2050 { |
| 2058 showRenderObject(); | 2051 showRenderObject(); |
| 2059 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 2052 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 2060 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 2053 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 2061 } | 2054 } |
| 2062 | 2055 |
| 2063 #endif | 2056 #endif |
| 2064 | 2057 |
| 2065 } // namespace blink | 2058 } // namespace blink |
| OLD | NEW |