Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: Source/WebCore/rendering/RenderBoxModelObject.cpp

Issue 9252031: Merge 104123 - Crash due to first-letter block processing (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/rendering/RenderBoxModelObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // The HashMap for storing continuation pointers. 59 // The HashMap for storing continuation pointers.
60 // An inline can be split with blocks occuring in between the inline content. 60 // An inline can be split with blocks occuring in between the inline content.
61 // When this occurs we need a pointer to the next object. We can basically be 61 // When this occurs we need a pointer to the next object. We can basically be
62 // split into a sequence of inlines and blocks. The continuation will either be 62 // split into a sequence of inlines and blocks. The continuation will either be
63 // an anonymous block (that houses other blocks) or it will be an inline flow. 63 // an anonymous block (that houses other blocks) or it will be an inline flow.
64 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as 64 // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as
65 // its continuation but the <b> will just have an inline as its continuation. 65 // its continuation but the <b> will just have an inline as its continuation.
66 typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> Continuation Map; 66 typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> Continuation Map;
67 static ContinuationMap* continuationMap = 0; 67 static ContinuationMap* continuationMap = 0;
68 68
69 // This HashMap is similar to the continuation map, but connects first-letter
70 // renderers to their remaining text fragments.
71 typedef HashMap<const RenderBoxModelObject*, RenderObject*> FirstLetterRemaining TextMap;
72 static FirstLetterRemainingTextMap* firstLetterRemainingTextMap = 0;
73
69 class ImageQualityController { 74 class ImageQualityController {
70 WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED; 75 WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED;
71 public: 76 public:
72 ImageQualityController(); 77 ImageQualityController();
73 bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image* , const void* layer, const LayoutSize&); 78 bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image* , const void* layer, const LayoutSize&);
74 void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer); 79 void removeLayer(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer);
75 void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, c onst LayoutSize&); 80 void set(RenderBoxModelObject*, LayerSizeMap* innerMap, const void* layer, c onst LayoutSize&);
76 void objectDestroyed(RenderBoxModelObject*); 81 void objectDestroyed(RenderBoxModelObject*);
77 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); } 82 bool isEmpty() { return m_objectLayerSizeMap.isEmpty(); }
78 83
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 281
277 void RenderBoxModelObject::willBeDestroyed() 282 void RenderBoxModelObject::willBeDestroyed()
278 { 283 {
279 // This must be done before we destroy the RenderObject. 284 // This must be done before we destroy the RenderObject.
280 if (m_layer) 285 if (m_layer)
281 m_layer->clearClipRects(); 286 m_layer->clearClipRects();
282 287
283 // A continuation of this RenderObject should be destroyed at subclasses. 288 // A continuation of this RenderObject should be destroyed at subclasses.
284 ASSERT(!continuation()); 289 ASSERT(!continuation());
285 290
291 // If this is a first-letter object with a remaining text fragment then the
292 // entry needs to be cleared from the map.
293 if (firstLetterRemainingText())
294 setFirstLetterRemainingText(0);
295
286 // RenderObject::willBeDestroyed calls back to destroyLayer() for layer dest ruction 296 // RenderObject::willBeDestroyed calls back to destroyLayer() for layer dest ruction
287 RenderObject::willBeDestroyed(); 297 RenderObject::willBeDestroyed();
288 } 298 }
289 299
290 bool RenderBoxModelObject::hasSelfPaintingLayer() const 300 bool RenderBoxModelObject::hasSelfPaintingLayer() const
291 { 301 {
292 return m_layer && m_layer->isSelfPaintingLayer(); 302 return m_layer && m_layer->isSelfPaintingLayer();
293 } 303 }
294 304
295 void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty le* newStyle) 305 void RenderBoxModelObject::styleWillChange(StyleDifference diff, const RenderSty le* newStyle)
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after
2704 if (continuation) { 2714 if (continuation) {
2705 if (!continuationMap) 2715 if (!continuationMap)
2706 continuationMap = new ContinuationMap; 2716 continuationMap = new ContinuationMap;
2707 continuationMap->set(this, continuation); 2717 continuationMap->set(this, continuation);
2708 } else { 2718 } else {
2709 if (continuationMap) 2719 if (continuationMap)
2710 continuationMap->remove(this); 2720 continuationMap->remove(this);
2711 } 2721 }
2712 } 2722 }
2713 2723
2724 RenderObject* RenderBoxModelObject::firstLetterRemainingText() const
2725 {
2726 if (!firstLetterRemainingTextMap)
2727 return 0;
2728 return firstLetterRemainingTextMap->get(this);
2729 }
2730
2731 void RenderBoxModelObject::setFirstLetterRemainingText(RenderObject* remainingTe xt)
2732 {
2733 if (remainingText) {
2734 if (!firstLetterRemainingTextMap)
2735 firstLetterRemainingTextMap = new FirstLetterRemainingTextMap;
2736 firstLetterRemainingTextMap->set(this, remainingText);
2737 } else if (firstLetterRemainingTextMap)
2738 firstLetterRemainingTextMap->remove(this);
2739 }
2740
2714 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context) 2741 bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context)
2715 { 2742 {
2716 // FIXME: We may want to not antialias when scaled by an integral value, 2743 // FIXME: We may want to not antialias when scaled by an integral value,
2717 // and we may want to antialias when translated by a non-integral value. 2744 // and we may want to antialias when translated by a non-integral value.
2718 return !context->getCTM().isIdentityOrTranslationOrFlipped(); 2745 return !context->getCTM().isIdentityOrTranslationOrFlipped();
2719 } 2746 }
2720 2747
2721 void RenderBoxModelObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransform s, TransformState& transformState) const 2748 void RenderBoxModelObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransform s, TransformState& transformState) const
2722 { 2749 {
2723 // We don't expect absoluteToLocal() to be called during layout (yet) 2750 // We don't expect absoluteToLocal() to be called during layout (yet)
(...skipping 17 matching lines...) Expand all
2741 bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->pr eserves3D()); 2768 bool preserve3D = useTransforms && (o->style()->preserves3D() || style()->pr eserves3D());
2742 if (useTransforms && shouldUseTransformFromContainer(o)) { 2769 if (useTransforms && shouldUseTransformFromContainer(o)) {
2743 TransformationMatrix t; 2770 TransformationMatrix t;
2744 getTransformFromContainer(o, containerOffset, t); 2771 getTransformFromContainer(o, containerOffset, t);
2745 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform); 2772 transformState.applyTransform(t, preserve3D ? TransformState::Accumulate Transform : TransformState::FlattenTransform);
2746 } else 2773 } else
2747 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm); 2774 transformState.move(containerOffset.width(), containerOffset.height(), p reserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransfo rm);
2748 } 2775 }
2749 2776
2750 } // namespace WebCore 2777 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBoxModelObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698