Chromium Code Reviews| Index: Source/core/rendering/RenderBoxModelObject.cpp |
| diff --git a/Source/core/rendering/RenderBoxModelObject.cpp b/Source/core/rendering/RenderBoxModelObject.cpp |
| index e96dd6da5759a24ecba8b3e68ea684e2084c29c0..6d3c5070be73007a575542e53d5f79c684a231f4 100644 |
| --- a/Source/core/rendering/RenderBoxModelObject.cpp |
| +++ b/Source/core/rendering/RenderBoxModelObject.cpp |
| @@ -38,6 +38,7 @@ |
| #include "core/rendering/RenderLayer.h" |
| #include "core/rendering/RenderObjectInlines.h" |
| #include "core/rendering/RenderRegion.h" |
| +#include "core/rendering/RenderTextFragment.h" |
| #include "core/rendering/RenderView.h" |
| #include "core/rendering/compositing/CompositedLayerMapping.h" |
| #include "core/rendering/compositing/RenderLayerCompositor.h" |
| @@ -60,13 +61,13 @@ using namespace HTMLNames; |
| // an anonymous block (that houses other blocks) or it will be an inline flow. |
| // <b><i><p>Hello</p></i></b>. In this example the <i> will have a block as |
| // its continuation but the <b> will just have an inline as its continuation. |
| -typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> ContinuationMap; |
| -static ContinuationMap* continuationMap = 0; |
| +typedef WillBeHeapHashMap<RawPtrWillBeMember<const RenderBoxModelObject>, RawPtrWillBeMember<RenderBoxModelObject> > ContinuationMap; |
|
haraken
2014/08/01 17:48:21
Just to confirm: Members in this persistent handle
tkent
2014/08/07 04:43:03
I'm not confident of it. I'll revisit here if the
|
| +static OwnPtrWillBePersistent<ContinuationMap>* continuationMap = 0; |
| // This HashMap is similar to the continuation map, but connects first-letter |
| // renderers to their remaining text fragments. |
| -typedef HashMap<const RenderBoxModelObject*, RenderTextFragment*> FirstLetterRemainingTextMap; |
| -static FirstLetterRemainingTextMap* firstLetterRemainingTextMap = 0; |
| +typedef WillBeHeapHashMap<RawPtrWillBeMember<const RenderBoxModelObject>, RawPtrWillBeMember<RenderTextFragment> > FirstLetterRemainingTextMap; |
|
haraken
2014/08/01 17:48:21
Ditto.
|
| +static OwnPtrWillBePersistent<FirstLetterRemainingTextMap>* firstLetterRemainingTextMap = 0; |
| void RenderBoxModelObject::setSelectionState(SelectionState state) |
| { |
| @@ -2511,18 +2512,18 @@ RenderBoxModelObject* RenderBoxModelObject::continuation() const |
| { |
| if (!continuationMap) |
| return 0; |
| - return continuationMap->get(this); |
| + return (*continuationMap)->get(this); |
| } |
| void RenderBoxModelObject::setContinuation(RenderBoxModelObject* continuation) |
| { |
| if (continuation) { |
| if (!continuationMap) |
| - continuationMap = new ContinuationMap; |
| - continuationMap->set(this, continuation); |
| + continuationMap = new OwnPtrWillBePersistent<ContinuationMap>(adoptPtrWillBeNoop(new ContinuationMap)); |
| + (*continuationMap)->set(this, continuation); |
| } else { |
| if (continuationMap) |
| - continuationMap->remove(this); |
| + (*continuationMap)->remove(this); |
| } |
| } |
| @@ -2542,17 +2543,18 @@ RenderTextFragment* RenderBoxModelObject::firstLetterRemainingText() const |
| { |
| if (!firstLetterRemainingTextMap) |
| return 0; |
| - return firstLetterRemainingTextMap->get(this); |
| + return (*firstLetterRemainingTextMap)->get(this); |
| } |
| void RenderBoxModelObject::setFirstLetterRemainingText(RenderTextFragment* remainingText) |
| { |
| if (remainingText) { |
| if (!firstLetterRemainingTextMap) |
| - firstLetterRemainingTextMap = new FirstLetterRemainingTextMap; |
| - firstLetterRemainingTextMap->set(this, remainingText); |
| - } else if (firstLetterRemainingTextMap) |
| - firstLetterRemainingTextMap->remove(this); |
| + firstLetterRemainingTextMap = new OwnPtrWillBePersistent<FirstLetterRemainingTextMap>(adoptPtrWillBeNoop(new FirstLetterRemainingTextMap)); |
| + (*firstLetterRemainingTextMap)->set(this, remainingText); |
| + } else if (firstLetterRemainingTextMap) { |
| + (*firstLetterRemainingTextMap)->remove(this); |
| + } |
| } |
| LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset) |