Skip to content
Permalink
Browse files
<http://webkit.org/b/57239> Use forward class declaration instead of …
…including header

Reviewed by Dan Bernstein.

Adding a "using namespace WebCore;" statement in a header may
cause issues when <WebCore/Length.h> is included before
<CoreText/CoreText.h>.

Length.h defines the LengthType enum with a 'Fixed' value.
CoreText.h includes MacTypes.h, which has a
"typedef SInt32 Fixed;" statement, and then CoreText.h includes
other headers that also use 'Fixed', but expect the typedef to
be defined, not the enum.  If another header includes
"using namespace WebCore;" before CoreText.h, the
following compiler errors result (paths abbreviated):

    CoreText.framework/Headers/SFNTLayoutTypes.h:689: error: reference to 'Fixed' is ambiguous
    MacTypes.h:184: error: candidates are: typedef SInt32 Fixed
    Length.h:37: error:                 WebCore::LengthType WebCore::Fixed
    SFNTLayoutTypes.h:689: error: 'Fixed' does not name a type

* platform/mac/HTMLConverter.h: Use forward declaration of
DocumentLoader class instead of including header.  Remove the
unused "using namespace WebCore;" statement.

Canonical link: https://commits.webkit.org/71930@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@82128 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ddkilzer committed Mar 28, 2011
1 parent d44a661 commit c31fe53d65d0baef984988e167036b34d19914b5
Showing with 31 additions and 3 deletions.
  1. +27 −0 Source/WebCore/ChangeLog
  2. +4 −3 Source/WebCore/platform/mac/HTMLConverter.h
@@ -1,3 +1,30 @@
2011-03-28 David Kilzer <ddkilzer@apple.com>

<http://webkit.org/b/57239> Use forward class declaration instead of including header

Reviewed by Dan Bernstein.

Adding a "using namespace WebCore;" statement in a header may
cause issues when <WebCore/Length.h> is included before
<CoreText/CoreText.h>.

Length.h defines the LengthType enum with a 'Fixed' value.
CoreText.h includes MacTypes.h, which has a
"typedef SInt32 Fixed;" statement, and then CoreText.h includes
other headers that also use 'Fixed', but expect the typedef to
be defined, not the enum. If another header includes
"using namespace WebCore;" before CoreText.h, the
following compiler errors result (paths abbreviated):

CoreText.framework/Headers/SFNTLayoutTypes.h:689: error: reference to 'Fixed' is ambiguous
MacTypes.h:184: error: candidates are: typedef SInt32 Fixed
Length.h:37: error: WebCore::LengthType WebCore::Fixed
SFNTLayoutTypes.h:689: error: 'Fixed' does not name a type

* platform/mac/HTMLConverter.h: Use forward declaration of
DocumentLoader class instead of including header. Remove the
unused "using namespace WebCore;" statement.

2011-03-26 Dimitri Glazkov <dglazkov@chromium.org>

Reviewed by Eric Seidel.
@@ -23,20 +23,21 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/

#import "DocumentLoader.h"
#import "DOM.h"
#import "DOMDocument.h"
#import "DOMRange.h"

using namespace WebCore;
namespace WebCore {
class DocumentLoader;
}

@interface WebHTMLConverter : NSObject {
NSMutableAttributedString *_attrStr;
NSURL *_baseURL;
DOMDocument *_document;
DOMRange *_domRange;
NSMutableArray *_domStartAncestors;
DocumentLoader *_dataSource;
WebCore::DocumentLoader *_dataSource;
NSString *_standardFontFamily;
CGFloat _textSizeMultiplier;
CGFloat _webViewTextSizeMultiplier;

0 comments on commit c31fe53

Please sign in to comment.