OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 : RenderReplaced(element, element->size()) | 42 : RenderReplaced(element, element->size()) |
43 { | 43 { |
44 view()->frameView()->setIsVisuallyNonEmpty(); | 44 view()->frameView()->setIsVisuallyNonEmpty(); |
45 } | 45 } |
46 | 46 |
47 bool RenderHTMLCanvas::requiresLayer() const | 47 bool RenderHTMLCanvas::requiresLayer() const |
48 { | 48 { |
49 if (RenderReplaced::requiresLayer()) | 49 if (RenderReplaced::requiresLayer()) |
50 return true; | 50 return true; |
51 | 51 |
52 HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(node()); | 52 HTMLCanvasElement* canvas = toHTMLCanvasElement(node()); |
53 return canvas && canvas->renderingContext() && canvas->renderingContext()->i
sAccelerated(); | 53 return canvas && canvas->renderingContext() && canvas->renderingContext()->i
sAccelerated(); |
54 } | 54 } |
55 | 55 |
56 void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) | 56 void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) |
57 { | 57 { |
58 LayoutRect rect = contentBoxRect(); | 58 LayoutRect rect = contentBoxRect(); |
59 rect.moveBy(paintOffset); | 59 rect.moveBy(paintOffset); |
60 | 60 |
61 if (Frame* frame = this->frame()) { | 61 if (Frame* frame = this->frame()) { |
62 if (Page* page = frame->page()) { | 62 if (Page* page = frame->page()) { |
63 if (paintInfo.phase == PaintPhaseForeground) | 63 if (paintInfo.phase == PaintPhaseForeground) |
64 page->addRelevantRepaintedObject(this, rect); | 64 page->addRelevantRepaintedObject(this, rect); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 bool useLowQualityScale = style()->imageRendering() == ImageRenderingOptimiz
eContrast; | 68 bool useLowQualityScale = style()->imageRendering() == ImageRenderingOptimiz
eContrast; |
69 static_cast<HTMLCanvasElement*>(node())->paint(paintInfo.context, rect, useL
owQualityScale); | 69 toHTMLCanvasElement(node())->paint(paintInfo.context, rect, useLowQualitySca
le); |
70 } | 70 } |
71 | 71 |
72 void RenderHTMLCanvas::canvasSizeChanged() | 72 void RenderHTMLCanvas::canvasSizeChanged() |
73 { | 73 { |
74 IntSize canvasSize = static_cast<HTMLCanvasElement*>(node())->size(); | 74 IntSize canvasSize = toHTMLCanvasElement(node())->size(); |
75 LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasS
ize.height() * style()->effectiveZoom()); | 75 LayoutSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasS
ize.height() * style()->effectiveZoom()); |
76 | 76 |
77 if (zoomedSize == intrinsicSize()) | 77 if (zoomedSize == intrinsicSize()) |
78 return; | 78 return; |
79 | 79 |
80 setIntrinsicSize(zoomedSize); | 80 setIntrinsicSize(zoomedSize); |
81 | 81 |
82 if (!parent()) | 82 if (!parent()) |
83 return; | 83 return; |
84 | 84 |
85 if (!preferredLogicalWidthsDirty()) | 85 if (!preferredLogicalWidthsDirty()) |
86 setPreferredLogicalWidthsDirty(true); | 86 setPreferredLogicalWidthsDirty(true); |
87 | 87 |
88 LayoutSize oldSize = size(); | 88 LayoutSize oldSize = size(); |
89 updateLogicalWidth(); | 89 updateLogicalWidth(); |
90 updateLogicalHeight(); | 90 updateLogicalHeight(); |
91 if (oldSize == size()) | 91 if (oldSize == size()) |
92 return; | 92 return; |
93 | 93 |
94 if (!selfNeedsLayout()) | 94 if (!selfNeedsLayout()) |
95 setNeedsLayout(true); | 95 setNeedsLayout(true); |
96 } | 96 } |
97 | 97 |
98 } // namespace WebCore | 98 } // namespace WebCore |
OLD | NEW |