Closed Bug 22926 Opened 25 years ago Closed 25 years ago

[regression] background color no longer propogates to embedded webshell

Categories

(Core :: Layout: Form Controls, defect, P3)

x86
Windows NT
defect

Tracking

()

VERIFIED DUPLICATE of bug 17303

People

(Reporter: buster, Assigned: pierre)

References

()

Details

Peter had put in code that propogated the background color from a text control
to its embedded webshell.  This used to work, and at some point it has stopped
working.  The code on the html form control side is here:

http://lxr.mozilla.org/seamonkey/source/layout/html/forms/src/nsGfxTextControlFr
ame.cpp#2595

  /* set all style that propogates from the text control to its content
   * into the presContext for the webshell.
   * what I would prefer to do is hand the webshell my own
   * pres context at creation, rather than having it create its own.
   */

  nsFont font(presContext->GetDefaultFixedFontDeprecated());
  GetFont(presContext, font);
  const nsStyleFont* controlFont;
  GetStyleData(eStyleStruct_Font,  (const nsStyleStruct *&)controlFont);
  presContext->SetDefaultFont(font);
  presContext->SetDefaultFixedFont(font);

  const nsStyleColor* controlColor;
  GetStyleData(eStyleStruct_Color,  (const nsStyleStruct *&)controlColor);
  presContext->SetDefaultColor(controlColor->mColor);
  presContext->SetDefaultBackgroundColor(controlColor->mBackgroundColor);
  presContext->SetDefaultBackgroundImageRepeat(controlColor->mBackgroundRepeat);

  presContext->SetDefaultBackgroundImageAttachment
    (controlColor->mBackgroundAttachment);

  presContext->SetDefaultBackgroundImageOffset
    (controlColor->mBackgroundXPosition, controlColor->mBackgroundYPosition);
  presContext->SetDefaultBackgroundImage(controlColor->mBackgroundImage);

  /* HACK:
   * since I don't yet have a hook for setting info on the pres context before
style is
   * resolved, I need to call remap style on the root frame's style context.
   * The above code for setting presContext data should happen on a presContext
that
   * I create and pass into the webshell, rather than having the webshell create
its own
   */
  nsCOMPtr<nsIStyleContext> sc;
  result = frame->GetStyleContext(getter_AddRefs(sc));
  if (NS_FAILED(result)) { return result; }
  if (nsnull==sc) { return NS_ERROR_NULL_POINTER; }
  sc->RemapStyle(presContext);
  // end HACK
Status: NEW → RESOLVED
Closed: 25 years ago
Depends on: 17303
Resolution: --- → DUPLICATE
Target Milestone: M19
It's yet another dup of 19341 and 17303: fonts and background colors are ignored
in text edit fields because a hard-coded style rule is applied to the body
element. See PlaintextInitalStyle in nsTextEditRules.cpp.


*** This bug has been marked as a duplicate of 17303 ***
To verify this, go to an attachment I made for another bug:
http://bugzilla.mozilla.org/showattachment.cgi?attach_id=6784

You can see that text edit fields can have a background of a different color now.
A related problem was described in bug 33557
VERIFY dupe
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.