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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 | 544 |
545 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | 545 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with |
546 // z-index. We paint after we painted the background/border, so that the sc
rollbars will | 546 // z-index. We paint after we painted the background/border, so that the sc
rollbars will |
547 // sit above the background/border. | 547 // sit above the background/border. |
548 if (hasOverflowClip() && phase == PaintPhaseForeground && paintInfo.shouldPa
intWithinRoot(this)) | 548 if (hasOverflowClip() && phase == PaintPhaseForeground && paintInfo.shouldPa
intWithinRoot(this)) |
549 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun
dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro
ls */); | 549 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun
dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro
ls */); |
550 } | 550 } |
551 | 551 |
552 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 552 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
553 { | 553 { |
554 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? PaintPh
aseOutline : paintInfo.phase; | |
555 | |
556 // We don't paint our own background, but we do let the kids paint their bac
kgrounds. | 554 // We don't paint our own background, but we do let the kids paint their bac
kgrounds. |
557 PaintInfo paintInfoForChild(paintInfo); | 555 PaintInfo paintInfoForChild(paintInfo); |
558 paintInfoForChild.phase = newPhase; | |
559 paintInfoForChild.updatePaintingRootForChildren(this); | 556 paintInfoForChild.updatePaintingRootForChildren(this); |
560 paintChildren(paintInfoForChild, paintOffset); | 557 paintChildren(paintInfoForChild, paintOffset); |
561 } | 558 } |
562 | 559 |
563 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 560 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
564 { | 561 { |
565 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) | 562 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) |
566 paintChild(child, paintInfo, paintOffset); | 563 paintChild(child, paintInfo, paintOffset); |
567 } | 564 } |
568 | 565 |
(...skipping 18 matching lines...) Expand all Loading... |
587 // stacking context. (See Appendix E.2, section 7.2.1.4 on | 584 // stacking context. (See Appendix E.2, section 7.2.1.4 on |
588 // inline block/table/replaced elements in the CSS2.1 specification.) | 585 // inline block/table/replaced elements in the CSS2.1 specification.) |
589 // This is also used by other elements (e.g. flex items). | 586 // This is also used by other elements (e.g. flex items). |
590 PaintInfo info(paintInfo); | 587 PaintInfo info(paintInfo); |
591 | 588 |
592 if (paintInfo.phase == PaintPhaseSelection) { | 589 if (paintInfo.phase == PaintPhaseSelection) { |
593 renderer->paint(info, childPoint); | 590 renderer->paint(info, childPoint); |
594 } else { | 591 } else { |
595 info.phase = PaintPhaseForeground; | 592 info.phase = PaintPhaseForeground; |
596 renderer->paint(info, childPoint); | 593 renderer->paint(info, childPoint); |
597 info.phase = PaintPhaseOutline; | |
598 renderer->paint(info, childPoint); | |
599 } | 594 } |
600 } | 595 } |
601 | 596 |
602 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block) | 597 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block) |
603 { | 598 { |
604 return selection.caretRenderer() == block && selection.hasEditableStyle(); | 599 return selection.caretRenderer() == block && selection.hasEditableStyle(); |
605 } | 600 } |
606 | 601 |
607 static inline bool hasDragCaret(const DragCaretController& dragCaretController,
const RenderBlock* block) | 602 static inline bool hasDragCaret(const DragCaretController& dragCaretController,
const RenderBlock* block) |
608 { | 603 { |
(...skipping 30 matching lines...) Expand all Loading... |
639 if (paintPhase == PaintPhaseForeground) { | 634 if (paintPhase == PaintPhaseForeground) { |
640 if (hasBoxDecorationBackground()) | 635 if (hasBoxDecorationBackground()) |
641 paintBoxDecorationBackground(paintInfo, paintOffset); | 636 paintBoxDecorationBackground(paintInfo, paintOffset); |
642 } | 637 } |
643 | 638 |
644 if (paintPhase == PaintPhaseMask) { | 639 if (paintPhase == PaintPhaseMask) { |
645 paintMask(paintInfo, paintOffset); | 640 paintMask(paintInfo, paintOffset); |
646 return; | 641 return; |
647 } | 642 } |
648 | 643 |
649 if (paintPhase != PaintPhaseSelfOutline) | 644 paintContents(paintInfo, scrolledOffset); |
650 paintContents(paintInfo, scrolledOffset); | |
651 | |
652 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l
ines and between blocks. | 645 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection on l
ines and between blocks. |
653 | 646 |
654 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) | 647 if (paintPhase == PaintPhaseForeground) { |
655 && style()->hasOutline() && !style()->outlineStyleIsAuto()) { | 648 if (style()->hasOutline() && !style()->outlineStyleIsAuto()) |
656 paintOutline(paintInfo, LayoutRect(paintOffset, size())); | 649 paintOutline(paintInfo, LayoutRect(paintOffset, size())); |
| 650 |
| 651 // If the caret's node's render object's containing block is this block,
and the paint action is PaintPhaseForeground, |
| 652 // then paint the caret. |
| 653 paintCarets(paintInfo, paintOffset); |
657 } | 654 } |
658 | |
659 // If the caret's node's render object's containing block is this block, and
the paint action is PaintPhaseForeground, | |
660 // then paint the caret. | |
661 if (paintPhase == PaintPhaseForeground) | |
662 paintCarets(paintInfo, paintOffset); | |
663 } | 655 } |
664 | 656 |
665 bool RenderBlock::shouldPaintSelectionGaps() const | 657 bool RenderBlock::shouldPaintSelectionGaps() const |
666 { | 658 { |
667 return selectionState() != SelectionNone && isSelectionRoot(); | 659 return selectionState() != SelectionNone && isSelectionRoot(); |
668 } | 660 } |
669 | 661 |
670 bool RenderBlock::isSelectionRoot() const | 662 bool RenderBlock::isSelectionRoot() const |
671 { | 663 { |
672 ASSERT(node() || isAnonymous()); | 664 ASSERT(node() || isAnonymous()); |
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1931 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 1923 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
1932 { | 1924 { |
1933 showRenderObject(); | 1925 showRenderObject(); |
1934 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 1926 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
1935 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 1927 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
1936 } | 1928 } |
1937 | 1929 |
1938 #endif | 1930 #endif |
1939 | 1931 |
1940 } // namespace blink | 1932 } // namespace blink |
OLD | NEW |