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 * Copyright (C) 2010 Google Inc. All rights reserved. | 7 * Copyright (C) 2010 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // The HashMap for storing continuation pointers. | 57 // The HashMap for storing continuation pointers. |
58 // An inline can be split with blocks occuring in between the inline content. | 58 // An inline can be split with blocks occuring in between the inline content. |
59 // When this occurs we need a pointer to the next object. We can basically be | 59 // When this occurs we need a pointer to the next object. We can basically be |
60 // split into a sequence of inlines and blocks. The continuation will either be | 60 // split into a sequence of inlines and blocks. The continuation will either be |
61 // an anonymous block (that houses other blocks) or it will be an inline flow. | 61 // an anonymous block (that houses other blocks) or it will be an inline flow. |
62 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as | 62 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as |
63 // its continuation but the <b> will just have an inline as its continuation. | 63 // its continuation but the <b> will just have an inline as its continuation. |
64 typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> Continuation
Map; | 64 typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> Continuation
Map; |
65 static ContinuationMap* continuationMap = 0; | 65 static ContinuationMap* continuationMap = 0; |
66 | 66 |
| 67 // This HashMap is similar to the continuation map, but connects first-letter |
| 68 // renderers to their remaining text fragments. |
| 69 typedef HashMap<const RenderBoxModelObject*, RenderObject*> FirstLetterRemaining
TextMap; |
| 70 static FirstLetterRemainingTextMap* firstLetterRemainingTextMap = 0; |
| 71 |
67 class ImageQualityController { | 72 class ImageQualityController { |
68 WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED; | 73 WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED; |
69 public: | 74 public: |
70 ImageQualityController(); | 75 ImageQualityController(); |
71 bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*
, const void* layer, const LayoutSize&); | 76 bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*
, const void* layer, const LayoutSize&); |
72 void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void*
layer); | 77 void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void*
layer); |
73 void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, c
onst LayoutSize&); | 78 void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, c
onst LayoutSize&); |
74 void objectDestroyed(RenderBoxModelObject*); | 79 void objectDestroyed(RenderBoxModelObject*); |
75 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } | 80 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } |
76 | 81 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 279 |
275 void RenderBoxModelObject::willBeDestroyed() | 280 void RenderBoxModelObject::willBeDestroyed() |
276 { | 281 { |
277 // This must be done before we destroy the RenderObject. | 282 // This must be done before we destroy the RenderObject. |
278 if (m_layer) | 283 if (m_layer) |
279 m_layer->clearClipRects(); | 284 m_layer->clearClipRects(); |
280 | 285 |
281 // A continuation of this RenderObject should be destroyed at subclasses. | 286 // A continuation of this RenderObject should be destroyed at subclasses. |
282 ASSERT(!continuation()); | 287 ASSERT(!continuation()); |
283 | 288 |
| 289 // If this is a first-letter object with a remaining text fragment then the |
| 290 // entry needs to be cleared from the map. |
| 291 if (firstLetterRemainingText()) |
| 292 setFirstLetterRemainingText(0); |
| 293 |
284 // RenderObject::willBeDestroyed calls back to destroyLayer() for layer dest
ruction | 294 // RenderObject::willBeDestroyed calls back to destroyLayer() for layer dest
ruction |
285 RenderObject::willBeDestroyed(); | 295 RenderObject::willBeDestroyed(); |
286 } | 296 } |
287 | 297 |
288 bool RenderBoxModelObject::hasSelfPaintingLayer() const | 298 bool RenderBoxModelObject::hasSelfPaintingLayer() const |
289 { | 299 { |
290 return m_layer && m_layer->isSelfPaintingLayer(); | 300 return m_layer && m_layer->isSelfPaintingLayer(); |
291 } | 301 } |
292 | 302 |
293 void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty
le* newStyle) | 303 void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty
le* newStyle) |
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 if (continuation) { | 2576 if (continuation) { |
2567 if (!continuationMap) | 2577 if (!continuationMap) |
2568 continuationMap = new ContinuationMap; | 2578 continuationMap = new ContinuationMap; |
2569 continuationMap->set(this, continuation); | 2579 continuationMap->set(this, continuation); |
2570 } else { | 2580 } else { |
2571 if (continuationMap) | 2581 if (continuationMap) |
2572 continuationMap->remove(this); | 2582 continuationMap->remove(this); |
2573 } | 2583 } |
2574 } | 2584 } |
2575 | 2585 |
| 2586 RenderObject* RenderBoxModelObject::firstLetterRemainingText() const |
| 2587 { |
| 2588 if (!firstLetterRemainingTextMap) |
| 2589 return 0; |
| 2590 return firstLetterRemainingTextMap->get(this); |
| 2591 } |
| 2592 |
| 2593 void RenderBoxModelObject::setFirstLetterRemainingText(RenderObject* remainingTe
xt) |
| 2594 { |
| 2595 if (remainingText) { |
| 2596 if (!firstLetterRemainingTextMap) |
| 2597 firstLetterRemainingTextMap = new FirstLetterRemainingTextMap; |
| 2598 firstLetterRemainingTextMap->set(this, remainingText); |
| 2599 } else if (firstLetterRemainingTextMap) |
| 2600 firstLetterRemainingTextMap->remove(this); |
| 2601 } |
| 2602 |
2576 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) | 2603 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) |
2577 { | 2604 { |
2578 // FIXME: We may want to not antialias when scaled by an integral value, | 2605 // FIXME: We may want to not antialias when scaled by an integral value, |
2579 // and we may want to antialias when translated by a non-integral value. | 2606 // and we may want to antialias when translated by a non-integral value. |
2580 return !context->getCTM().isIdentityOrTranslationOrFlipped(); | 2607 return !context->getCTM().isIdentityOrTranslationOrFlipped(); |
2581 } | 2608 } |
2582 | 2609 |
2583 } // namespace WebCore | 2610 } // namespace WebCore |
OLD | NEW |