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

Side by Side Diff: Source/core/layout/svg/SVGTextQuery.cpp

Issue 1162383003: C++11: Replace 0 with nullptr where applicable in layout code. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add one more file. Created 5 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 20 matching lines...) Expand all
31 #include "wtf/MathExtras.h" 31 #include "wtf/MathExtras.h"
32 #include "wtf/Vector.h" 32 #include "wtf/Vector.h"
33 33
34 namespace blink { 34 namespace blink {
35 35
36 // Base structure for callback user data 36 // Base structure for callback user data
37 struct QueryData { 37 struct QueryData {
38 QueryData() 38 QueryData()
39 : isVerticalText(false) 39 : isVerticalText(false)
40 , currentOffset(0) 40 , currentOffset(0)
41 , textLayoutObject(0) 41 , textLayoutObject(nullptr)
42 , textBox(0) 42 , textBox(nullptr)
43 { 43 {
44 } 44 }
45 45
46 bool isVerticalText; 46 bool isVerticalText;
47 unsigned currentOffset; 47 unsigned currentOffset;
48 LayoutSVGInlineText* textLayoutObject; 48 LayoutSVGInlineText* textLayoutObject;
49 const SVGInlineTextBox* textBox; 49 const SVGInlineTextBox* textBox;
50 }; 50 };
51 51
52 static inline InlineFlowBox* flowBoxForLayoutObject(LayoutObject* layoutObject) 52 static inline InlineFlowBox* flowBoxForLayoutObject(LayoutObject* layoutObject)
53 { 53 {
54 if (!layoutObject) 54 if (!layoutObject)
55 return 0; 55 return nullptr;
56 56
57 if (layoutObject->isLayoutBlock()) { 57 if (layoutObject->isLayoutBlock()) {
58 // If we're given a block element, it has to be a LayoutSVGText. 58 // If we're given a block element, it has to be a LayoutSVGText.
59 ASSERT(layoutObject->isSVGText()); 59 ASSERT(layoutObject->isSVGText());
60 LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(layoutObject); 60 LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(layoutObject);
61 61
62 // LayoutSVGText only ever contains a single line box. 62 // LayoutSVGText only ever contains a single line box.
63 InlineFlowBox* flowBox = layoutBlockFlow->firstLineBox(); 63 InlineFlowBox* flowBox = layoutBlockFlow->firstLineBox();
64 ASSERT(flowBox == layoutBlockFlow->lastLineBox()); 64 ASSERT(flowBox == layoutBlockFlow->lastLineBox());
65 return flowBox; 65 return flowBox;
66 } 66 }
67 67
68 if (layoutObject->isLayoutInline()) { 68 if (layoutObject->isLayoutInline()) {
69 // We're given a LayoutSVGInline or objects that derive from it (LayoutS VGTSpan / LayoutSVGTextPath) 69 // We're given a LayoutSVGInline or objects that derive from it (LayoutS VGTSpan / LayoutSVGTextPath)
70 LayoutInline* layoutInline = toLayoutInline(layoutObject); 70 LayoutInline* layoutInline = toLayoutInline(layoutObject);
71 71
72 // LayoutSVGInline only ever contains a single line box. 72 // LayoutSVGInline only ever contains a single line box.
73 InlineFlowBox* flowBox = layoutInline->firstLineBox(); 73 InlineFlowBox* flowBox = layoutInline->firstLineBox();
74 ASSERT(flowBox == layoutInline->lastLineBox()); 74 ASSERT(flowBox == layoutInline->lastLineBox());
75 return flowBox; 75 return flowBox;
76 } 76 }
77 77
78 ASSERT_NOT_REACHED(); 78 ASSERT_NOT_REACHED();
79 return 0; 79 return nullptr;
80 } 80 }
81 81
82 static void collectTextBoxesInFlowBox(InlineFlowBox* flowBox, Vector<SVGInlineTe xtBox*>& textBoxes) 82 static void collectTextBoxesInFlowBox(InlineFlowBox* flowBox, Vector<SVGInlineTe xtBox*>& textBoxes)
83 { 83 {
84 if (!flowBox) 84 if (!flowBox)
85 return; 85 return;
86 86
87 for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnL ine()) { 87 for (InlineBox* child = flowBox->firstChild(); child; child = child->nextOnL ine()) {
88 if (child->isInlineFlowBox()) { 88 if (child->isInlineFlowBox()) {
89 // Skip generated content. 89 // Skip generated content.
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 } 608 }
609 609
610 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const 610 int SVGTextQuery::characterNumberAtPosition(const FloatPoint& position) const
611 { 611 {
612 CharacterNumberAtPositionData data(position); 612 CharacterNumberAtPositionData data(position);
613 spatialQuery(m_queryRootLayoutObject, &data, characterNumberAtPositionCallba ck); 613 spatialQuery(m_queryRootLayoutObject, &data, characterNumberAtPositionCallba ck);
614 return data.characterNumberWithin(m_queryRootLayoutObject); 614 return data.characterNumberWithin(m_queryRootLayoutObject);
615 } 615 }
616 616
617 } 617 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/SVGTextMetricsBuilder.cpp ('k') | Source/core/layout/svg/line/SVGInlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698