Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Issue 164803002: Handle CSSImageValue URLs in inline styles in templates correctly (Closed)

Created:
6 years, 10 months ago by adamk
Modified:
6 years, 9 months ago
Reviewers:
esprehn, ojan
CC:
blink-reviews, sof, eae+blinkwatch, ed+blinkwatch_opera.com, dglazkov+blink, apavlov+blink_chromium.org, adamk+blink_chromium.org, darktears, Inactive, rune+blink
Visibility:
Public.

Description

Handle CSSImageValue URLs in inline styles in templates correctly When importing or adopting nodes across Documents, this patch checks for baseURL mismatches between the two documents and re-resolves URLs for CSSImageValues in those cases. Without this patch, the URLs are empty when they enter the Document (since they tried to resolve against an empty baseURL when they were created). This requires storing the un-resolved URL inside the CSSImageValue alongside the resolved URL, and some unfortunately hacky code in Element.cpp to handle re-resolving. The resolve-on-adoption behavior matches the behavior recently specced for <img> elements in HTML (see http://html5.org/tools/web-apps-tracker?from=8508&to=8509) This does not yet support any other form of url() in CSS (-webkit-image-set being the most glaring omission). I've left FIXMEs in the code to handle those, but I fear adding any more hacks in Element.cpp; in order to support this generally, some serious refactoring in the CSSValue class hierarchy is required. BUG=229142 R=ojan@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=167931

Patch Set 1 #

Patch Set 2 : Now with fewer test failures and proper re-resolution behavior #

Patch Set 3 : Various refinements #

Patch Set 4 : Ready for review #

Total comments: 2

Patch Set 5 : Removed template usage #

Patch Set 6 : Removed template usage #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -32 lines) Patch
A LayoutTests/fast/css/resolve-inline-style-url-on-adopt.html View 1 2 3 1 chunk +18 lines, -0 lines 0 comments Download
A LayoutTests/fast/css/resolve-inline-style-url-on-adopt-expected.html View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
M Source/core/css/CSSImageValue.h View 1 2 3 4 4 chunks +11 lines, -8 lines 0 comments Download
M Source/core/css/CSSImageValue.cpp View 1 2 3 4 4 chunks +18 lines, -14 lines 0 comments Download
M Source/core/css/parser/BisonCSSParser-in.cpp View 1 2 3 6 chunks +6 lines, -6 lines 0 comments Download
M Source/core/dom/Element.cpp View 1 2 3 4 chunks +32 lines, -1 line 0 comments Download
M Source/core/html/HTMLBodyElement.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLTableElement.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/html/HTMLTablePartElement.cpp View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 15 (0 generated)
adamk
Would love y'all's opinion on this approach. The code that's in Element::didMoveToNewDocument() clearly shouldn't live ...
6 years, 10 months ago (2014-02-18 23:12:14 UTC) #1
adamk
Ping? On Tue, Feb 18, 2014 at 3:12 PM, <adamk@chromium.org> wrote: > Reviewers: esprehn, ojan, ...
6 years, 10 months ago (2014-02-20 01:19:28 UTC) #2
ojan
This all looks reasonable to me.
6 years, 10 months ago (2014-02-20 20:30:43 UTC) #3
esprehn
Conceptually this looks fine.
6 years, 10 months ago (2014-02-20 20:33:53 UTC) #4
adamk
Okay, here's a real stab at this functionality, PTAL
6 years, 10 months ago (2014-02-25 21:12:22 UTC) #5
ojan
lgtm https://codereview.chromium.org/164803002/diff/210001/Source/core/css/CSSImageValue.h File Source/core/css/CSSImageValue.h (right): https://codereview.chromium.org/164803002/diff/210001/Source/core/css/CSSImageValue.h#newcode55 Source/core/css/CSSImageValue.h:55: template<typename URLResolver> // Avoids a dependency on Document ...
6 years, 10 months ago (2014-02-26 03:00:29 UTC) #6
adamk
https://codereview.chromium.org/164803002/diff/210001/Source/core/css/CSSImageValue.h File Source/core/css/CSSImageValue.h (right): https://codereview.chromium.org/164803002/diff/210001/Source/core/css/CSSImageValue.h#newcode55 Source/core/css/CSSImageValue.h:55: template<typename URLResolver> // Avoids a dependency on Document On ...
6 years, 10 months ago (2014-02-26 17:00:19 UTC) #7
adamk
The CQ bit was checked by adamk@chromium.org
6 years, 10 months ago (2014-02-26 17:00:24 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adamk@chromium.org/164803002/210001
6 years, 10 months ago (2014-02-26 17:00:30 UTC) #9
esprehn
If rather we didn't use templates like this, it's just asking for abuse when someone ...
6 years, 10 months ago (2014-02-26 17:08:14 UTC) #10
adamk
The CQ bit was unchecked by adamk@chromium.org
6 years, 10 months ago (2014-02-26 17:31:34 UTC) #11
adamk
On 2014/02/26 17:08:14, esprehn wrote: > If rather we didn't use templates like this, it's ...
6 years, 10 months ago (2014-02-26 17:44:06 UTC) #12
adamk
The CQ bit was checked by adamk@chromium.org
6 years, 10 months ago (2014-02-26 17:44:10 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/adamk@chromium.org/164803002/250001
6 years, 10 months ago (2014-02-26 17:44:18 UTC) #14
adamk
6 years, 10 months ago (2014-02-26 21:19:41 UTC) #15
Message was sent while issue was closed.
Committed patchset #6 manually as r167931 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698