Bug 39672 - Make sure skia is not Chromium specific
Summary: Make sure skia is not Chromium specific
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 46162
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-25 06:05 PDT by Kwang Yul Seo
Modified: 2010-10-25 21:25 PDT (History)
10 users (show)

See Also:


Attachments
Patch (11.17 KB, patch)
2010-05-25 06:09 PDT, Kwang Yul Seo
eric: review-
Details | Formatted Diff | Diff
Patch (add typedef for canvas) (5.40 KB, patch)
2010-07-23 04:03 PDT, Patrick R. Gansterer
abarth: review-
Details | Formatted Diff | Diff
Move FontCustomPlatformData to platform/skia (23.82 KB, patch)
2010-09-06 14:29 PDT, Kwang Yul Seo
jamesr: review-
Details | Formatted Diff | Diff
Move FontCustomPlatformData to platform/skia (23.55 KB, patch)
2010-09-07 21:44 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
Move Image::loadPlatformResource to ImageChromium.cpp (5.21 KB, patch)
2010-09-09 10:33 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
Move Image::loadPlatformResource to ImageChromium.cpp (5.21 KB, patch)
2010-09-09 10:41 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
Move FontCacheLinux.cpp to platform/graphics/skia/FontCacheSkia.cpp (15.21 KB, patch)
2010-09-10 10:14 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp (9.48 KB, patch)
2010-09-20 14:01 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp (9.46 KB, patch)
2010-10-19 10:16 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff
Move SimpleFontDataLinux.cpp to platform/graphics/skia/SimpleFontDataSkia.cpp (36.23 KB, patch)
2010-10-25 13:15 PDT, Kwang Yul Seo
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kwang Yul Seo 2010-05-25 06:05:56 PDT
platform/graphics/skia is hardcoded with Chromimum specific code. Add PLATFORM(CHROMIUM) guard for skia/ext (PlatformCanvas and resampling) so other ports can use skia.

This is a bit ugly.
Comment 1 Kwang Yul Seo 2010-05-25 06:09:58 PDT
Created attachment 57011 [details]
Patch

Don't use skia/ext/platform_canvas.h and skia/ext/image_operations.h which are only available in Chromium source tree.

This patch is for BREW MP right now.
Comment 2 David Levin 2010-05-26 20:57:01 PDT
I'm pretty sure this isn't the way to do re-use these files but I'm cc'ing someone who should be more familiar with this area than I.
Comment 3 Kwang Yul Seo 2010-05-27 01:53:39 PDT
(In reply to comment #2)
> I'm pretty sure this isn't the way to do re-use these files but I'm cc'ing someone who should be more familiar with this area than I.

Thank you. I need to someone to discuss this issue.
Comment 4 Eric Seidel (no email) 2010-06-12 20:50:06 PDT
Comment on attachment 57011 [details]
Patch

This approach feels wrong to me too.  r- based on above comments.  You'll need to track someone down over in #chromium or on chromium-dev.
Comment 5 Kwang Yul Seo 2010-06-14 11:09:00 PDT
(In reply to comment #4)
> (From update of attachment 57011 [details])
> This approach feels wrong to me too.  r- based on above comments.  You'll need to track someone down over in #chromium or on chromium-dev.

Okay. I will try to find somebody to discuss this issue on #chromium.
Comment 6 Patrick R. Gansterer 2010-07-23 04:03:12 PDT
Created attachment 62408 [details]
Patch (add typedef for canvas)

This is only a part of attachment 57011 [details].
Comment 7 Eric Seidel (no email) 2010-08-10 09:54:12 PDT
Comment on attachment 62408 [details]
Patch (add typedef for canvas)

WebCore/platform/graphics/skia/PlatformContextSkia.cpp:594
 +      return m_canvas->getTopPlatformDevice().IsVectorial();
Why is this Chromium only?

WebCore/platform/graphics/skia/PlatformContextSkia.h:48
 +  typedef SkCanvas PlatformContextCanvasType;
Is skia not normally namespaced?

Looks OK, I think.
Comment 8 Stephen White 2010-08-13 07:01:44 PDT
Not sure what the status of this patch is, but it looks like an ok workaround for now.

Ideally, we'd upstream all the stuff from the chromium repo (chromium/src/skia/ext) into Skia proper, then everyone could use it.  Let me know if you're interested in working on that, and I can help you land it in Skia.
Comment 9 Kwang Yul Seo 2010-08-27 05:34:45 PDT
(In reply to comment #8)
> Not sure what the status of this patch is, but it looks like an ok workaround for now.
> 
> Ideally, we'd upstream all the stuff from the chromium repo (chromium/src/skia/ext) into Skia proper, then everyone could use it.  Let me know if you're interested in working on that, and I can help you land it in Skia.

I think it is a good idea to upstream Chromium's chromium/src/skia/ext to Skia repo so that other WebKit ports can use it. Please help me do the job.
Comment 10 Stephen White 2010-08-30 09:02:15 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > Not sure what the status of this patch is, but it looks like an ok workaround for now.
> > 
> > Ideally, we'd upstream all the stuff from the chromium repo (chromium/src/skia/ext) into Skia proper, then everyone could use it.  Let me know if you're interested in working on that, and I can help you land it in Skia.
> 
> I think it is a good idea to upstream Chromium's chromium/src/skia/ext to Skia repo so that other WebKit ports can use it. Please help me do the job.

After looking at it a bit, it seems as if this is not quite as clean as I thought.  It seems that skia/ext depends on some things in chromium/base.  So the first job would be to get rid of those dependencies.  This will require some knowledge of the chromium project, and some ideas of how to replace those dependencies (I don't have all the answers here).

After that, it would be a matter of reformatting the code to be more skia-friendly (getting rid of chrome-specific relative paths, for example), and then creating a patch for Skia to add the content of the (new) /ext directory, and uploading it to codereview.appspot.com for review.
Comment 11 Adam Barth 2010-08-31 20:10:26 PDT
Comment on attachment 62408 [details]
Patch (add typedef for canvas)

I'm not an expert here, but this doesn't look like the right solution.  Moving skia/ext out of the chromium repo is probably better than these ifdefs.
Comment 12 Kwang Yul Seo 2010-09-06 14:29:32 PDT
Created attachment 66669 [details]
Move FontCustomPlatformData to platform/skia

Move FontCustomPlatformData to platform/skia. There is no chromium specific code in FontCustomPlatformData.
Comment 13 Kwang Yul Seo 2010-09-06 14:38:01 PDT
> After looking at it a bit, it seems as if this is not quite as clean as I thought.  It seems that skia/ext depends on some things in chromium/base.  So the first job would be to get rid of those dependencies.  This will require some knowledge of the chromium project, and some ideas of how to replace those dependencies (I don't have all the answers here).
> 
> After that, it would be a matter of reformatting the code to be more skia-friendly (getting rid of chrome-specific relative paths, for example), and then creating a patch for Skia to add the content of the (new) /ext directory, and uploading it to codereview.appspot.com for review.

I will build Chromium and will do the job as you suggested. 

There are other patches not related to skia/ext such as moving FontCustomPlatformData to platform/skia. I will submit those patches first.
Comment 14 James Robinson 2010-09-07 16:18:33 PDT
Comment on attachment 66669 [details]
Move FontCustomPlatformData to platform/skia

This looks great, but could you do an "svn mv" instead of a remove/add pair so that metadata is preserved for these files?  Thanks.
Comment 15 Kwang Yul Seo 2010-09-07 21:44:57 PDT
Created attachment 66841 [details]
Move FontCustomPlatformData to platform/skia

The same patch, but used 'svn mv' this time as James suggested.
Comment 16 Kwang Yul Seo 2010-09-09 10:33:40 PDT
Created attachment 67055 [details]
Move Image::loadPlatformResource to ImageChromium.cpp

Move Chromium-specific Image::loadPlatformResource out of ImageSkia.cpp to ImageChromium.cpp.
Comment 17 WebKit Review Bot 2010-09-09 10:34:34 PDT
Attachment 67055 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/WebCore.gyp/WebCore.gyp:1230:  Line contains tab character.  [whitespace/tab] [5]
WebCore/platform/graphics/chromium/ImageChromium.cpp:33:  Found other header before a header this file implements. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
WebCore/platform/graphics/chromium/ImageChromium.cpp:34:  Found header this file implements after other header. Should be: config.h, primary header, blank line, and then alphabetically sorted.  [build/include_order] [4]
WebCore/platform/graphics/chromium/ImageChromium.cpp:45:  One space before end of line comments  [whitespace/comments] [5]
Total errors found: 4 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 18 Kwang Yul Seo 2010-09-09 10:41:24 PDT
Created attachment 67056 [details]
Move Image::loadPlatformResource to ImageChromium.cpp

Fix style errors.
Comment 19 James Robinson 2010-09-09 10:43:15 PDT
Comment on attachment 66841 [details]
Move FontCustomPlatformData to platform/skia

Looks good!  Thanks.
Comment 20 James Robinson 2010-09-09 10:49:09 PDT
The loadPlatformResource patch also looks all right, but I'll let the EWS bot compile check it first.  Have you compile checked this on Chromium mac?  I can check it myself if you don't have the hardware available if you give me a day or two.
Comment 21 Kwang Yul Seo 2010-09-09 10:52:09 PDT
(In reply to comment #20)
> The loadPlatformResource patch also looks all right, but I'll let the EWS bot compile check it first.  Have you compile checked this on Chromium mac?  I can check it myself if you don't have the hardware available if you give me a day or two.

I checked it on Chromium Linux, but not on Mac.
Comment 22 WebKit Commit Bot 2010-09-09 13:33:15 PDT
Comment on attachment 66841 [details]
Move FontCustomPlatformData to platform/skia

Clearing flags on attachment: 66841

Committed r67109: <http://trac.webkit.org/changeset/67109>
Comment 23 James Robinson 2010-09-09 18:29:56 PDT
Comment on attachment 67056 [details]
Move Image::loadPlatformResource to ImageChromium.cpp

Compile tested on chromium mac, seems to work fine here as well.  R=me
Comment 24 WebKit Commit Bot 2010-09-10 03:58:14 PDT
Comment on attachment 67056 [details]
Move Image::loadPlatformResource to ImageChromium.cpp

Clearing flags on attachment: 67056

Committed r67187: <http://trac.webkit.org/changeset/67187>
Comment 25 WebKit Commit Bot 2010-09-10 03:58:20 PDT
All reviewed patches have been landed.  Closing bug.
Comment 26 Kwang Yul Seo 2010-09-10 10:11:16 PDT
Reopen the bug as I have more patches.
Comment 27 Kwang Yul Seo 2010-09-10 10:14:02 PDT
Created attachment 67199 [details]
Move FontCacheLinux.cpp to platform/graphics/skia/FontCacheSkia.cpp

FontCacheLinux is not Linux specific implementation of FontCache. Move it to platform/graphics/skia and rename it to FontCacheSkia.cpp.
Comment 28 James Robinson 2010-09-12 15:24:33 PDT
Comment on attachment 67199 [details]
Move FontCacheLinux.cpp to platform/graphics/skia/FontCacheSkia.cpp

View in context: https://bugs.webkit.org/attachment.cgi?id=67199&action=prettypatch

I'm not so sure about this one - the file still is clearly Chromium specific (it directly uses ChromiumBridge for one) and isn't really more skia specific than linux specific.  Moving a chromium-specific file from /chromium to /skia seems like it would be a regression for your purposes, no?
Comment 29 Kwang Yul Seo 2010-09-12 16:44:45 PDT
(In reply to comment #28)
> (From update of attachment 67199 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=67199&action=prettypatch
> 
> I'm not so sure about this one - the file still is clearly Chromium specific (it directly uses ChromiumBridge for one) and isn't really more skia specific than linux specific.  Moving a chromium-specific file from /chromium to /skia seems like it would be a regression for your purposes, no?

Yes, you are right. FontCache::getFontDataForCharacters replies on ChromiumBridge. In Brew MP, I changed the method:


const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font,
                                                          const UChar* characters,
                                                          int length)
{
    return font.primaryFont();
}


Except for this method, there is no chromium specific code. I will submit the patch again after separating Chromium specific code. Thanks for your review.
Comment 30 Kwang Yul Seo 2010-09-14 09:20:32 PDT
Comment on attachment 67199 [details]
Move FontCacheLinux.cpp to platform/graphics/skia/FontCacheSkia.cpp
Comment 31 Kwang Yul Seo 2010-09-20 14:01:54 PDT
Created attachment 68133 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

GlyphPageTreeNodeLinux does not depend on Linux or Chromium. Move GGlyphPageTreeNodeLinux to platform/graphics/skia and rename it to GlyphPageTreeNodeSkia.cpp so that other ports can use it.
Comment 32 Kwang Yul Seo 2010-09-20 17:36:46 PDT
My idea is to move FontCacheLinux.cpp, GlyphPageTreeNodeLinux.cpp, SimpleFontDataLinux.cpp to skia because they are not Linux-specific nor Chromium-specific. 

I successfully compiled those files in Brew MP without modification. FontCache::getFontDataForCharacters was the only exception because it uses ChromiumBridge::getFontFamilyForCharacters.

What's your opinion, James? Is this a good direction or do you want me to duplicate the code for Brew MP?
Comment 33 James Robinson 2010-09-20 17:54:17 PDT
Comment on attachment 68133 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

Looks pretty good.  I'll let the cr-linux bot compile check this before touching the review? flag.

Overall I prefer this direction to duplicating code.  Just keep in mind that until the BREWMP port gets a buildbot on build.webkit.org, any changes to common files like this may break your build in a way that the patch contributor will probably not notice.
Comment 34 James Robinson 2010-09-20 19:19:31 PDT
Comment on attachment 68133 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

R=me, cr-linux is happy.
Comment 35 WebKit Commit Bot 2010-09-20 20:45:37 PDT
Comment on attachment 68133 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

Clearing flags on attachment: 68133

Committed r67918: <http://trac.webkit.org/changeset/67918>
Comment 36 WebKit Commit Bot 2010-09-20 20:45:46 PDT
All reviewed patches have been landed.  Closing bug.
Comment 37 WebKit Review Bot 2010-09-20 21:11:04 PDT
http://trac.webkit.org/changeset/67918 might have broken Chromium Win Release
Comment 38 James Robinson 2010-09-20 21:23:48 PDT
Reverting..that's not a very good start.

Compiler output:

3>------ Build started: Project: webcore_platform, Configuration: Release Win32 ------
3>Compiling...
3>GlyphPageTreeNodeSkia.cpp
3>..\platform\graphics\skia\GlyphPageTreeNodeSkia.cpp(51) : error C2039: 'setupPaint' : is not a member of 'WebCore::FontPlatformData'
3>        c:\webkitbuildslave\chromium-win-release\build\webcore\platform\graphics\chromium\FontPlatformDataChromiumWin.h(50) : see declaration of 'WebCore::FontPlatformData'
3>Build log was saved at "file://C:\WebKitBuildSlave\chromium-win-release\build\WebKit\chromium\Release\obj\webcore_platform\BuildLog.htm"
3>webcore_platform - 1 error(s), 0 warning(s)
========== Build: 2 succeeded, 1 failed, 80 up-to-date, 0 skipped ==========
Comment 39 Kwang Yul Seo 2010-09-20 22:08:59 PDT
(In reply to comment #38)
> Reverting..that's not a very good start.
> 
> Compiler output:
> 
> 3>------ Build started: Project: webcore_platform, Configuration: Release Win32 ------
> 3>Compiling...
> 3>GlyphPageTreeNodeSkia.cpp
> 3>..\platform\graphics\skia\GlyphPageTreeNodeSkia.cpp(51) : error C2039: 'setupPaint' : is not a member of 'WebCore::FontPlatformData'
> 3>        c:\webkitbuildslave\chromium-win-release\build\webcore\platform\graphics\chromium\FontPlatformDataChromiumWin.h(50) : see declaration of 'WebCore::FontPlatformData'
> 3>Build log was saved at "file://C:\WebKitBuildSlave\chromium-win-release\build\WebKit\chromium\Release\obj\webcore_platform\BuildLog.htm"
> 3>webcore_platform - 1 error(s), 0 warning(s)
> ========== Build: 2 succeeded, 1 failed, 80 up-to-date, 0 skipped ==========

It seems "['exclude', 'platform/graphics/skia/GlyphPageTreeNodeSkia\\.cpp$']" does not exclude the file. 

I will test the Chromium Win too before submitting the patch. Sorry for the inconvenience.
Comment 40 Kwang Yul Seo 2010-09-20 22:16:43 PDT
BTW, why is there no status bubble for cr-win?
Comment 41 Kwang Yul Seo 2010-09-21 17:22:41 PDT
Reopen the bug
Comment 42 Kwang Yul Seo 2010-10-19 10:16:53 PDT
Created attachment 71180 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

Second try! I built it on Chromium Win and Linux.
Comment 43 Eric Seidel (no email) 2010-10-19 14:26:53 PDT
(In reply to comment #40)
> BTW, why is there no status bubble for cr-win?

Setting up a chromium build with visual studio express is nearly impossible.  But if someone is interested in trying, there are instructions and I can get you access to an EC2 instance with windows on it.
Comment 44 James Robinson 2010-10-21 20:07:39 PDT
Comment on attachment 71180 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

Looks good.
Comment 45 WebKit Commit Bot 2010-10-21 20:40:02 PDT
Comment on attachment 71180 [details]
Move GlyphPageTreeNodeLinux.cpp to platform/graphics/skia/GlyphPageTreeNodeSkia.cpp

Clearing flags on attachment: 71180

Committed r70287: <http://trac.webkit.org/changeset/70287>
Comment 46 WebKit Commit Bot 2010-10-21 20:40:10 PDT
All reviewed patches have been landed.  Closing bug.
Comment 47 Kwang Yul Seo 2010-10-25 13:14:00 PDT
We open the bug as I have more patches.
Comment 48 Kwang Yul Seo 2010-10-25 13:15:21 PDT
Created attachment 71787 [details]
Move SimpleFontDataLinux.cpp to platform/graphics/skia/SimpleFontDataSkia.cpp
Comment 49 Adam Barth 2010-10-25 21:19:44 PDT
Please new bugs for new patches.
Comment 50 Kwang Yul Seo 2010-10-25 21:25:29 PDT
(In reply to comment #49)
> Please new bugs for new patches.

Oops. Okay.