RESOLVED FIXED 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 Friday, February 11, 2011 7:38:49 PM UTC
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
Nico Weber
Comment 1 Friday, February 11, 2011 7:40:44 PM UTC
Nico Weber
Comment 2 Friday, February 11, 2011 7:41:00 PM UTC
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 Friday, February 11, 2011 8:04:05 PM UTC
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 Friday, February 11, 2011 8:04:35 PM UTC
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 Friday, February 11, 2011 8:27:59 PM UTC
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 Friday, February 11, 2011 8:28:56 PM UTC
(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 Sunday, February 13, 2011 7:49:30 PM UTC
This doesn't seem to change the results of any layout tests on my snow leopard mac.
Anders Carlsson
Comment 8 Sunday, February 13, 2011 11:13:04 PM UTC
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 Sunday, February 13, 2011 11:13:57 PM UTC
I'm going to go ahead and land this.
Anders Carlsson
Comment 10 Sunday, February 13, 2011 11:19:50 PM UTC
Comment on attachment 82158 [details] Patch Clearing flags on attachment: 82158 Committed r78444: <http://trac.webkit.org/changeset/78444>
Anders Carlsson
Comment 11 Sunday, February 13, 2011 11:19:56 PM UTC
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.