WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 54301
RenderBR::width() tries but fails to override RenderText::width()
https://bugs.webkit.org/show_bug.cgi?id=54301
Summary
RenderBR::width() tries but fails to override RenderText::width()
Nico Weber
Reported
2011-02-11 11:38:49 PST
RenderBR::width() tries but fails to override RenderText::width()
Attachments
Patch
(1.88 KB, patch)
2011-02-11 11:40 PST
,
Nico Weber
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Nico Weber
Comment 1
2011-02-11 11:40:44 PST
Created
attachment 82158
[details]
Patch
Nico Weber
Comment 2
2011-02-11 11:41:00 PST
Found by clang's new -Woverload-virtual: In file included from ../rendering/InlineBox.h:24: ../rendering/RenderBR.h:43:22: error: 'WebCore::RenderBR::width' hides overloaded virtual functions [-Woverloaded-virtual] virtual unsigned width(unsigned /*from*/, unsigned /*len*/, const Font&, int /*xpos*/) const { return 0; } ^ In file included from /b/build/slave/mac_clang/build/src/third_party/WebKit/Source/WebCore/WebCore.gyp/../dom/Node.cpp:72: In file included from ../rendering/RenderBlock.h:30: In file included from ../rendering/RootInlineBox.h:25: In file included from ../rendering/InlineFlowBox.h:24: In file included from ../rendering/InlineBox.h:24: In file included from ../rendering/RenderBR.h:24: ../rendering/RenderText.h:74:22: note: hidden overloaded virtual function 'WebCore::RenderText::width' declared here virtual unsigned width(unsigned from, unsigned len, const Font&, int xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const; ^ ../rendering/RenderText.h:75:22: note: hidden overloaded virtual function 'WebCore::RenderText::width' declared here virtual unsigned width(unsigned from, unsigned len, int xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
Darin Adler
Comment 3
2011-02-11 12:04:05 PST
Comment on
attachment 82158
[details]
Patch What’s the symptom of this bug? We need a test case that will catch this if we make the same mistake in the future. Did you try to make a test case?
Darin Adler
Comment 4
2011-02-11 12:04:35 PST
Oh, I see, the compiler found it. Still, can we make a test case? Does fixing this change any regression test results?
Nico Weber
Comment 5
2011-02-11 12:27:59 PST
I'm trying to get webkit building with -Woverloaded-virtual so that the compiler catches this problem automatically. Does webkit generally use test cases for things that are found by compilers? If so, I will try to come up with one.
Darin Adler
Comment 6
2011-02-11 12:28:56 PST
(In reply to
comment #5
)
> Does webkit generally use test cases for things that are found by compilers?
Yes, if the compiler reveals a mistake that should have caused incorrect behavior. No, if the compiler catches something that has no real effect.
James Robinson
Comment 7
2011-02-13 11:49:30 PST
This doesn't seem to change the results of any layout tests on my snow leopard mac.
Anders Carlsson
Comment 8
2011-02-13 15:13:04 PST
The only (In reply to
comment #4
)
> Oh, I see, the compiler found it. Still, can we make a test case? > > Does fixing this change any regression test results?
Before this, the width of a RenderBR would take the slower RenderText codepath, which would return 0. (Assuming the width of the string "\n" is 0). I don't think we could make a test case for this.
Anders Carlsson
Comment 9
2011-02-13 15:13:57 PST
I'm going to go ahead and land this.
Anders Carlsson
Comment 10
2011-02-13 15:19:50 PST
Comment on
attachment 82158
[details]
Patch Clearing flags on attachment: 82158 Committed
r78444
: <
http://trac.webkit.org/changeset/78444
>
Anders Carlsson
Comment 11
2011-02-13 15:19:56 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug