summaryrefslogtreecommitdiff
path: root/layout/forms/nsButtonFrameRenderer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/forms/nsButtonFrameRenderer.cpp')
-rw-r--r--layout/forms/nsButtonFrameRenderer.cpp81
1 files changed, 19 insertions, 62 deletions
diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp
index bf513374a0..eaf1f82c14 100644
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -241,10 +241,9 @@ void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder,
!presContext->GetTheme()->ThemeDrawsFocusForWidget(disp->mAppearance)) {
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
- // Draw the focus and outline borders.
+ // Draw the -moz-focus-inner border
DrawResult result =
- mBFR->PaintOutlineAndFocusBorders(aBuilder, presContext, *aCtx,
- mVisibleRect, r);
+ mBFR->PaintInnerFocusBorder(aBuilder, presContext, *aCtx, mVisibleRect, r);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
@@ -278,20 +277,29 @@ nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
return NS_OK;
}
+void
+nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect, nsRect& aResult)
+{
+ GetButtonRect(aRect, aResult);
+ aResult.Deflate(mFrame->GetUsedBorderAndPadding());
+
+ nsMargin innerFocusPadding(0,0,0,0);
+ if (mInnerFocusStyle) {
+ mInnerFocusStyle->StylePadding()->GetPadding(innerFocusPadding);
+ }
+ aResult.Inflate(innerFocusPadding);
+}
+
DrawResult
-nsButtonFrameRenderer::PaintOutlineAndFocusBorders(
+nsButtonFrameRenderer::PaintInnerFocusBorder(
nsDisplayListBuilder* aBuilder,
nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aRect)
{
- // once we have all that we'll draw the focus if we have it. We will
- // need to draw 2 focuses, the inner and the outer. This is so we
- // can do any kind of look and feel. Some buttons have focus on the
- // outside like mac and motif. While others like windows have it
- // inside (dotted line). Usually only one will be specifed. But I
- // guess you could have both if you wanted to.
+ // we draw the -moz-focus-inner border just inside the button's
+ // normal border and padding, to match Windows themes.
nsRect rect;
@@ -348,57 +356,6 @@ nsButtonFrameRenderer::GetButtonRect(const nsRect& aRect, nsRect& r)
}
-void
-nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect, nsRect& focusRect)
-{
- GetButtonRect(aRect, focusRect);
- focusRect.Deflate(GetButtonBorderAndPadding());
- focusRect.Deflate(GetButtonInnerFocusMargin());
-}
-
-
-nsMargin
-nsButtonFrameRenderer::GetButtonBorderAndPadding()
-{
- return mFrame->GetUsedBorderAndPadding();
-}
-
-/**
- * Gets the size of the buttons border this is the union of the normal and disabled borders.
- */
-nsMargin
-nsButtonFrameRenderer::GetButtonInnerFocusMargin()
-{
- nsMargin innerFocusMargin(0,0,0,0);
-
- if (mInnerFocusStyle) {
- const nsStyleMargin* margin = mInnerFocusStyle->StyleMargin();
- margin->GetMargin(innerFocusMargin);
- }
-
- return innerFocusMargin;
-}
-
-nsMargin
-nsButtonFrameRenderer::GetButtonInnerFocusBorderAndPadding()
-{
- nsMargin result(0,0,0,0);
-
- if (mInnerFocusStyle) {
- mInnerFocusStyle->StylePadding()->GetPadding(result);
- result += mInnerFocusStyle->StyleBorder()->GetComputedBorder();
- }
-
- return result;
-}
-
-// gets all the focus borders and padding that will be added to the regular border
-nsMargin
-nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
-{
- return GetButtonInnerFocusMargin() + GetButtonInnerFocusBorderAndPadding();
-}
-
/**
* Call this when styles change
*/
@@ -415,7 +372,7 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext)
}
#endif
- // style for the inner such as a dotted line (Windows)
+ // get styles assigned to -moz-inner-focus (ie dotted border on Windows)
mInnerFocusStyle =
styleSet->ProbePseudoElementStyle(mFrame->GetContent()->AsElement(),
CSSPseudoElementType::mozFocusInner,