WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
45568
WebKit nests font element when applying different font styles
https://bugs.webkit.org/show_bug.cgi?id=45568
Summary
WebKit nests font element when applying different font styles
Ryosuke Niwa
Reported
2010-09-10 15:40:57 PDT
Reproduction steps: 1. Go to
http://www.mozilla.org/editor/midasdemo/
2. Type "hello" 3. Change the font size to 4 4. Change the font family to Courier Expected result: <font size="4" face="Courier">hello</font> Actual result: <font class="Apple-style-span" size="4"><font class="Apple-style-span" face="Courier">hello</font></font>
Attachments
work in progress
(48.46 KB, patch)
2010-09-10 16:55 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
fixes the bug
(55.43 KB, patch)
2010-09-11 23:08 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
new patch
(34.84 KB, patch)
2010-09-15 13:45 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
fixed per Tony's comment
(35.71 KB, patch)
2010-09-29 17:23 PDT
,
Ryosuke Niwa
tony
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2010-09-10 16:55:32 PDT
Created
attachment 67265
[details]
work in progress I need to rebaseline editing/inserting/insert-3659587-fix.html and editing/style/style-3690704-fix.html as well but I'll convert them to use runDumpAsTextEditingTest() first.
Ryosuke Niwa
Comment 2
2010-09-11 23:08:01 PDT
Created
attachment 67331
[details]
fixes the bug
Ryosuke Niwa
Comment 3
2010-09-12 01:39:42 PDT
Comment on
attachment 67331
[details]
fixes the bug I found a way to break this patch up. Will file a blocker bug with a patch tomorrow morning.
Ryosuke Niwa
Comment 4
2010-09-15 13:45:18 PDT
Created
attachment 67706
[details]
new patch
Tony Chang
Comment 5
2010-09-29 12:57:09 PDT
Comment on
attachment 67706
[details]
new patch View in context:
https://bugs.webkit.org/attachment.cgi?id=67706&action=review
In general, looks fine, just need some clarification.
> WebCore/editing/ApplyStyleCommand.cpp:1162 > + if (!needToApplyStyle) > + return false;
What happens if we don't return early? Do we end up with a redundant tag?
> WebCore/editing/ApplyStyleCommand.cpp:1192 > + if (!element->parentNode() || !element->parentNode()->isContentEditable()) > + mode = RemoveNone;
This seems strange to me. Why would we change the passed in mode? Should the method just return false instead or should this check be done by the caller?
> WebCore/editing/ApplyStyleCommand.cpp:1879 > + Node* container = fontContainer ? fontContainer : startNode;
Isn't fontContainer always null here?
Ryosuke Niwa
Comment 6
2010-09-29 13:34:50 PDT
Comment on
attachment 67706
[details]
new patch View in context:
https://bugs.webkit.org/attachment.cgi?id=67706&action=review
>> WebCore/editing/ApplyStyleCommand.cpp:1162 >> + return false; > > What happens if we don't return early? Do we end up with a redundant tag?
No. It's quite opposite. When needToApplyStyle is false, the current run already has the desired style, and there's nothing to do. So we skip the run in applyInlineStyleToNodeRange (see
http://trac.webkit.org/browser/trunk/WebCore/editing/ApplyStyleCommand.cpp#L1158
). This is to avoid removing and adding the exact same markup. Of course, it implies that we leave the existing redundant styles in certain cases but I don't think that's a problem. When needToApplyStyle is true on the other hand, we go ahead and remove all styles that are either in conflict or same as the desired style from the current run so that there is no redundant markups present when we apply new style in applyInlineStyleToNodeRange.
>> WebCore/editing/ApplyStyleCommand.cpp:1192 >> + mode = RemoveNone; > > This seems strange to me. Why would we change the passed in mode? Should the method just return false instead or should this check be done by the caller?
We could do that. I need to look into the reason I added that check since I don't remember it anymore.
>> WebCore/editing/ApplyStyleCommand.cpp:1879 >> + Node* container = fontContainer ? fontContainer : startNode; > > Isn't fontContainer always null here?
Right. Will fix.
Ryosuke Niwa
Comment 7
2010-09-29 17:23:46 PDT
Created
attachment 69286
[details]
fixed per Tony's comment
Tony Chang
Comment 8
2010-09-29 17:49:41 PDT
Comment on
attachment 69286
[details]
fixed per Tony's comment View in context:
https://bugs.webkit.org/attachment.cgi?id=69286&action=review
r=me without the project.pbxproj change
> WebCore/WebCore.xcodeproj/project.pbxproj:-20860 > - developmentRegion = English;
I don't think you meant to include this. It caused the patch to now apply on the ews bots.
Ryosuke Niwa
Comment 9
2010-09-29 17:58:48 PDT
(In reply to
comment #8
)
> (From update of
attachment 69286
[details]
) > > WebCore/WebCore.xcodeproj/project.pbxproj:-20860 > > - developmentRegion = English; > > I don't think you meant to include this. It caused the patch to now apply on the ews bots.
Yeah, it was too late when I realized it. Will fix. Thanks for the timely review!
Ryosuke Niwa
Comment 10
2010-09-30 14:37:31 PDT
Committed
r68830
: <
http://trac.webkit.org/changeset/68830
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug