summaryrefslogtreecommitdiff
path: root/www/firefox36/files/patch-ff-331088
blob: f121e2f909503563b477f57fae3c3bbd3b3d7318 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
--- .pc/331088-candidate.patch/layout/forms/nsFileControlFrame.cpp	2009-01-07 16:46:32.000000000 +0100
+++ layout/forms/nsFileControlFrame.cpp	2009-01-07 17:02:13.000000000 +0100
@@ -257,35 +257,37 @@ nsFileControlFrame::ScrollIntoView(nsPre
                    NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE,NS_PRESSHELL_SCROLL_IF_NOT_VISIBLE);
     }
   }
 }
 
 /**
  * This is called when our browse button is clicked
  */
-nsresult 
-nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
+NS_IMETHODIMP
+nsFileControlFrame::MouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
 {
+  NS_ASSERTION(mFrame, "We should have been unregistered");
+
   // only allow the left button
   nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
   if (mouseEvent) {
     PRUint16 whichButton;
     if (NS_SUCCEEDED(mouseEvent->GetButton(&whichButton))) {
       if (whichButton != 0) {
         return NS_OK;
       }
     }
   }
 
 
   nsresult result;
 
   // Get parent nsIDOMWindowInternal object.
-  nsIContent* content = GetContent();
+  nsIContent* content = mFrame->GetContent();
   if (!content)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIDocument> doc = content->GetDocument();
   if (!doc)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIDOMWindow> parentWindow =
@@ -304,17 +306,17 @@ nsFileControlFrame::MouseClick(nsIDOMEve
   if (NS_FAILED(result))
     return result;
 
   // Set filter "All Files"
   filePicker->AppendFilters(nsIFilePicker::filterAll);
 
   // Set default directry and filename
   nsAutoString defaultName;
-  GetProperty(nsHTMLAtoms::value, defaultName);
+  mFrame->GetProperty(nsHTMLAtoms::value, defaultName);
 
   nsCOMPtr<nsILocalFile> currentFile = do_CreateInstance("@mozilla.org/file/local;1");
   if (currentFile && !defaultName.IsEmpty()) {
     result = currentFile->InitWithPath(defaultName);
     if (NS_SUCCEEDED(result)) {
       nsAutoString leafName;
       currentFile->GetLeafName(leafName);
       if (!leafName.IsEmpty()) {
@@ -328,46 +330,46 @@ nsFileControlFrame::MouseClick(nsIDOMEve
         nsCOMPtr<nsILocalFile> parentLocalFile = do_QueryInterface(parentFile, &result);
         if (parentLocalFile)
           filePicker->SetDisplayDirectory(parentLocalFile);
       }
     }
   }
 
   // Tell our textframe to remember the currently focused value
-  mTextFrame->InitFocusedValue();
+  mFrame->mTextFrame->InitFocusedValue();
 
   // Open dialog
   PRInt16 mode;
   result = filePicker->Show(&mode);
   if (NS_FAILED(result))
     return result;
   if (mode == nsIFilePicker::returnCancel)
     return NS_OK;
 
-  if (!mTextFrame) {
+  if (!mFrame) {
     // We got destroyed while the filepicker was up.  Don't do anything here.
     return NS_OK;
   }
   
   // Set property
   nsCOMPtr<nsILocalFile> localFile;
   result = filePicker->GetFile(getter_AddRefs(localFile));
   if (localFile) {
     nsAutoString unicodePath;
     result = localFile->GetPath(unicodePath);
     if (!unicodePath.IsEmpty()) {
-      mTextFrame->SetProperty(mPresContext, nsHTMLAtoms::value, unicodePath);
-      nsCOMPtr<nsIFileControlElement> fileControl = do_QueryInterface(mContent);
+      mFrame->mTextFrame->SetProperty(mFrame->mPresContext, nsHTMLAtoms::value, unicodePath);
+      nsCOMPtr<nsIFileControlElement> fileControl = do_QueryInterface(content);
       if (fileControl) {
         fileControl->SetFileName(unicodePath, PR_FALSE);
       }
       
       // May need to fire an onchange here
-      mTextFrame->CheckFireOnChange();
+      mFrame->mTextFrame->CheckFireOnChange();
       return NS_OK;
     }
   }
 
   return NS_FAILED(result) ? result : NS_ERROR_FAILURE;
 }
 
 
@@ -660,18 +662,8 @@ nsFileControlFrame::OnContentReset()
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////
 // Mouse listener implementation
 
 NS_IMPL_ISUPPORTS1(nsFileControlFrame::MouseListener, nsIDOMMouseListener)
 
-NS_IMETHODIMP
-nsFileControlFrame::MouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
-{
-  if (mFrame) {
-    return mFrame->MouseClick(aMouseEvent);
-  }
-
-  return NS_OK;
-}
-
--- .pc/331088-candidate.patch/layout/forms/nsFileControlFrame.h	2009-01-07 17:18:55.000000000 +0100
+++ layout/forms/nsFileControlFrame.h	2009-01-07 17:19:00.000000000 +0100
@@ -142,18 +142,16 @@ protected:
     NS_IMETHOD MouseOver(nsIDOMEvent* aMouseEvent) { return NS_OK; }
     NS_IMETHOD MouseOut(nsIDOMEvent* aMouseEvent) { return NS_OK; }
     NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
 
   private:
     nsFileControlFrame* mFrame;
   };
   
-  nsresult MouseClick(nsIDOMEvent* aMouseEvent);
-
   virtual PRIntn GetSkipSides() const;
 
   /**
    * The text frame (populated on initial reflow).
    * @see nsFileControlFrame::Reflow
    */
   nsNewFrame* mTextFrame;
   /**