kdelibs/khtml/html
David Hyatt
hyatt at apple.com
Mon Aug 18 15:00:47 CEST 2003
The code in Safari is a mess, and you should probably just ignore
what's in the Safari tree. Much of this complicated code came about
because I copied WinIE's bizarre behavior (in which .disabled is
separate from alternate vs. preferred).
The Mozilla way (just building your alternate stylesheet impl on top of
disabled flags on the sheets themselves) is much simpler and would
result in much of this code being thrown away. In my opinion we could
move to that sort of implementation safely and make this code a lot
easier to understand.
dave
On Monday, August 18, 2003, at 4:15AM, Peter Kelly wrote:
> On Mon, 18 Aug 2003, Dirk Mueller wrote:
>
>> On Sam, 16 Aug 2003, Peter Kelly wrote:
>>
>>> KHTML treats the disabled property as meaning "this stylesheet _can_
>>> be
>>> used" rather than "this stylesheet _is_ used". Thus, when you set
>>> disabled
>>> to false on a sheet it becomes available for use but is not actually
>>> used
>>> until the user selects the sheet from the menu.
>>
>> Ok, if thats indeed the case then the implementation has to be fixed.
>> I was
>> under the assumption from reading the Safari tree that the disabled
>> state is
>> an additional "never use this" option.
>>
>> This will probably simplify the code.
>>
>>>>> - if (isLoading() && m_isDisabled && (!m_alternate ||
>>>>> m_oldisDisabled))
>>>>> + if (isLoading() && m_isDisabled)
>>>>> getDocument()->styleSheetLoaded();
>>>>
>>
>> Still doesn't explain this commit though.
>
> I think what happened was an alternate stylesheet was being added to
> the
> pending count for some reason (I'm still not sure why this is), and
> then
> not being decremented when it finished loading because it was marked as
> alternate. Looking at the code directly below I see this:
>
> // Check #2: An alternate sheet becomes enabled while it is
> still loading.
> if (isLoading() && m_alternate && m_isDisabled)
> getDocument()->addPendingSheet();
>
> which seems wrong... it should only by added if it is _not_ disabled.
>
> Also, the check for m_oldisDisabled would never be true since it's
> guaranteed that m_isDisabled != m_oldisDisabled inside that block of
> code
> (which wasn't causing a problem in itself but it was reduntant).
>
> I need to think about this a bit more... I'll try and put together a
> patch
> which fixes the stylsheet usage based on the disabled property and
> fixes
> this problem at the same time.
>
>>
>>
>>
>
> --
> Peter Kelly
> pmk at kde.org
>
> _______________________________________________
> Khtml-devel at mail.kde.org
> http://mail.kde.org/mailman/listinfo/khtml-devel
More information about the Khtml-devel
mailing list