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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. 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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 PaintInfo childInfo(paintInfo); | 555 PaintInfo childInfo(paintInfo); |
556 childInfo.paintingRoot = paintingRootForChildren(paintInfo); | 556 childInfo.paintingRoot = paintingRootForChildren(paintInfo); |
557 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) | 557 for (RenderObject* child = firstChild(); child; child = child->nextSibling()
) |
558 child->paint(childInfo, tx, ty); | 558 child->paint(childInfo, tx, ty); |
559 } | 559 } |
560 | 560 |
561 void RenderBox::paintRootBoxDecorations(PaintInfo& paintInfo, int tx, int ty) | 561 void RenderBox::paintRootBoxDecorations(PaintInfo& paintInfo, int tx, int ty) |
562 { | 562 { |
563 const FillLayer* bgLayer = style()->backgroundLayers(); | 563 const FillLayer* bgLayer = style()->backgroundLayers(); |
564 Color bgColor = style()->backgroundColor(); | 564 Color bgColor = style()->backgroundColor(); |
| 565 RenderObject* bodyObject = 0; |
565 if (!style()->hasBackground() && node() && node()->hasTagName(HTMLNames::htm
lTag)) { | 566 if (!style()->hasBackground() && node() && node()->hasTagName(HTMLNames::htm
lTag)) { |
566 // Locate the <body> element using the DOM. This is easier than trying | 567 // Locate the <body> element using the DOM. This is easier than trying |
567 // to crawl around a render tree with potential :before/:after content a
nd | 568 // to crawl around a render tree with potential :before/:after content a
nd |
568 // anonymous blocks created by inline <body> tags etc. We can locate th
e <body> | 569 // anonymous blocks created by inline <body> tags etc. We can locate th
e <body> |
569 // render object very easily via the DOM. | 570 // render object very easily via the DOM. |
570 HTMLElement* body = document()->body(); | 571 HTMLElement* body = document()->body(); |
571 RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body-
>renderer() : 0; | 572 bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() :
0; |
572 if (bodyObject) { | 573 if (bodyObject) { |
573 bgLayer = bodyObject->style()->backgroundLayers(); | 574 bgLayer = bodyObject->style()->backgroundLayers(); |
574 bgColor = bodyObject->style()->backgroundColor(); | 575 bgColor = bodyObject->style()->backgroundColor(); |
575 } | 576 } |
576 } | 577 } |
577 | 578 |
578 int w = width(); | 579 int w = width(); |
579 int h = height(); | 580 int h = height(); |
580 | 581 |
581 int rw; | 582 int rw; |
582 int rh; | 583 int rh; |
583 if (view()->frameView()) { | 584 if (view()->frameView()) { |
584 rw = view()->frameView()->contentsWidth(); | 585 rw = view()->frameView()->contentsWidth(); |
585 rh = view()->frameView()->contentsHeight(); | 586 rh = view()->frameView()->contentsHeight(); |
586 } else { | 587 } else { |
587 rw = view()->width(); | 588 rw = view()->width(); |
588 rh = view()->height(); | 589 rh = view()->height(); |
589 } | 590 } |
590 | 591 |
591 // CSS2 14.2: | 592 // CSS2 14.2: |
592 // The background of the box generated by the root element covers the entire
canvas including | 593 // The background of the box generated by the root element covers the entire
canvas including |
593 // its margins. | 594 // its margins. |
594 int bx = tx - marginLeft(); | 595 int bx = tx - marginLeft(); |
595 int by = ty - marginTop(); | 596 int by = ty - marginTop(); |
596 int bw = max(w + marginLeft() + marginRight() + borderLeft() + borderRight()
, rw); | 597 int bw = max(w + marginLeft() + marginRight() + borderLeft() + borderRight()
, rw); |
597 int bh = max(h + marginTop() + marginBottom() + borderTop() + borderBottom()
, rh); | 598 int bh = max(h + marginTop() + marginBottom() + borderTop() + borderBottom()
, rh); |
598 | 599 |
599 paintFillLayers(paintInfo, bgColor, bgLayer, bx, by, bw, bh); | 600 paintFillLayers(paintInfo, bgColor, bgLayer, bx, by, bw, bh, CompositeSource
Over, bodyObject); |
600 | 601 |
601 if (style()->hasBorder() && style()->display() != INLINE) | 602 if (style()->hasBorder() && style()->display() != INLINE) |
602 paintBorder(paintInfo.context, tx, ty, w, h, style()); | 603 paintBorder(paintInfo.context, tx, ty, w, h, style()); |
603 } | 604 } |
604 | 605 |
605 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) | 606 void RenderBox::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) |
606 { | 607 { |
607 if (!shouldPaintWithinRoot(paintInfo)) | 608 if (!shouldPaintWithinRoot(paintInfo)) |
608 return; | 609 return; |
609 | 610 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 IntRect maskRect; | 713 IntRect maskRect; |
713 IntPoint phase; | 714 IntPoint phase; |
714 IntSize tileSize; | 715 IntSize tileSize; |
715 calculateBackgroundImageGeometry(maskLayer, bbox.x(), bbox.y(), bbox
.width(), bbox.height(), maskRect, phase, tileSize); | 716 calculateBackgroundImageGeometry(maskLayer, bbox.x(), bbox.y(), bbox
.width(), bbox.height(), maskRect, phase, tileSize); |
716 result.unite(maskRect); | 717 result.unite(maskRect); |
717 } | 718 } |
718 } | 719 } |
719 return result; | 720 return result; |
720 } | 721 } |
721 | 722 |
722 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons
t FillLayer* fillLayer, int tx, int ty, int width, int height, CompositeOperator
op) | 723 void RenderBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c, cons
t FillLayer* fillLayer, int tx, int ty, int width, int height, CompositeOperator
op, RenderObject* backgroundObject) |
723 { | 724 { |
724 if (!fillLayer) | 725 if (!fillLayer) |
725 return; | 726 return; |
726 | 727 |
727 paintFillLayers(paintInfo, c, fillLayer->next(), tx, ty, width, height, op); | 728 paintFillLayers(paintInfo, c, fillLayer->next(), tx, ty, width, height, op,
backgroundObject); |
728 paintFillLayer(paintInfo, c, fillLayer, tx, ty, width, height, op); | 729 paintFillLayer(paintInfo, c, fillLayer, tx, ty, width, height, op, backgroun
dObject); |
729 } | 730 } |
730 | 731 |
731 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const
FillLayer* fillLayer, int tx, int ty, int width, int height, CompositeOperator
op) | 732 void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const
FillLayer* fillLayer, int tx, int ty, int width, int height, CompositeOperator
op, RenderObject* backgroundObject) |
732 { | 733 { |
733 paintFillLayerExtended(paintInfo, c, fillLayer, tx, ty, width, height, 0, op
); | 734 paintFillLayerExtended(paintInfo, c, fillLayer, tx, ty, width, height, 0, op
, backgroundObject); |
734 } | 735 } |
735 | 736 |
736 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) | 737 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) |
737 { | 738 { |
738 if (!parent()) | 739 if (!parent()) |
739 return; | 740 return; |
740 | 741 |
741 if ((style()->borderImage().image() && style()->borderImage().image()->data(
) == image) || | 742 if ((style()->borderImage().image() && style()->borderImage().image()->data(
) == image) || |
742 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat
a() == image)) { | 743 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat
a() == image)) { |
743 repaint(); | 744 repaint(); |
(...skipping 2132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2876 #if ENABLE(SVG) | 2877 #if ENABLE(SVG) |
2877 | 2878 |
2878 TransformationMatrix RenderBox::localTransform() const | 2879 TransformationMatrix RenderBox::localTransform() const |
2879 { | 2880 { |
2880 return TransformationMatrix(1, 0, 0, 1, x(), y()); | 2881 return TransformationMatrix(1, 0, 0, 1, x(), y()); |
2881 } | 2882 } |
2882 | 2883 |
2883 #endif | 2884 #endif |
2884 | 2885 |
2885 } // namespace WebCore | 2886 } // namespace WebCore |
OLD | NEW |