Summary: | position:fixed and transform on same element breaks fixed behavior | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Simon Fraser (smfr) <simon.fraser> | ||||||||||
Component: | Layout and Rendering | Assignee: | Simon Fraser (smfr) <simon.fraser> | ||||||||||
Status: | CLOSED FIXED | ||||||||||||
Severity: | Normal | CC: | eric, hausmann, jamesr, mitz | ||||||||||
Priority: | P2 | ||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||
Hardware: | Mac | ||||||||||||
OS: | OS X 10.5 | ||||||||||||
Bug Depends on: | |||||||||||||
Bug Blocks: | 36652 | ||||||||||||
Attachments: |
|
Created attachment 45920 [details]
Patch
Comment on attachment 45920 [details] Patch > @@ -982,9 +984,14 @@ void RenderBox::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, Transfor > if (style()->position() == FixedPosition) > fixed = true; > > + bool isFixedPos = style()->position() == FixedPosition; > bool hasTransform = hasLayer() && layer()->transform(); > - if (hasTransform) > - fixed = false; // Elements with transforms act as a containing block for fixed position descendants > + if (hasTransform) { > + // If this box has a transform, it acts as a fixed position container for fixed descendants, > + // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. > + fixed &= isFixedPos; > + } else > + fixed |= isFixedPos; This doesn’t look right. Created attachment 45943 [details]
Revised patch
This patch is missing the binary data, which is why it's failing to apply correctly. Note that "webkit-patch upload" or "webkit-patch post" or "webkit-patch post-commits" all know how to generate git diff --binary patches correctly so that the bots will be able to property process them. :) Created attachment 46404 [details]
Patch
Comment on attachment 46404 [details] Patch > + EPosition position; > + if ((position = renderer()->style()->position()) == FixedPosition) { > + if (!ancestorLayer || ancestorLayer == renderer()->view()->layer()) { Please just initialize position first, then do a single if statement: if (position == FixedPosition && (!ancestorLayer || ancestorLayer == renderer()->view()->layer())) { … r=me |
Created attachment 42844 [details] Testcase If an element has both position:fixed and a transform, then it behaves as if it's absolutely positioned. I think the fixed positioning should take effect, and then the transform.