Closed
Bug 842065
Opened 12 years ago
Closed 12 years ago
Remove nsIFrame::GetStyleDataExternal
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla24
People
(Reporter: dholbert, Assigned: dholbert)
Details
Attachments
(1 file, 2 obsolete files)
4.05 KB,
patch
|
dholbert
:
review+
|
Details | Diff | Splinter Review |
nsIFrame::GetStyleDataExternal() can go away.
IIUC believe it's there as a virtual method to allow other libraries (i.e. non-gklayout libraries, in non-libxul builds) to call into methods like GetStyleVisiblity() that need access to our mStyleContext.
However, now that we no longer support non-libxul builds, it's no longer necessary.
Assignee | ||
Comment 1•12 years ago
|
||
Assignee | ||
Comment 2•12 years ago
|
||
Actually, maybe _IMPL_NS_LAYOUT is defined unconditionally now, so we can just drop that #if/#else in nsIFrame.h?
Assignee | ||
Comment 3•12 years ago
|
||
Comment on attachment 714824 [details] [diff] [review]
fix v1
>diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h
> #ifdef _IMPL_NS_LAYOUT
> #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
> const nsStyle##name_ * GetStyle##name_ () const { \
> NS_ASSERTION(mStyleContext, "No style context found!"); \
> return mStyleContext->GetStyle##name_ (); \
> }
> #else
> #define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
> const nsStyle##name_ * GetStyle##name_ () const { \
>+ NS_ASSERTION(mStyleContext, "unexpected null pointer"); \
> return static_cast<const nsStyle##name_*>( \
>- GetStyleDataExternal(eStyleStruct_##name_)); \
>+ mStyleContext->GetStyleData(eStyleStruct_##name_)); \
> }
Yeah, never mind -- looks like we should only be taking this patch IFF we can assume _NS_IMPL_LAYOUT is always defined (which IIUC means "we're in the same library as gklayout").
And if that assumption is true, then we can just drop the "#else" clause here entirely. Right?
(Would it be safe to stop defining / checking _NS_IMPL_LAYOUT?)
Attachment #714824 -
Flags: review?(dbaron)
If there are no longer any callers outside libxul (possibly including binary extensions... though I hope not), then we could get rid of the whole not-_IMPL_NS_LAYOUT path.
(It also could be a perf win, since w don't actually bother to define _IMPL_NS_LAYOUT for many things outside layout/ that are in libxul; there might even be other uses of _IMPL_NS_LAYOUT that depend on that, though I suspect not.)
![]() |
||
Comment 5•12 years ago
|
||
It would slightly surprise me if we do not have binary extensions getting style data...
Assignee | ||
Comment 6•12 years ago
|
||
Hmm... yeah, I didn't realize that binary extensions might be using this.
Given that possibility and given that this API isn't currently breaking / blocking anything, we might as well keep it for the time being.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
Comment 7•12 years ago
|
||
I'd be surprised if binary extensions were using nsIFrame nowadays... it's almost impossible to get to.
Previously we tried to add an #error to nsIFrame.h if you weren't MOZILLA_INTERNAL_API but there were issues with header include dependencies pulling in frames from content headers. Perhaps that could be resurrected, though.
So maybe we should do this; it should get us a perf win given the _IMPL_NS_LAYOUT not being defined for everything in libxul.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Assignee | ||
Comment 9•12 years ago
|
||
Note also that Bug 781360 patch 4 renamed GetStyleDataExternal to just StyleDataExternal (though maybe that doesn't affect binary extension compatibility?)
Circling back to this; I'm going to unbitrot & re-post the patch.
Assignee | ||
Comment 10•12 years ago
|
||
Here's an unbitrotted version of fix v1 (mostly just dropping a lot of "Get" prefixes).
I'm not clear from comment 8 on whether we should also drop the non-_IMPL_NS_LAYOUT chunk or keep it; I'd suggested that because I mistakenly thought it was unconditionally defined, but if it's not, then maybe we still want the two separate behaviors?
Attachment #714824 -
Attachment is obsolete: true
Attachment #740618 -
Flags: feedback?(dbaron)
Assignee | ||
Comment 11•12 years ago
|
||
See also bug 659722; apparently _IMPL_NS_LAYOUT may be replaced with MOZILLA_INTERNAL_API soon.
Comment on attachment 740618 [details] [diff] [review]
fix v1a (unbitrotted)
>- /**
> * Define typesafe getter functions for each style struct by
> * preprocessing the list of style structs. These functions are the
> * preferred way to get style data. The macro creates functions like:
> * const nsStyleBorder* StyleBorder();
> * const nsStyleColor* StyleColor();
> */
>
> #ifdef _IMPL_NS_LAYOUT
> #define STYLE_STRUCT(name_, checkdata_cb_) \
> const nsStyle##name_ * Style##name_ () const { \
> NS_ASSERTION(mStyleContext, "No style context found!"); \
> return mStyleContext->Style##name_ (); \
> }
> #else
> #define STYLE_STRUCT(name_, checkdata_cb_) \
> const nsStyle##name_ * Style##name_ () const { \
>+ NS_ASSERTION(mStyleContext, "unexpected null pointer"); \
> return static_cast<const nsStyle##name_*>( \
>- StyleDataExternal(eStyleStruct_##name_)); \
>+ mStyleContext->StyleData(eStyleStruct_##name_)); \
> }
> #endif
You should just remove the #ifdef-ing here as well (leaving only the first half)
You should also add a comment to both places that callers that are outside of libxul should be using nsIDOMWindow::GetComputedStyle instead.
r=dbaron with that
Attachment #740618 -
Flags: review+
Attachment #740618 -
Flags: feedback?(dbaron)
Attachment #740618 -
Flags: feedback+
Assignee | ||
Comment 13•12 years ago
|
||
(In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from comment #12)
> You should just remove the #ifdef-ing here as well (leaving only the first
> half)
Done. (& fixed minor bitrot)
> You should also add a comment to both places that callers that are outside
> of libxul should be using nsIDOMWindow::GetComputedStyle instead.
Sorry -- I'm not sure what you mean by "both places" there. I've added a comment in one place, at the end of the "Define typesafe getter functions" comment-block, in this updated patch -- where was the other place it should go?
Attachment #752188 -
Flags: feedback?(dbaron)
Assignee | ||
Comment 14•12 years ago
|
||
Comment on attachment 752188 [details] [diff] [review]
fix v2
(In reply to Daniel Holbert [:dholbert] from comment #13)
> where was the other place it should go?
dbaron says there used to be a second place, but it looks like it's been removed.
So I think this is good to land! I'll give it a sanity-check set of try builds, and push it to inbound if nothing explodes.
Attachment #752188 -
Attachment description: like so? → fix v2
Attachment #752188 -
Flags: feedback?(dbaron) → review+
Assignee | ||
Updated•12 years ago
|
Attachment #740618 -
Attachment is obsolete: true
Assignee | ||
Comment 15•12 years ago
|
||
Assignee | ||
Comment 16•12 years ago
|
||
Assignee | ||
Updated•12 years ago
|
Flags: in-testsuite-
Comment 17•12 years ago
|
||
Status: REOPENED → RESOLVED
Closed: 12 years ago → 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in
before you can comment on or make changes to this bug.
Description
•